How to Upgrade Ubuntu 18.04 LTS to 20.04 LTS

Updated on September 16, 2021
How to Upgrade Ubuntu 18.04 LTS to 20.04 LTS header image

Introduction

This article explains how to upgrade an Ubuntu 18.04 server to version 20.04 LTS. To avoid disconnecting your SSH session during the upgrade, perform this process as the root user from the Vultr Web Console.

Prerequisites

Before proceeding, please make a backup of your server. Then, test the backup by deploying a new instance from the backup, then verify that the test instance boots and has the correct data. If you do not make a backup before proceeding, you risk losing your data.

1. Prepare for the Upgrade

  1. Follow our guide to update all server packages before proceeding.

  2. (Recommended) Remove unused packages and kernels to free up space on the /boot partition.

     # apt --purge autoremove
  3. Edit the update manager configuration file.

     # nano /etc/update-manager/release-upgrades
  4. Look for the line beginning with Prompt=. Make sure it is uncommented, and the value is lts, as shown:

     Prompt=lts

2. Run the Upgrade Tool

  1. Verify your backup before proceeding. If you stop the upgrade tool before it completes, the system may be in an unusable state.

  2. Run the upgrade tool.

     # do-release-upgrade
  3. The upgrade tool will report the number of packages to upgrade and the estimated time to complete, then request your confirmation. Type Y to proceed.

  4. You may encounter questions such as:

    • Restart services during package upgrades without asking?
      • Answer yes to restart services automatically, or no to be prompted to restart each service during the upgrade.
    • Configure LXD
      • If you aren't sure which version you need, select the 4.0 version.
    • Configuration file '/etc/sysctl.conf'
      • If haven't made changes to sysctl.conf, type I to install the package maintainer's version. Otherwise, choose D to review the differences, and then decide to keep your version or install the new one.
    • Configure openssh-server
      • You should select keep the local version currently installed.
    • Remove obsolete packages
      • The best practice is to remove obsolete packages to free up system resources. Enter Y to proceed.
  5. When complete, you'll be prompted to restart. Enter Y to reboot and finish the upgrade.

After the reboot, log in as root and verify the proper operation of your server.

Recovery Steps

If your upgrade does not complete successfully, please restore your backup and retry. Unfortunately, in most cases, it's not possible to recover a failed upgrade to 20.04 LTS. The best practice is to restore the previous server image from the backup.