Upgrading EOL Ubunut version to the recent version

Posted on Do 07 Dezember 2023 in misc

Upgrading an outdated, end of life (EOL) Ubuntu version (in this case it was 22.10) to a recent one needs a special treatment. Running just apt dist-upgrade doesn't work, beforehand the apt source files need to be changed, because new packages cannot be retrieved from the old source urls.

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo sed -i -re 's/([a-z]{2}\.)?archive.ubuntu.com|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
sudo apt update
sudo apt upgrade
sudo apt dist-upgrade
sudo do-release-upgrade