How to Upgrade Ubuntu Linux

This post shows students and new users steps to upgrade Ubuntu Desktop or Server from a previous version. If you have a decent Internet connection, the process to upgrade to the next version of Ubuntu is pretty straightforward.

Ubuntu Linux comes in two support flavors: Long Term Support (LTS) and Short Term Support (STS). Ubuntu LTS versions are typically supported for five ( 5 ) years, while the STS versions are supported for roughly 9 months.

Ubuntu LTS versions will typically see upgrade notifications when new LTS releases are available. STS versions will also only see upgrade notifications for newer STS releases. Upgrading from one version to the next is pretty straightforward. However, if you’re on a LTS release version and want to upgrade to a STS version, there will have to be some work done before you can successfully upgrade.

If your version of Ubuntu is two releases back, you’ll have to upgrade to the next release version in line before you can upgrade to the latest or most current release version.

Above are some of the details you may want to know before attempting to upgrade Ubuntu Linux.

To get started with upgrading Ubuntu Linux, follow the steps below.

How to update Ubuntu packages

Before starting the release upgrade, it is recommended to update all currently installed packages or software to their latest versions.

If you have packages installed on Ubuntu and are marked as held back, those cannot be automatically installed, upgraded, or removed. This may cause issues during the upgrade process.

To check whether there are packages being held back on your systems, run the commands below.

sudo apt-mark showhold

If there are packages with hold on them, run the commands below to release the hold.

sudo apt-mark unhold package_name

Replace package_name with the name of the package that is being held from updates or upgrades.

After that, run the commands below to update and upgrade all installed packages.

sudo apt update
sudo apt upgrade

In some cases, you may have to reboot before continuing with the release upgrade.

Next, run the commands below to perform a major upgrade or installed packages.

sudo apt full-upgrade

Next, run the commands below to automatically remove installed package dependencies that are no longer needed on Ubuntu.

sudo apt --purge autoremove

Once the steps above are done, continue below with the upgrade.

How to perform a release upgrade on Ubuntu Linux

Now that the current Ubuntu version is updated, continue below with the release upgrade. As mentioned above, the upgrade process is pretty straightforward.

You can upgrade either from the command line with do-release-upgrade or using the desktop GUI update tool called Software Updater. The command line option works for both Ubuntu desktop and server editions.

First, make sure that the upgrade package is installed. Run the commands below if it’s not already installed.

sudo apt install update-manager-core

After installing the package above, run the commands below to start the upgrade process.

sudo do-release-upgrade -d

The command above will disable all third-party repositories and change the apt list to point to the Ubuntu upgrade version repositories. You will also be prompted several times to confirm that you want to continue with the upgrade.

Follow the on-screen instructions. y = yes and N= No. When prompted whether you wish to upgrade type y.

Do you want to start the upgrade? 

5 packages are going to be removed. 85 new packages are going to be 
installed. 1168 packages are going to be upgraded. 

You have to download a total of 803 M. This download will take about 
11 minutes with your connection. 

Installing the upgrade can take several hours. Once the download has 
finished, the process cannot be canceled. 

 Continue [yN]  Details [d]

Wait for all the newer packages to be downloaded. This may take a while depending on your Internet connection speed. After all packages are downloaded, your system will begin upgrading immediately.

Once the new packages are installed, the update tool will ask you if you want to remove the obsolete software. If you have a system that you have customized, you may wish to enter d to view the list, just in case you may need to reinstall.

Remove obsolete packages?

53 packages are going to be removed.

 Continue [yN]  Details [d]y

When asked whether you want the services to be automatically restarted during the upgrade type y for Yes.

When the upgrade process is complete assuming all went well, you’ll be prompted to restart. Type y to restart your computer to finish setting up your system.

Restart required

To finish the upgrade, a restart is required.
If you select 'y' the system will be restarted.

Continue [yN] y

Once your system is restarted, your Ubuntu system has fully upgraded to the next release version. You can run the commands below to check the current version.

lsb_release -a

That should output similar lines as shown below:

No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 21.04
Release:	21.04
Codename:	hirsute

Conclusion:

This post showed you how to upgrade Ubuntu Linux. As you can see above, the steps are relatively painless and straightforward. If you find any error above or have something to add, please use the comment form below.