Sander @ February 27 at 9:18 am

Additional housekeeping routine prior to upgrading Ubuntu server

I upgraded one of my personal Ubuntu servers yesterday and with the knowledge of a good daily backup I knew I didn't have to prepare and see what I would encounter. This particular server has upgraded twice before, so has some custom and legacy configuration. After the third try I was successful and I wanted to share the following tips that helped me smooth out the upgrade process.

Clean up apt sources

The upgrade process will disable all third-party sources from your system to avoid complications updating system software, so it is helpful to be able to list all disabled sources. To aid in this I found it helpful to clear out the apt sources files before the upgrade my self.

In particular, in preparation of the upgrade, I removed .distUpgrade and .save files created by previous upgrades. I then removed all commented lines from the remaining source files starting with # deb, then deleted any 0 byte files which have no content: find . -type f -size 0c -delete.

This made it obvious what files had changed and what those changes are, that I needed to review. Typically by running find . -name "*.list" -exec sed -i 's/jammy/noble/g' {} \; after the upgrade was complete.

Update custom apt sources / PPAs before upgrading

It turns out I had Nginx and MariaDB installed pinned to a particular version that was no longer supported on the target Ubuntu Server version, this caused one upgrade to install the system versions which were incompatible with my configuration. On a second go, I first upgraded the software to the latest supported version for my legacy Ubuntu version, which updated the apt sources to something that was better supported.

Set DNS servers

Somewhere Ubuntu switched to systemd DNS management and I hadn't run sudo nano /etc/systemd/resolved.conf and set a DNS server, resulting in not being able to resolve any domains after the upgrade. I was able to set and verify the ResolveD configuration before the upgrade as the system service was already installed. After this, I encountered no issues.

#linux #ubuntu

Sander @ August 23 at 10:29 am

Wine32 on elementaryOS 7 or Ubuntu 22.04

x86 games, like Championship Manager 01/02, might not install on this OS which cannot install wine32 due to system conflicts. This means apps like Bottles (Wine wrapper) cannot select a working Wine version.

To get around this, install the PlayOnLinux flatpak, which has an option to change the current Wine version. This will let you pick x86 versions, which install wine32 inside the flatpak. After which the installer will run.

If you get prompted to insert the CD use this trick to copy the the files into a virtual CDROM

#gaming #cm0102 #linux

Sander @ March 13, 2024 at 12:37 pm

Tried 1Password for SSH keys and Git management (keys in 1Password, authentication via agent + desktop prompt before access, and 1Password must be running) and not a fan of more red tape around the SSH keys. Non-interactive processes just fail to use the key first-time round, so I ended up having to commonly do operations twice. Easy restore from a BackInTime backup. #security #linux

Sander @ August 25, 2023 at 11:49 am

RAM Usage Nerdery

I've been wondering how much RAM I used on my 32GB Ubuntu derivative workstation, mainly used for web development using docker containers and light vm experimentation. Yes when I spotcheck with htop I have enough RAM free, but do I actually need 32GB, when I'm in the market for a new device or an upgrade?

It turns out, yes I do ideally.

The setup

On startup I've been running this script to save the memory stats into a csv file:

#!/usr/bin/env bash
while true
  do free  | grep Mem | tr --squeeze-repeats ' ' ',' | tee --append ~/memory.csv
  sleep 10
done

Today (after 15 days) I pulled the stats into a database and browsed it:

sqlite-utils insert /tmp/mem.db memory-stats memory.csv --csv
datasette /tmp/mem.db

Sorting by the available column shows that the lowest value I get is 11.9GB available to be freed.

The available column is the sum of the Free column plus the portions of the Buffers and Cache columns (or the Buff/cache column) that can be relinquished immediately. The Available column is an estimate, not an exact figure. https://www.howtogeek.com/456943/how-to-use-the-free-command-on-linux/#the-available-column

I think it's a reasonable measure. This system does not have zram memory compression enabled, that would help probably.

It has 4GB swap, I did not measure it's usage.

Hopefully this review helps for people who want to measure their own usage.

#linux

Sander @ June 16, 2023 at 11:23 am

Workaround for when poetry cannot find pyenv managed python

I use pyenv to manage python versions for my projects, and use poetry to manage project dependencies. Poetry was unable to find the latest python version, and insisted on creating virtual envs with system python.

Setting poetry config virtualenvs.prefer-active-python true did not work for me, and neither did poetry env use whatever-version:

$ poetry env use 3.11
Could not find the python executable python3.11

However pyenv can list the the full path to the currently active python, which can be used as a parameter to poetry, so the following worked:

$ poetry env use $(pyenv which python)
$ poetry install; poetry run python --version

Update: double check that pyenv is configuring the shell correctly -- $HOME/.pyenv/shims should be in your PATH variable, and your shell runtime configuration file (such as .bashrc / .zshrc) should contain eval "$(pyenv init -)"

Hope this helps!

#poetry #python #pyenv #ubuntu #elementaryos #linux

Sander @ April 4, 2023 at 1:55 pm

Map Eject to Multitasking View

So I use ElementaryOS and in version 7 you are no longer able to map just the Eject key. I like to map this to the Multitasking View (something like the macOS Expose).

The solution is to use the DConf Editor application and search for show-desktop. ElementaryOS repurposes the show desktop to the multitasking view. Simply set the value to ['Eject']

Alternatively you can set the left-super key (windows/command) to the Multitasking View. This seems better supported.

#elementaryos #linux