Upgrade Ubuntu 18.04 to 20.04 LTS using command line

LTS is an abbreviation for “Long Term Support.” A new LTS version is released every two years and gets five years on five years of support and patches. The upcoming version of Ubuntu is 20.04 LTS, and codenamed as Focal Fossa. Please note that Ubuntu 20.04 release date is April 23, 2020. It is currently available for testing purposes only. This page shows you how to upgrade the existing version of Ubuntu Linux 18.04 LTS to Ubuntu 20.04 LTS from the [nixmd name=”apt”]/apt-get command.

Adblock detected 😱
My website is made possible by displaying online advertisements to my visitors. I get it! Ads are annoying but they help keep this website running. It is hard to keep the site running and producing new content when so many people block ads. Please consider donating money to the nixCraft via PayPal/Bitcoin, or become a supporter using Patreon.

Procedure to upgrade Ubuntu 18.04 to 20.04

  1. Create a backup of your server or vm.
  2. Upgrade all installed packages of Ubuntu version 18.04 by running sudo apt update && sudo apt upgrade command.
  3. Reboot the Ubuntu Linux system by tying the sudo reboot command
  4. Install the Ubuntu update tool, run: sudo apt install update-manager-core
  5. Start the upgrade procdure, run: sudo do-release-upgrade
  6. Reboot the box, run: sudo reboot
  7. Verify upgrades

Let us see all commands and examples.

Make a backup

I cannot be stressed enough how important it is to make a backup of your server before you do this. Note down the Ubuntu Linux version
lsb_release -a

No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.3 LTS
Release:	18.04
Codename:	bionic

Find and note down the Linux kernel version too, run:
uname -mrs
Sample outputs:

Linux 5.0.0-37-generic x86_64

Upgrade all installed packages on Ubuntu 18.04 LTS

Now, that you have backup, type the following apt command to upgrade the installed packages of Ubuntu version 18.04 LTS:
sudo apt update
sudo apt list --upgradable
sudo apt upgrade

Upgrade installed packages of Ubuntu version 18.04 LTS
You must reboot when Ubuntu Linux kernel and libs gets updated:
sudo reboot
See “Ubuntu 18.04 update installed packages for security” for more info.

Ubuntu 18.04 remove all unused old kernels

Run the following to remove them:
sudo apt --purge autoremove
Sample outputs:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  linux-headers-4.15.0-45* linux-headers-4.15.0-45-generic*
  linux-image-4.15.0-45-generic* linux-modules-4.15.0-45-generic*
0 upgraded, 0 newly installed, 5 to remove and 0 not upgraded.
After this operation, 334 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 138353 files and directories currently installed.)
Removing linux-headers-4.15.0-45-generic (4.15.0-45.48) ...
Removing linux-headers-4.15.0-45 (4.15.0-45.48) ...
Removing linux-modules-extra-4.15.0-45-generic (4.15.0-45.48) ...
Removing linux-image-4.15.0-45-generic (4.15.0-45.48) ...

Make sure you install update-manager-core package

We need to install the Update Manager on server as it may or man not installed on your box:
sudo apt install update-manager-core

Upgrade Ubuntu Linux to latest LTS

Execute the following command:
sudo do-release-upgrade
However, you will greeted with the following message as 20.04 LTS final yet to release:

Checking for a new Ubuntu release
There is no development version of an LTS available.
To upgrade to the latest non-LTS develoment release 
set Prompt=normal in /etc/update-manager/release-upgrades.

Pass the -d option to get the latest supported release, upgrade to the development release:
sudo do-release-upgrade -d
Sample outputs:

Reading cache
Checking package manager
Continue running under SSH? 
This session appears to be running under ssh. It is not recommended 
to perform a upgrade over ssh currently because in case of failure it 
is harder to recover. 
If you continue, an additional ssh daemon will be started at port 
Do you want to continue? 
Continue [yN] y
Starting additional sshd 
To make recovery in case of failure easier, an additional sshd will 
be started on port '1022'. If anything goes wrong with the running 
ssh you can still connect to the additional one. 
If you run a firewall, you may need to temporarily open this port. As 
this is potentially dangerous it's not done automatically. You can 
open the port with e.g.: 
'iptables -I INPUT -p tcp --dport 1022 -j ACCEPT' 
To continue please press [ENTER]

No valid mirror found warning:

Updating repository information
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 'bionic' to 'focal' entries. 
If you select 'No' the upgrade will cancel. 
Continue [yN]

Just say yes to use the official Ubuntu repo.

Reboot the box

When prompted reboot the box:
Upgrade Ubuntu 18.04 to 20.04 completed and restart the system


Check your Disro version:
lsb_release -a
Sample outputs:

No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu Focal Fossa (development branch)
Release:	20.04
Codename:	focal


You did it. Upgrade to Ubuntu 20.04 LTS was successful. Now you can test your apps and code that is compatible with the upcoming version. See LTS page for all details.