Upgrading Ubuntu Past EOL

Written on .

It's possible to upgrade Ubuntu to a version that's past its end-of-life (EOL) date. This is useful if you really don't want to do a fresh install.

This article is not a definitive guide, but rather a collection of notes from my own experience. Hopefully this will help others and perhaps even myself in the future.

Check your release version

First of all,check your current version:

lsb_release -a

and you'll see something like:

Release:        22.10
Codename:       kinetic

Wikipedia has a list of Ubuntu versions. For instance, Kinetic went into EOL ages ago. The next version, 23.04 Lunar, is also EOL. When upgrading, you can't skip a version, so you have to upgrade one by one. If you're upgrading to a non-EOL version, follow the official EOLUpgrades guide. If you're on an LTS version, you can upgrade to the next LTS version directly. The remainder of this article will assume the version you're upgrading to is also EOL.

Update your system

Before you start, make sure your system is up-to-date and all available updates are installed. However, you're on an EOL version, so the normal repositories are gone. Ubuntu maintains old repos at old-releases.ubuntu.com. Update your sources.list to old-releases by replacing lines like this:

deb http://archive.ubuntu.com/ubuntu kinetic main restricted

with this:

deb http://old-releases.ubuntu.com/ubuntu kinetic main restricted

Now update like normal.

Get the updater script

Normally, we'd upgrade using do-release-upgrade, but that won't work when updating to an EOL version. Instead, we'll need to fetch the updater script. Open up changelogs.ubuntu.com/meta-release and find the version you're upgrading to. For instance, if you're upgrading from Kinetic to Lunar, you'll find the following:

Dist: lunar
Name: Lunar Lobster
Version: 23.04
Date: Thu, 20 April 2023 23:04:00 UTC
Supported: 0
Description: This is the 23.04 release
Release-File: http://archive.ubuntu.com/ubuntu/dists/lunar-updates/Release
ReleaseNotes: http://changelogs.ubuntu.com/EOLReleaseAnnouncement
UpgradeTool: http://archive.ubuntu.com/ubuntu/dists/lunar-updates/main/dist-upgrader-all/current/lunar.tar.gz
UpgradeToolSignature: http://archive.ubuntu.com/ubuntu/dists/lunar-updates/main/dist-upgrader-all/current/lunar.tar.gz.gpg

Download the UpgradeTool link, replacing archive with old-releases, for instance:

wget http://old-releases.ubuntu.com/ubuntu/dists/lunar-updates/main/dist-upgrader-all/current/lunar.tar.gz

Extract the tool:

mkdir lunar
cd lunar
tar -xzf ../lunar.tar.gz

Run the updater:

./dist-upgrade

You will probably see a message similar to this:

Updating repository information

No valid mirror found 

While scanning your repository information, no mirror entry for the 
upgrade was found. This can happen if you run an internal mirror or 
if the mirror information is out-of-date. 

Do you want to rewrite your 'sources.list' file anyway? If you choose 
'Yes' here, it will update all 'kinetic' to 'lunar' entries. 
If you select 'No', the upgrade will cancel. 

Continue [yN]

That's telling you the normal repos are gone and it's going to try a simple string replacement instead. That's fine, as we've already set it to old-releases. Confirm with a yes.

The updater will now upgrade your system and that should be it. Repeat for more versions, if you need to.

Once you've upgraded past EOL versions, you can use the normal do-release-upgrade. See the official EOLUpgrades guide for more. The updater should automatically set your repos back to archive, so you don't need to do that yourself.

Stay on LTS

If you've found this page useful, you're probably prone to procrastinating on upgrading you OS. Perhaps we should both stick to LTS versions.

Edit /etc/update-manager/release-upgrades and set Prompt=lts.