In June of 2017 I upgraded my Ubuntu 16.10 (Yakkety Yak) LTS install to Ubuntu 17.04 (Zesty Zapus). In October of 2017 Ubuntu released 17.10. (Artful Aardvark). I had not needed to upgrade my Ubuntu 17.04 installation for a while, but I felt it was best to keep it up-to-date. I was also experiencing issues with it from day-to-day. I decided an upgrade might work to fix some of the issues I was having.
The upgrade process is still fairly simple, but when performing it over SSH it can still be complicated. I ran into a small snag following my old procedure, so I felt it would be good to adapt it to a more generic upgrade procedure. As before, the process is not set-it-and-forget-it automated–it should be attended. SSH should already be configured and in-use, if this is your intended method, as well. This process assumes you normally access the system via SSH, but for those who do not know how, here is how to setup SSH.
If the intended system on which the upgrade will be performed is a production system or contains valuable data, please consider performing a backup. There are several methods by which to accomplish this task listed here.
1. Install Screens
First off, make sure your repositories are up-to-date in your current distribution by running:
sudo apt-get update
Now we can install screen:
sudo apt-get install screen
Enter screen for the first time by typing:
and pressing Space key for next page or Enter key to end, in order to accept the license. You can learn more on how to use screen here. The commands to run screen for this process will be included below.
2. Check for Release and Set to Normal Release Distribution
Check if there is even an update available to you by typing the following command:
If a newer version of Ubuntu is available, it will be shown in the returned results. If this command does not work, you will need to install the Update Manager by running the following command:
sudo apt-get install update-manager-core
After the package installs, check for the upgrade again:
If there is no version available, we need to make sure we are setup to upgrade to the latest normal release, which requires a small edit to a system file. To make this edit, type the following:
sudo nano /etc/update-manager/release-upgrades
Find the line of the document called
prompt and make sure it says
prompt=normal. If it says
prompt=lts please change it.
If changes were made, press
ctrl+o to save changes and then
ctrl+x to exit. If no changes, just press
Check for a new version again:
If there is not one, your distribution may be too old and you may have to consider upgrading manually to a newer version.
Beware of PPAs
Run the following command to check your repositories listed on the system:
grep -r --include '*.list' '^deb ' /etc/apt/sources.list /etc/apt/sources.list.d/
grep -r --include '*.list' '^deb ' /etc/apt/ | sed -re 's/^\/etc\/apt\/sources\.list((\.d\/)?|(:)?)//' -e 's/(.*\.list):/\[\1\] /' -e 's/deb http:\/\/ppa.launchpad.net\/(.*?)\/ubuntu .*/ppa:\1/'
If you have PPAs on the system, they may interfere with the upgrade. Consider removing them and returning any packages to default from the support repositories with the following package:
sudo apt-get install ppa-purge
After it installs, remove the PPAs manually with the following command:
sudo ppa-purge ppa-name
ppa-name with name of PPA Repository.
3. Start a New Screen and Upgrade
At this point we need to start a new screen for the upgrade process, because the upgrade process will kill the current SSH session. To do so, type the following commands:
screen -S upgrade
This will drop you into what seems like a new terminal session. In this screen type:
IMPORTANT: When going through the upgrade process you will be given a new port on which SSH will function during the upgrade. Document this number–in my case it was 1022. CANCEL the upgrade once you find the new port.
We need to edit the firewall in order to allow access to the host on the new port by running the following command:
sudo iptables -I INPUT -p tcp --dport PORT# -j ACCEPT
PORT# with the new port number presented in the initial part of the canceled upgrade process.
To resume the upgrade, run this command:
Go through the process until you lose SSH access to the session and then keep following this guide.
4. Re-Establish SSH Access
Once you lose access to the default SSH port during the upgrade, you will have to use the new port number the upgrade process opened to attend the upgrade process. Complete the following steps:
ssh -p PORT# USERNAME@HOSTorIP
Once the new SSH connection is established on the new specified port, complete the following commands to attend the upgrade process:
screen -r upgrade
5. Attended Upgrade
There will be multiple prompts during this upgrade process, so it is recommended you sit with it and periodically check it. The upgrade took me roughly 30 minutes in total on a 50 Mbps connection. The download will be roughly 1.4 GB in size, so the connection speed can make this process vary in time drastically.
I wish you the best of luck with the upgrade! Let me know in the comments what your experience was like.