Sep 27, 2023 7 min read

How to Upgrade from Ubuntu 18.04 to Ubuntu 20.04 Using Command Line

Upgrade from Ubuntu 18.04 to Ubuntu 20.04 with our step-by-step tutorial. Ubuntu 20.04 is a popular Linux-based operating system.

Upgrade from Ubuntu 18.04 to Ubuntu 20.04 Using Command Line
Table of Contents


Before we begin talking about how to upgrade from Ubuntu 18.04 to Ubuntu 20.04 using command line, let's briefly understand – What is Ubuntu 20.04?

Ubuntu 20.04 is a popular Linux-based operating system known for its user-friendly interface and stability. Released in April 2020, it offers a secure and efficient computing environment suitable for both individuals and businesses. With its long-term support (LTS) status, Ubuntu 20.04 ensures regular updates and bug fixes for a span of 5 years.

Packed with the latest software and features, Ubuntu 20.04 provides a seamless experience, whether you're a beginner or an advanced user. Its versatility, reliability, and extensive software ecosystem make it a preferred choice for those seeking a robust and accessible operating system.

In this tutorial, you will upgrade an existing version of Ubuntu 18.04 LTS or 19.10 to Ubuntu 20.04 LTS using the apt command/apt-get command.

Advantages of Ubuntu 20.04

  1. User-friendly interface: Ubuntu 20.04 offers a sleek and intuitive interface, making it easy for users to navigate and access various applications.
  2. Stability and reliability: With its long-term support (LTS) status, Ubuntu 20.04 ensures regular updates and bug fixes, providing a stable and secure computing environment.
  3. Extensive software ecosystem: Ubuntu 20.04 comes with a vast range of software options, allowing users to find and install applications tailored to their needs.
  4. Security: Ubuntu 20.04 prioritizes security, with built-in firewall and encryption features to protect against vulnerabilities and keep your data safe.
  5. Versatility: Whether for personal use or business environments, Ubuntu 20.04 offers versatility, supporting a wide range of hardware and software configurations.

Step 1 - Take Backup

1) It cannot be overstated how critical it is to make a backup of your server before proceeding. Make a mental note of the Ubuntu Linux version.

lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.4 LTS
Release:	18.04
Codename:	bionic

2) Run the following command to find and note the Linux kernel version:

uname -mrs

3) You will get the output like below:


Linux 4.15.0-96-generic x86_64

4) The latest Linux kernel version for Ubuntu 18.04 LTS may be available on AWS:

Linux 5.3.0-1019-aws x86_64

Step 2 - Upgrade all Installed Packages

1) Now that you took a backup, run the following apt command to upgrade the Ubuntu 18.04 LTS packages you've installed:

sudo apt update
sudo apt list --upgradable
sudo apt upgrade

2) When the Ubuntu Linux kernel and libraries are updated, you must reboot:

sudo reboot

Step 3 - Remove the Unused Old Kernels of Ubuntu 18.04

1) Run the following command to remove the old kernels:

sudo apt --purge autoremove

2) You will get an output like below:


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) ...

Ensure that the update-manager-core package is installed.

3) You'll need to install Update Manager on the server because it might not be installed on your machine:

sudo apt install update-manager-core

Step 4 - Upgrade Ubuntu Linux to the Latest LTS

1) Run the following command:

sudo do-release-upgrade

Please take note if you receive the following message:


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.

2) If that's the case, use the -d option to force the latest supported release:

sudo do-release-upgrade -d

3) You will get an output like below:


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]

To use the official Ubuntu repo, simply say yes.

4) Reboot the box

We're almost there:

System upgrade is complete.

Restart required 

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

Continue [yN] y
Connection to closed by remote host.
Connection to closed.

5) To put it another way, when asked to reboot the box, type y to confirm.

Step 5 - Verification

1) Check the version of Distro you're using:

lsb_release -a

2) You will get an output like below:


No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04 LTS
Release:	20.04
Codename:	focal

3) Check the Linux kernel version as well as additional log files:

tail -f /var/log/my-app.log
uname -mrs

4) You will get an output like below:

Linux 5.4.0-24-generic x86_64

The following Linux kernel will be shown on an AWS EC2 or Lightsail server:


Linux 5.4.0-1011-aws x86_64

Step 6 - Enable the 3rd-party Repository

1) For the sake of stability, 3rd party software repos will be deactivated during the update process. Google Chrome and other browsers, for example, have been disabled.

As a result, we must activate those using the Software and Updates CLI or GUI tool. To use the cd command, type:

cd /etc/apt/sources.list.d/

2) List those repos:

ls -l

3) Let's take a look at google-chrome.list with the cat command:

cat google-chrome.list

4) You will get an output like below:

# You may comment out this entry, but any other modifications may be lost.
# deb [arch=amd64] stable main # disabled on upgrade to focal

5) Edit the file:

sudo nano google-chrome.list
## OR ##
sudo vim google-chrome.list

Remove the '#' from the file and replace it with the following:

# You may comment out this entry, but any other modifications may be lost.
deb [arch=amd64] stable main # disabled on upgrade to focal

In the vim text editor, save and close the file. Finally, make sure your apt repos are up-to-date:

sudo apt update
sudo apt upgrade

Step 7 - Upgrade Using GUI Method

Let's look at how to upgrade a desktop computer.

  • To begin, make sure you have backups of all vital data.
  • In System Settings, go to the "Software & Updates" section.
  • Select the "Updates" tab on the third tab.
  • If you're using 18.04 LTS, set the "Notify me of a new Ubuntu version" drop-down choice to "For long-term support versions", if you're using 19.10, adjust it to "For any new version."
  • Type the following command:
update-manager -c -d
  • Following that, Update Manager should appear and inform you that Ubuntu 20.04 LTS is now available. If update-manager -c -d doesn't work, try the following:
  • Follow the on-screen instructions after clicking Upgrade.

FAQs to Upgrade from Ubuntu 18.04 to Ubuntu 20.04

Can I directly upgrade from Ubuntu 18.04 to 20.04?

Yes, you can upgrade directly from Ubuntu 18.04 to 20.04 using the command line or by using the graphical update manager.

Will I lose my files and settings during the upgrade?

Generally, your files and settings will be preserved during the upgrade process. However, it's always recommended to back up your important data before proceeding with the upgrade, as a precautionary measure.

How long does the upgrade process take?

The duration of the upgrade process varies depending on your system's configuration and internet speed. It may take anywhere from 30 minutes to a few hours.

What happens if the upgrade process is interrupted?

If the upgrade process is interrupted, it could result in an incomplete or unstable system. It's crucial to ensure a stable internet connection and not interrupt the upgrade process once it has started.

Can I cancel the upgrade once it has started?

It is not recommended to cancel the upgrade once it has started. Doing so may leave your system in an unstable state. It's best to let the upgrade process complete.

Will all my installed applications work after the upgrade?

Most of your installed applications should continue to work after the upgrade. However, some applications or packages may need to be updated or reinstalled to ensure compatibility with Ubuntu 20.04.

What if I have made changes to system files or configurations?

During the upgrade process, you may be prompted to choose between keeping your version or installing the package maintainer's version of certain configuration files. It's recommended to select the package maintainer's version unless you have made specific changes.

Can I downgrade back to Ubuntu 18.04 after the upgrade?

Downgrading to a previous version is not a supported process. It is recommended to create a backup before upgrading in case you need to revert to the previous version.


We hope this detailed tutorial helped you to upgrade from Ubuntu 18.04 to Ubuntu 20.04.

If you have any queries, please leave a comment below, and we’ll be happy to respond to them for sure.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to DevOps Tutorials - VegaStack.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.