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.