Skip to content
English
  • There are no suggestions because the search field is empty.

How to update Ubuntu 20.04 to 22.04

Please note:

  • Ubuntu 20.04 goes EOL on May 31st 2025 to ensure you continue to receive OS security updates you must update to 22.04 or newer.
  • We have put this guide together for Hyperglance VMs or Instances that are running Ubuntu 20.04.
  • This guide will update your OS to 22.04
  • Canonical do recommend you connect to your instance or VM using the serial terminal rather than SSH or SSM.

 

How do I know if I'm running Ubuntu 20.04?

Run this command to determine which OS and version is running:

cat /etc/os-release | grep PRETTY_NAME

If the host OS is not Ubuntu or the version is newer than 20.04 then you do not need to continue with OS update although you probably still need to update Hyperglance's Docker services that are based on Ubuntu docker images.


Update procedure

  1. Run this command. (It will configure dpkg to keep original configurations during the update and significantly reduces the number of interactive prompts).
    echo 'Dpkg::Options {
    "--force-confdef";
    "--force-confold";
    }' | sudo tee /etc/apt/apt.conf.d/local-keep-configs
  2. Run this command to update packages:
    sudo DEBIAN_FRONTEND=noninteractive apt update && sudo apt upgrade -y

    PLEASE NOTE: It may prompt to ask whether you want to keep or overwrite configuration files. Always opt to keep them (the default option).

  3. Run this command to reboot:
    sudo reboot now
    NOTE: Your terminal session will most likely be disconnected so you will have to reconnect once the reboot is finished.
  4. Run this command to install update manager:
    sudo apt install update-manager-core -y
  5. Run this command to update the OS:
    sudo DEBIAN_FRONTEND=noninteractive do-release-upgrade
  6. If you are performing the update over SSH rather than serial console then you will receive this message:
    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]
    If you wish to continue then type  y and press ENTER and then you will receive this message:
    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]
  7. When you receive the message below, press ENTER:
    Third party sources disabled 

    Some third party entries in your sources.list were disabled. You can
    re-enable them after the upgrade with the 'software-properties' tool
    or your package manager.

    To continue please press [ENTER]
  8. When you receive the message below continue by typing y and press ENTER:
    Do you want to start the upgrade? 


    3 packages are going to be removed. 95 new packages are going to be
    installed. 591 packages are going to be upgraded.

    You have to download a total of 322 M. This download will take about
    49 seconds with your connection.

    Installing the upgrade can take several hours. Once the download has
    finished, the process cannot be canceled.

    Continue [yN] Details [d]
  9. When asked to remove obsolete packages type y and press ENTER:
    Remove obsolete packages? 


    85 packages are going to be removed.

    Continue [yN] Details [d]
  10. When the update is complete you will be prompted to restart. Type y and press ENTER:
    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] 
  11. Wait for the reboot to complete then login again and run the following command to verify the OS is updated successfully:

    lsb_release -a

    You should see output that indicates the system is now running 22.04 LTS:

    Distributor ID: Ubuntu
    Description: Ubuntu 22.04.5 LTS
    Release: 22.04
    Codename: jammy

     

    What's next?

    Now your host OS is updated but you probably still need to update Hyperglance Docker services.  Follow the linked guide to update those.