How to upgrade from Ubuntu 16.04 LTS to 20.04 (in virtual machine)

15,541

Solution 1

There is no direct release-upgrade path that is supported.

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



  1. 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 and sudo 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.



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

Solution 2

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.

Share:
15,541
Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    I am a very new Ubuntu user (in virtual machine because i use Windows 7 for non-ubuntu stuff R.I.P ME) But i need to upgrade to 20.04 (and i use 16.04) but how to upgrade?

    Without: Buy a computer with Ubuntu installed, Download .iso file or download the .iso file in that VM In VMWare.

  • BND
    BND almost 3 years
    "Manually edit your sources: Replace all "xenial" strings with "focal", Please where are there?
  • user535733
    user535733 almost 3 years
    @BND If you need to ask the question, then you are not ready to use that option. Pick an option that better matches your level of skill.