How to upgrade Linux Ubuntu to latest major release

Case #

You need to upgrade your Linux Ubuntu installation to the latest available major release, for example upgrade from 20.x LTS to 22.x LTS. A thorough list of available Linux Ubuntu releases can be found in the Ubuntu Wiki at This article provides guidance on how to upgrade Linux Ubuntu to latest major release.

Solution #

First study the Ubuntu Wiki at for release notes and known issues and bugs before upgrading to a higher major release.

Then follow the procedure below from an Ubuntu bash terminal.

# Clean-up the Linux package repository cache
sudo apt-get update
# Optionally
# sudo apt-get update --allow-insecure-repositories
# Upgrade Ubuntu libc, drivers and other core packages such as docker container
sudo apt-get upgrade
# Upgrade the Linux core packages, Linux kernel and third packages, for example NVidia packages
sudo apt-get dist-upgrade
# Check if a release upgrade exists
sudo do-release-upgrade -c
# Upgrade to the latest Ubuntu major release
sudo do-release-upgrade

The output of the apt-get upgrade command should look like the following.

The output of the sudo apt-get dist-upgrade command should look like the following.

If a release upgrade exists, it should show as in the following example.

The sudo do-release-upgrade should look like this. Press 'Y' to continue with the release upgrade.

How to upgrade Linux Ubuntu to latest major release

Do not hit any keys or Enter during the above process unless prompted to do so by the upgrade script. Otherwise the upgrade procedure may accidentally be aborted.

At this point verify your new Ubuntu release number by running any of the below commands.

Troubleshooting Linux Ubuntu upgrade issues #

You may run across the following error messages when running apt-get update or when adding or removing package repositories in the repositories list.

  • E: The repository 'https://[URL GOES HERE]' does not have a Release file
  • W: Update from such a repository can't be done securely, and is therefore disabled by default.
  • W: See apt-secure(8) manpage for repository creation and user configuration details (319).

You get the same error when running the apt-get update command.

Another example error can be the following:

W: The repository ' impish Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.

In such a case, run the below command and delete all lines which may have been left redundant and which cause the above errors to occur.

sudo vi /etc/apt/sources.list.d

After all leftover repositories have been cleaned up, run the "sudo apt-get update" command again and this time it should be successful.

You should now be ready to proceed with your Ubuntu release upgrade.

Sources #

Powered by BetterDocs