Search Our Database

Upgrading Ubuntu from 18.04 to 20.04

Last updated on |

Introduction

This guide will walk you through the process of upgrading your Ubuntu system from version 18.04 LTS to 20.04 LTS. This involves updating installed packages, removing obsolete kernels, and performing the actual distribution upgrade. Ensure you have a backup of your important data before proceeding.

Prerequisites

  • Access to the server with root privileges.
  • Ensure all important data is backed up.
  • Stable internet connection for downloading updates and packages.

Steps to Upgrade

Step 1: SSH into the Server

First, SSH into your server using an account with root privileges.

ssh user@<your_server_ip>

Step 2: Upgrade All Installed Packages on Ubuntu 18.04 LTS

1. Update the package list and upgrade all installed packages.

sudo apt update
sudo apt upgrade -y 

If you encounter issue as below.

Follow the step below.

ps aux | grep -i apt

Kill all apt running process. The pid will be the number showing on the second row.


kill <pid>

 

Remove the lock files.

sudo rm /var/lib/dpkg/lock-frontend
sudo rm /var/lib/dpkg/lock

Reconfigure the package database.

sudo dpkg --configure -a

Then, reenter the upgrade command.

sudo apt upgrade -y

2. Reboot the system.

sudo reboot

Step 3: Remove Unused Old Kernels

1. Clean up old, unused kernels to free up disk space.

sudo apt --purge autoremove

2. Install the update-manager-core.

sudo apt install update-manager-core

Step 4: Upgrade to the Latest LTS Release

Initiate the distribution upgrade.

sudo do-release-upgrade

Step 5: Handling the Upgrade Process

1. You will be presented with details of the upgrade including the number of packages to be removed, installed, and upgraded. Follow the prompts, typically pressing ‘y’ to proceed.

2. During the upgrade, you might encounter some configuration settings:

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]

Press Y and Enter to continue.

Press Y and Enter to continue.

Choose Y and Enter to continue.

Configuration file '/etc/vnstat.conf'
==> Modified (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
*** vnstat.conf (Y/I/N/O/D/Z) [default=N] ?

Press Enter to continue.

Choose Keep the local version currently installed and press Enter to continue.

Remove obsolete packages?

39 packages are going to be removed.

Continue [yN] Details [d]

Press and Enter to continue.

Step 6: Reboot the System

Upon completion of the upgrade, reboot your server.

You may see this after the upgrade is completed, press Y and Enter to reboot.

Else, you may enter this to reboot.

sudo reboot

Step 7: Verification

After the system restarts, verify the new distribution version.

lsb_release -a

Expected output:

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

Conclusion

Your Ubuntu system should now be successfully upgraded from 18.04 LTS to 20.04 LTS. Ensure to check your applications and services to confirm they are running as expected.

For additional assistance or if you encounter any issues, please contact our support team at support@ipserverone.com.