Updating Ubuntu server 14.10 in 2018

Updating Ubuntu server 14.10 in 2018

Just… why?

Recently I was tasked with updating a number of legacy servers running Ubuntu 14.10. Aside from the obvious security issues of running an OS several years out of date, there were a number of newer packages that simply wouldn’t work anymore, so we decided it was time to bite the bullet, update, and deal with the inevitable incompatibilities that we came across afterwards.

Now normally, updating an OS isn’t a terribly difficult thing to do, especially when that OS is Ubuntu. You simply run a command, wait a while, answer a few prompts and hey-presto, you’re up to date! But not Ubuntu server 14.10, oh no… see that particular OS has been fully deprecated, so there’s no straightforward upgrade path to modern versions like 16.04. In fact, the most common suggestion I came across when attempting to do this was simply to backup, wipe, and start over.

Before I continue, I should point one thing out: the above advice is not wrong. When you’re faced with a system quite so out of date, any number of zero-day exploits could have been utilised against it in the years since it was last updated, so there is very little chance of guaranteeing that it hasn’t been compromised. Accordingly, wiping and starting over is almost definitely the best option… but it isn’t the quickest, and in this particular case, we needed to get the system up to date and working just as quickly as possible. Enter, this guide.

NOTE #1: If you’re server is hosted by Amazon AWS, their update servers will take care of everything for you, just run the usual update commands, no need for this guide!

Down to business

I’m going to break the process up into each logical upgrade, and will follow along as I do in order to show the entire process working.

14.10 -> 15.04

Proof of where we’re starting

First and foremost we’ll need to change the sources our machine looks to for update files. The reason for this is that those sources have long-since been moved / archived, so we’ll need to redirect them. Open up your sources file (located at “/etc/apt/sources.list”) and look to see what most of the URLs begin with. With my particular machine being UK based, most of the URLs begin with “http://gb.archive.ubuntu.com”, but yours may be slightly different. The problem with this is that if you run any kind of update script, you’ll see one of the following:

Err http://gb.archive.ubuntu.com utopic/main Sources

404 Not Found [IP: 91.189.88.149 80]

W: Failed to fetch http://gb.archive.ubuntu.com/ubuntu/dists/utopic/main/source/Sources 404 Not Found [IP: 91.189.88.149 80]

E: Unable to fetch some archives, maybe run apt-get update or try with –fix-missing?

This all points quite clearly to the problem; the URLs the machine is looking for no longer exist, because they have been moved to the “old-releases” section. So to get things started, we just need to rewrite our sources file to prepend “old-releases”, easily done with the following command:

sudo sed -i -re 's/([a-z]{2}\.)?gb.archive.ubuntu.com|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

NOTE #2: The above line looks for occurrences of “gb.archive.ubuntu.com”, which is specific to UK distributions. You should replace this with the prefix currently found in your own sources file. The reason I include this here is that just swapping “archive.ubuntu.com” for “old-releases.ubuntu.com” wasn’t enough, as the still present”gb” sub domain stopped the updates from working.

Once that’s run, check your sources file, the URLs should now look more like “http://old-releases.ubuntu.com/ubuntu/”. Now , it’s a simple update and upgrade procedure:

  1. Run sudo apt-get update to get the latest update listings
  2. Run sudo apt-get upgrade to update your existing packages
  3. Run sudo apt-get dist-upgrade to update your OS’s distribution files
  4. Run sudo do-release-upgrade to perform an OS upgrade

NOTE #3: During the above, either here or the next time you run it further down in this blog, it’s very likely that one of your hundreds of outdated packages will ask whether or not you want to “install the package maintainer’s version”. You need to make this decision on a per-application basis. Swapping out for the “package maintainer’s” version means deleting any changes you have made, and reverting to the default version of the specified file. This may be fine for the sort of apps that are of an “install and forget” nature, but is far from fine for applications that you have spent months configuring and maintaining to work exactly as you need them to.

You should carefully consider each of these prompts

NOTE #4: During the final step of the upgrade, you’ll be asked if you want to rewrite your source entries due to no upgrade being found. Select yes to this, we’ve already gotten all the updates using our alternative mirror, so we can rewrite prior to the upgrade.

Say yes (“y”) when prompted, to adjust your sources list

Once done, you’ll be asked to reboot, and after doing so, you’ll be able to check your version again (using lsb_release -a), and see that you’re now 1 step closer!

We’re getting there!

15.04 -> 16.04

Things get a little easier now we’re on 15.04, but for the most part, we’ll follow the same process:

  1. Run the following to set your sources list back to “old-releases”: sudo sed -i -re 's/([a-z]{2}\.)?archive.ubuntu.com|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list (the region aspect of the URL no longer matters, you can leave it as it is)
  2. Run this additional command to swap from the “vivid” (15.04) to “wily” (15.10) release: sudo sed -i 's/vivid/wily/g' /etc/apt/sources.list
  3. Get the latest updates (both for packages and the OS distribution) using the command sudo apt-get update && sudo apt-get dist-upgrade
  4. Perform the next upgrade, with the command sudo do-release-upgrade

After another reboot, you’ll now be presented with the following, much nicer response to the trusty lsb_release -a command:

Aaaaand scene!

16.04

You may think your work is now done, but sadly, this is not the case. The easy part is over, the hard part (ensuring all of your packages are working as you would expect them to) can now begin. You’ll need to go through all of your installed packages and test them, ensuring your web-servers display content as you would expect, your databases accept the same connections they did before, and your FTP accounts are still locked down to their home directories, etc.

NOTE #4: If you’re using Apache and PHP, and find that your PHP no longer works properly (it’s likely that it will print PHP code into the browser window), the following is a quick cheat-sheet for reinstalling the newer versions and ensuring they’re enabled:

  1. sudo apt-get purge php5-common
  2. sudo apt-get install libapache2-mod-php
  3. sudo apt-get install php-mysql
  4. sudo service apache2 restart

In conclusion

To make the same point I made earlier: this probably isn’t the best solution for upgrading your legacy systems. It’s quick, it’s a little dirty, and it works (for now), but you should probably be looking to reinstall such systems, and more importantly, enabling automatic updates. Oh, and one other thing, make sure you stick to the LTS releases in future!

Leave a Reply

Your email address will not be published. Required fields are marked *