Updating an old Ubuntu to a supported version

3 minute read

I host my own Mastodon instance, which generally is pretty easy to maintain. The great team in the Mastodon community does a super job in making it easy to upgrade as they release new versions. I’ve therefore been keeping my Mastodon installation up to date. Go me!

Unfortunately, I haven’t been keeping up on my operating system updates, so my Digital Ocean droplet was still way back on Ubuntu-22.10. The latest LTS release is 24.04. Ooooops.

More unfortunate, the standard do-release-upgrade won’t work between releases that are as far apart as mine is from the latest release. What to do?

The answer is to work my way through the version upgrades manually. This answer on Ask Ubuntu was especially helpful for figuring out how to do this.

Is this a tedious pain in the ass? Yes, yes it is.

Is it entirely my fault for not keeping my OS up-to-date? Also very much yes.

How I did it

Checking the meta-release file for Ubuntu, I see that I need to do two manual upgrades (from kinetic to lunar, then lunar to mantic), then I should be able to use do-release-upgrade from mantic to noble (aka Noble Numbat, aka the current LTS release).

So for each of lunar and mantic, I did these things…

  1. Downloaded the appropriate UpgradeTool from the meta-release file for Ubuntu
  2. Created a directory then unpacked the upgrade tool tar.gz file into it
  3. Solved problems along the way (see below)
  4. Ran the upgrade tool

Then I was able to run do-release-upgrade and, finally after hours of putzing about trying to get the Ubuntu upgrade going, then update Mastodon. Success!

Problems I solved along the way

Irritatingly, the yarn and postgres errors below needed to be fixed before the kinetic to lunar upgrade tool would run successfully.

The yarn gpg key was expired, causing an error during upgrade

The error in question included this line:

The following signatures were invalid: EXPKEYSIG 23E7166788B63E1E Yarn Packaging <yarn@dan.cx>

According to this issue in the yarn repo, I should’ve just been able to curl the latest GPG key, run apt-key, and all would be well with the world. Except that didn’t work. No, I don’t know why and I don’t much care. I just wanted to get this thing done.

I found an It’s FOSS article about dealing with GPG keys. It’s not the error I was working on, but it was the information I needed to put the correct key in place:

First I backed up the existing key, which was /usr/share/keyrings/yarnkey.gpg.

Then I downloaded and added the latest GPG key:

curl -sS curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg

And finally, I updated /etc/apt/sources.list.d/yarn.list to use that key for decryption:

deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main

That solved the expired key problem. At some point I’ll need to change that back to remove the signed-by bit since I doubt that manually updated key will get any automatic updates.

The postgresql source for apt no longer had a release file for kinetic

The sources for a Postgres update were just as out of date as the ones for Ubuntu. This resulted in this error:

Ign http://apt.postgresql.org/pub/repos/apt kinetic-pgdg InRelease
Err http://apt.postgresql.org/pub/repos/apt kinetic-pgdg Release
  404  Not Found [IP: 2a04:4e42:2f::820 80]

The answer for this one was pretty easy, once I finally bothered to read the Postgres wiki page for apt. I needed to change /etc/apt/sources.list.d/postgresql.list to point to apt-archive.postgresql.org instead of apt.postgresql.org. The final file contents look like this:

deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt-archive.postgresql.org/pub/repos/apt kinetic-pgdg main

Fixing that resolved all of the errors and the kinetic to lunar upgrade tool worked without any problems at all.


📣 Like what you see? Hire me! 📣

I can bring my decades of experience and knowledge of business strategy, software development, servant leadership, and open source to your organisation.

Check out my resume then contact me today!