Tutorial

How To Upgrade to Ubuntu 20.04 Focal Fossa

Published on May 12, 2020
English
How To Upgrade to Ubuntu 20.04 Focal Fossa
Not using Ubuntu 20.04?Choose a different version or distribution.
Ubuntu 20.04

Introduction

The Ubuntu operating system’s latest Long Term Support (LTS) release, Ubuntu 20.04 (Focal Fossa), was released on April 23, 2020. This guide will explain how to upgrade an Ubuntu system of version 18.04 or later to Ubuntu 20.04.

Warning: As with almost any upgrade between major releases of an operating system, this process carries an inherent risk of failure, data loss, or broken software configuration. Comprehensive backups and extensive testing are strongly advised.

To avoid these problems, we recommend migrating to a fresh Ubuntu 20.04 server rather than upgrading in-place. You may still need to review differences in software configuration when upgrading, but the core system will likely have greater stability. You can follow our series on how to migrate to a new Linux server to learn how to migrate between servers.

Prerequisites

This guide assumes that you have an Ubuntu 18.04 or later system configured with a sudo-enabled non-root user.

Potential Pitfalls

Although many systems can be upgraded in place without incident, it is often safer and more predictable to migrate to a major new release by installing the distribution from scratch, configuring services with careful testing along the way, and migrating application or user data as a separate step.

You should never upgrade a production system without first testing all of your deployed software and services against the upgrade in a staging environment. Keep in mind that libraries, languages, and system services may have changed substantially. Before upgrading, consider reading the Focal Fossa Release Notes.

Step 1 – Backing Up Your System

Before attempting a major upgrade on any system, you should make sure you won’t lose data if the upgrade goes awry. The best way to accomplish this is to make a backup of your entire filesystem. Failing that, ensure that you have copies of user home directories, any custom configuration files, and data stored by services such as relational databases.

On a DigitalOcean Droplet, one approach is to power down the system and take a snapshot (powering down ensures that the filesystem will be more consistent). See How to Create Snapshots of Droplets for more details on the snapshot process. After you have verified that the Ubuntu update was successful, you can delete the snapshot so that you will no longer be charged for its storage.

For backup methods which will work on most Ubuntu systems, see How To Choose an Effective Backup Strategy for your VPS.

Step 2 – Updating Currently Installed Packages

Before beginning the release upgrade, it’s safest to update to the latest versions of all packages for the current release. Begin by updating the package list:

  1. sudo apt update

Next, upgrade installed packages to their latest available versions:

  1. sudo apt upgrade

You will be shown a list of upgrades, and prompted to continue. Answer y for yes and press Enter.

This process may take some time. Once it finishes, use the dist-upgrade command with apt-get, which will perform any additional upgrades that involve changing dependencies, adding or removing new packages as necessary. This will handle a set of upgrades which may have been held back by the previous apt upgrade step:

  1. sudo apt dist-upgrade

Again, answer y when prompted to continue, and wait for upgrades to finish.

Now that you have an up-to-date installation of Ubuntu, you can use do-release-upgrade to upgrade to the 20.04 release.

Step 3 – Upgrading with Ubuntu’s do-release-upgrade Tool

Traditionally, Ubuntu releases have been upgradeable by changing Apt’s /etc/apt/sources.list – which specifies package repositories – and using apt-get dist-upgrade to perform the upgrade itself. Though this process is still likely to work, Ubuntu provides a tool called do-release-upgrade to make the upgrade safer and easier.

do-release-upgrade handles checking for a new release, updating sources.list, and a range of other tasks, and is the officially recommended upgrade path for server upgrades which must be performed over a remote connection.

Start by running do-release-upgrade with no options:

  1. sudo do-release-upgrade

If the new Ubuntu version has not been officially released yet, you may get the following output:

Output
Checking for a new Ubuntu release No new release found

Note that on Ubuntu Server, the new LTS release isn’t made available to do-release-upgrade until its first point release, in this case 20.04.1. This usually comes a few months after the initial release date.

If you don’t see an available release, add the -d option to upgrade to the development release:

  1. sudo do-release-upgrade -d

If you’re connected to your system over SSH, you’ll be asked whether you wish to continue. For virtual machines or managed servers you should keep in mind that losing SSH connectivity is a risk, particularly if you don’t have another means of remotely connecting to the system’s console (such as a web-based console feature, for example).

For other systems under your control, remember that it’s safest to perform major operating system upgrades only when you have direct physical access to the machine.

At the prompt, type y and press Enter to continue:

Output
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 '1022'. Do you want to continue? Continue [yN]

Next, you’ll be informed that do-release-upgrade is starting a new instance of sshd on port 1022:

Output
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]

Press Enter. Next, you may be warned that a mirror entry was not found. On DigitalOcean systems, it is safe to ignore this warning and proceed with the upgrade, since a local mirror for 20.04 is in fact available. Enter y:

Output
Updating repository information No valid mirror found 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]

Once the new package lists have been downloaded and changes calculated, you’ll be asked if you want to start the upgrade. Again, enter y to continue:

Output
Do you want to start the upgrade? 18 installed packages are no longer supported by Canonical. You can still get support from the community. 3 packages are going to be removed. 142 new packages are going to be installed. 452 packages are going to be upgraded. You have to download a total of 338 M. This download will take about 42 minutes with a 1Mbit DSL connection and about 13 hours with a 56k modem. Fetching and installing the upgrade can take several hours. Once the download has finished, the process cannot be canceled. Continue [yN] Details [d]

New packages will now be retrieved, unpacked, and installed. Even if your system is on a fast connection, this will take a while.

During the installation, you may be presented with interactive dialogs for various questions. For example, you may be asked if you want to automatically restart services when required:

Service Restart Dialog

In this case, it is safe to answer Yes. In other cases, you may be asked if you wish to replace a configuration file that you have modified. This is often a judgment call, and is likely to require knowledge about specific software that is outside the scope of this tutorial.

Once new packages have finished installing, you’ll be asked whether you’re ready to remove obsolete packages. On a stock system with no custom configuration, it should be safe to enter y here. On a system you have modified heavily, you may wish to enter d and inspect the list of packages to be removed, in case it includes anything you’ll need to reinstall later.

Output
Remove obsolete packages? 53 packages are going to be removed. Continue [yN] Details [d]

Finally, assuming all has gone well, you’ll be informed that the upgrade is complete and a restart is required. Enter y to continue:

Output
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]

On an SSH session, you’ll likely see something like the following:

Output
Connection to 203.0.113.241 closed by remote host. Connection to 203.0.113.241 closed.

You may need to press a key here to exit to your local prompt, since your SSH session will have terminated on the server end.

Wait a moment for your server to reboot, then reconnect. On login, you should be greeted by a message confirming that you’re now on Focal Fossa :

Output
Welcome to Ubuntu 20.04 LTS (GNU/Linux 5.4.0-29-generic x86_64)

Conclusion

You should now have a working Ubuntu 20.04 installation. From here, you likely need to investigate necessary configuration changes to services and deployed applications.

You can find more 20.04 tutorials and questions on our Ubuntu 20.04 Tutorials tag page.

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about us


About the authors

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
9 Comments


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

I’m trying to upgrade from 18.04.1 and keep hitting this:

do-release-upgrade

Checking for a new Ubuntu release Get:1 Upgrade tool signature [1,554 B]
Get:2 Upgrade tool [1,342 kB]
Fetched 1,344 kB in 0s (0 B/s)
authenticate ‘focal.tar.gz’ against ‘focal.tar.gz.gpg’ Authentication failed Authenticating the upgrade failed. There may be a problem with the network or with the server.

There are a few hits on the internet to try re-installing ubuntu-keyring, apt-key update, modifying the sources.list… none of which helped.

Commented on this yesterday but looks like it was removed. I’ve tried this and everything goes ok until you reboot and then you lose complete access to the droplet.

I’ve tried this a couple of times. When I do, I can no longer access the machine via SSH or the DigitalOcean Console. HTTP requests don’t work either … so I end up rolling back to the snapshot I took before trying.

Checking for a new Ubuntu release Please install all available updates for your release before upgrading.

sudo RELEASE_UPGRADER_ALLOW_THIRD_PARTY=1 do-release-upgrade instead of sudo do-release-upgrade

Do I have to restart Ubuntu do-release-upgrade after upgrading? Will there be any impact if you don’t restart?

After executing step 2, executing sudo do-release-upgrade shows the following message. (Tried a few times.) Please install all available updates for your release before upgrading.

By me: upgrade process goes completely and in the end the system restart is required. I say “y”, the droplet restarts and everything [still] works; I can still log-in via SSH (and see “Welcome to Ubuntu 18.”).

But as soon as I restart next time (sudo shutdown -r now), nothing (neither SSH, nor Apache, nor FTP) works. I can only access the droplet via Access Console from DO webinterface.

As I restart via AccessConsole, the droplet tries to reboot but: Failed to start Wait for Network to be Configured. This explains why neither SSH, no Apache, nor FTP works. Moreover, the Droplet has no connection even with mirrors.digitalocean.com anymore!

Fortunately, I always make snapshots before doing anything like this, thus was able to roll back to Ubuntu 18.

Screenshots:

  1. https://letyourmoneygrow.com/yetanotherquant/misc/failedUpgradeToUbuntu20/1_networkConfigFailed.png
  2. https://letyourmoneygrow.com/yetanotherquant/misc/failedUpgradeToUbuntu20/2_noConnectionsEvenWithMirrorsDigitalOceanCom.png

I am trying to upgrade from a fully updated 18.04 LTS droplet, and I get the following error during the ‘do-release-upgrade -d’ process: (-d because I want to upgrade prior to the .1 point release.)

After updating your package information, the essential package ‘ubuntu-minimal’ could not be located.

After this, the upgrade exits out.

Looks like it’s related to the digitalocean repo’s somehow?

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel