Upgrade Ubuntu LTS release on Azure

General advice

Once you have decided to upgrade your system, the next question is how? There are two options depending on whether your system is setup/deployed with automation or whether it requires manual configuration.

For fully automated system deployments it is recommended to redeploy with new instances instead of upgrading from an older release.

For systems that cannot be easily created or destroyed and require manual configuration, running do-release-upgrade is a good option. However this option requires some manual intervention as explained below.

Getting started

Ensure all the packages on your machine are current:

sudo apt update -y
sudo apt upgrade -y
sudo reboot

Run the following command to start the release upgrade process:

sudo do-release-upgrade

Manual intervention steps

While upgrading from one LTS release to the next, manual decision making will be needed for the following options that are presented.

Additional SSH daemon

When upgrading in a session over SSH there is an inherent risk of losing access if something goes wrong with the SSH daemon. To mitigate this risk an additional SSH daemon is started on a different port as a backup.

The prompt notifies you that an additional SSH daemon will be started and you can either continue or cancel the upgrade.

../../../_images/0_additional_ssh_daemon.png

Optional firewall rules for additional SSH daemon

If you are using a firewall there is a chance that the port used by the backup SSHD is not open. Opening this port is not done automatically since it could be security risk. An optional command to open the port is provided and you are prompted to press enter to continue.

../../../_images/1_firewall_for_additional_ssh.png

Start upgrade

A final prompt is provided before starting the upgrade. It gives information about the number of changes and the estimated time to complete because once started, the upgrade process cannot be canceled. At this stage you can continue, cancel or see additional details.

../../../_images/2_start_upgrade.png

Restart services automatically

Library upgrades may necessitate dependent service restarts. For certain releases, you will be asked whether services that need to be restarted should be restarted automatically. If you select “no” here, you will be asked about the services that you want to restart after each library upgrade.

../../../_images/3_restart_services.png

Modified configuration

Canonical modifies select configuration files in Azure images. As a result, you may (depending on several factors, including the Ubuntu release) see a prompt during upgrade notifying you about the availability of a newer version of a configuration file. In such cases, you will be asked whether you want to keep the existing modified version, use the default one from the new version of the associated package, or take some other action. The following image is an example of the prompt you might see in relation to the file /etc/chrony/chrony.conf.

../../../_images/4_chrony_modified_config.png

Remove obsolete packages

An obsolete package is a package which is no longer available in any of the sources for apt. Usually it is safe and recommended to remove obsolete packages. But before doing so you’ll be asked if you wish to remove them and you’ll have the option to select from yes, no and more details.

../../../_images/5_remove_obsolete.png

Restart to finish upgrade

Finally, a restart will be necessary for some parts of the upgrade to be applied. If you select no, you can use /var/run/reboot-required.pkgs to check for the packages that need a reboot.

../../../_images/6_finish_upgrade.png