How to upgrade from Ubuntu 16.04 LTS to 20.04 (in virtual machine)
There is no direct release-upgrade path that is supported.
-
The supported method is to release-upgrade from 16.04 to 18.04, then release-upgrade again from 18.04 to 20.04. Stop, test your new 18.04 system, and troubleshoot any problems you encounter before continuing.
- A backup or VM snapshot or VM clone before beginning is wise.
sudo apt update sudo apt upgrade // Prepare the 16.04 system for release-upgrade do-release-upgrade // 16.04 to 18.04. The system will prompt you for a password sudo apt update sudo apt upgrade // Check for errors. Stop if there are errors. do-release-upgrade -d // The -d is required until August 13, 2020 when 20.04.1 // is released. After that, DON'T use -d.
-
This classic Debian method is direct...but is NOT supported and not tested. If you do this and something breaks, we won't help you fix it. We will merely advise you to clean-install. There have been a lot of changes in the past four years, so breakage may occur.
- A backup or VM snapshot or VM clone before beginning is very wise.
- Uninstall all non-Ubuntu software packages.
-
sudo apt update
andsudo apt upgrade
- Manually edit your sources: Replace all "xenial" strings with "focal"
- Run
sudo apt dist-upgrade
. DON'T agree without reading the output. Resolve all 'kept back' packages before approving the upgrade. Make sure your Desktop is not removed by the upgrade. - Reinstall all non-Ubuntu software packages.
-
It's often fastest and easiest when skipping multiple releases to simply reinstall Ubuntu.
- A backup or VM snapshot or VM clone before beginning is wise.
- You don't need to wipe or format. The Desktop installer has an option to install onto the current filesystem, merely overwriting the current system files. This may (or may not) erase some customizations, but is the least intrusive method.
- Of course, you have the option to wipe and start over. For some users a new clean slate is preferred.
Further to Emoji's answer, I would recommend taking a disk image of the virtual machine before proceeding with the upgrade. How you take the disk image will depend on what virtual machine hypervisor software you are using. You can find instructions for VMware here.
Once you have a backup for safety, to perform the upgrade is relatively straightforward using commands:
sudo apt update && sudo apt dist-upgrade
sudo do-release-upgrade
Taking an image is especially important as you are intending to go from 16.04 to 20.04 which is quite a jump. If it goes wrong, you can then easily roll back to where you started.