Categories
Security

Upgrading Ubuntu 23.04 to 24.04.1 LTS

I recently had to upgrade my Linux tiny VM from Ubuntu 23.04 to 24.04.1 LTS. However, as I waited too long, a simple do-release-upgrade no longer worked in January 2025.

An upgrade from 'lunar' to 'noble' is not supported with this tool.

I ran into issues with apt-get update, so I knew it was time to upgrade my VM.

sudo apt update

Ign:1 http://security.ubuntu.com/ubuntu lunar-security InRelease
Err:2 http://security.ubuntu.com/ubuntu lunar-security Release
  404  Not Found [IP: 2620:2d:4000:1::101 80]
Get:3 http://az3.clouds.archive.ubuntu.com/ubuntu lunar InRelease [267 kB]
Get:4 http://az3.clouds.archive.ubuntu.com/ubuntu lunar-updates InRelease [109 kB]
Get:5 http://az3.clouds.archive.ubuntu.com/ubuntu lunar-backports InRelease [99.9 kB]
Get:6 https://pkgs.tailscale.com/stable/ubuntu lunar InRelease
Reading package lists... Done
E: The repository 'http://security.ubuntu.com/ubuntu lunar-security Release' no longer has a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

The simple ‘do-release-upgrade’ no longer worked because the latest version is no longer a single upgrade but multiple upgrades.

do-release-upgrade

Checking for a new Ubuntu release
Your Ubuntu release is not supported anymore.
For upgrade information, please visit:
http://www.ubuntu.com/releaseendoflife


= Welcome to Ubuntu 24.04 LTS 'Noble Numbat' =

The Ubuntu team is proud to announce Ubuntu 24.04 LTS 'Noble Numbat'.

To see what's new in this release, visit:
  https://wiki.ubuntu.com/NobleNumbat/ReleaseNotes

Ubuntu is a Linux distribution for your desktop or server, with a fast
and easy install, regular releases, a tight selection of excellent
applications installed by default, and almost any other software you
can imagine available through the network.

We hope you enjoy Ubuntu.

== Feedback and Helping ==

If you would like to help shape Ubuntu, take a look at the list of
ways you can participate at

  http://www.ubuntu.com/community/participate/

Your comments, bug reports, patches and suggestions will help ensure
that our next release is the best release of Ubuntu ever.  If you feel
that you have found a bug please read:

  http://help.ubuntu.com/community/ReportingBugs

Then report bugs using apport in Ubuntu.  For example:

  ubuntu-bug linux

will open a bug report in Launchpad regarding the linux package.

If you have a question, or if you think you may have found a bug but
aren't sure, first try asking on the #ubuntu or #ubuntu-bugs IRC
channels on Libera.Chat, on the Ubuntu Users mailing list, or on the
Ubuntu forums:

  http://help.ubuntu.com/community/InternetRelayChat
  http://lists.ubuntu.com/mailman/listinfo/ubuntu-users
  http://www.ubuntuforums.org/


== More Information ==

You can find out more about Ubuntu on our website, IRC channel and wiki.
If you're new to Ubuntu, please visit:

  http://www.ubuntu.com/


To sign up for future Ubuntu announcements, please subscribe to Ubuntu's
very low volume announcement list at:

  http://lists.ubuntu.com/mailman/listinfo/ubuntu-announce


Continue [yN] y
Get:1 Upgrade tool signature [833 B]
Get:2 Upgrade tool [1277 kB]
Fetched 1278 kB in 0s (0 B/s)
authenticate 'noble.tar.gz' against 'noble.tar.gz.gpg'
extracting 'noble.tar.gz'
[screen is terminating]

Solution

This snippet is the solution as of January 2025 to upgrade your Ubuntu 23.04 to 24.04.1 LTS.

# source https://gist.github.com/catchsudheera/68bcb4747e7e4127cd1162112791c99e

sudo sed -i 's|http://ports.ubuntu.com/ubuntu-ports|http://old-releases.ubuntu.com/ubuntu|g' /etc/apt/sources.list
sudo apt update && sudo apt upgrade -y
sudo sed -i 's|lunar|mantic|g' /etc/apt/sources.list
sudo apt update && sudo apt upgrade -y

# Had to fix the installs for libc6
sudo apt --fix-broken install

sudo apt dist-upgrade

# use `cat /etc/os-release` to ensure you have upgraded to mantic at this point
# reboot the system

sudo do-release-upgrade
Upgrading Ubuntu to the latest version is important
  1. Security patches – older versions stop receiving critical security updates, leaving your system vulnerable to known exploits
  2. Bug fixes – newer versions fix system stability issues and software compatibility problems
  3. Modern software support – recent applications often require newer system libraries and dependencies
  4. Performance improvements – kernel updates and system optimizations can improve speed and resource usage
  5. End of support – EOL (End of Life) versions like Ubuntu 23.04 no longer receive updates or community support