====== Upgrade Ubuntu 20.04 to 22.04 LTS ====== ===== Step 0: Checks ===== Make sure you have at least 30GB of free disk space. Check with the ''df'' command: df -H ===== Step 1: Update 20.04 ===== # update package list sudo apt update # update installed packages sudo apt upgrade # additional upgrades due to changed dependencies, etc. sudo apt dist-upgrade -y If it asks you to reboot, you must [[https://linuxhandbook.com/restart-ubuntu-server/|restart your Ubuntu server]]. Otherwise, it won't start the upgrade procedure. sudo reboot now ===== Step 2: Check Update Manager ===== Check for default behavior for the release upgrader: less /etc/update-manager/release-upgrades Make sure the following line is set to ''lts'': Prompt=lts ... and it is not commented out. This means that your Ubuntu system will be updated to a new stable LTS version. ===== Step 3: Upgrade to 22.04 LTS ===== ''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. sudo do-release-upgrade **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] Press **y**. 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 ... 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? 4 packages are going to be removed. 107 new packages are going to be installed. 554 packages are going to be upgraded. You have to download a total of 547 M. This download will take about 1 minute with a 40Mbit connection and about 14 minutes with a 5Mbit connection. Fetching and installing the upgrade can take several hours. Once the download has finished, the process cannot be canceled. Continue [yN] Details [d] Enter **y** 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? 4 packages are going to be removed. 107 new packages are going to be installed. 554 packages are going to be upgraded. You have to download a total of 547 M. This download will take about 1 minute with a 40Mbit connection and about 14 minutes with a 5Mbit connection. Fetching and installing the upgrade can take several hours. Once the download has finished, the process cannot be canceled. Continue [yN] Details [d] Enter **y**. You may receive another warning about not being able to disable a lock screen: **Output** Unable to disable lock screen It is highly recommended that the lock screen be disabled during the upgrade to prevent later issues. Please ensure your screen lock is disabled before continuing. If you are connecting to a Ubuntu server, rather than a desktop, you can ignore this warning by pressing **Enter**. 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 ... 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] Enter **y**. On an SSH session, you’ll likely see something like the following: **Output** Connection to [IP address] closed by remote host. Connection to [IP address] 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 22.04 LTS (GNU/Linux 5.15.0-25-generic x86_64) After the upgrade, run command below to check the ubuntu version. lsb_release -a ===== Final actions ===== //None.//