My silent server that provides DNS, DHCP, Subversion and other services to my home network hadn't been upgraded since it was first installed and had been running Ubuntu 7.10 (aka Gutsy Gibbon) quite happily all this time. But with 7.10 reaching end of life in a few weeks, I felt it was time to upgrade and that today was the day to do so.
The first port of call is the upgrade notes and in particular the Hardy note to upgrade from 7.10 to 8.04. Make sure you read the "Before You Start" section at the beginning of that note before you start. So taking this into account, here is the sequence of what I did for that upgrade:
Refresh the package index
It's always good to do that once in a while and especially before an upgrade.
$ sudo apt-get update
Update all packages
Before an upgrade, it's essential to ensure that you are on the latest version of packages for your current release.
$ sudo apt-get upgrade
You will likely need to reboot after that, especially if the upgrade includes a new kernel. If in doubt, reboot anyway.
$ sudo init 6
That's the bit that will perform the upgrade so you need to make sure it's there. If in doubt, install it,
apt-get will tell you if you already have the latest version.
$ sudo apt-get install update-manager-core
That's the biggie that will take a long time and may ask you some questions in the process. If you ever get any question, make sure you read them carefully. Defaults tend to be sensible so it shouldn't wreck your system but that doesn't excuse you from being sensible and paying attention.
$ sudo do-release-upgrade
A few things to note on the upgrade process:
- I was doing my upgrade through SSH. If things go wrong, you can potentially lose connection with your server and it can all end in tears so the upgrade process warns you about this and starts a second SSH daemon on a different port (9004 in my case but it will tell you). I had no problem installing over ssh but be careful nonetheless.
- If you have a DHCP server configured, as I do, it will probably notify you that the file
/etc/dhcp3/dhcpd.conffile has been modified on your server and ask you whether you want to replace it with the new one it just downloaded or keep the old one. You need to keep the old one if you want your settings to be preserved. To be on the safe side, make a copy of it just in case.
- Because of a well documented bug in Debian upon which Ubuntu is based, the upgrade process will re-generate any SSL key, in particular the RSA keys used by SSH. That will affect us later and I'll explain what to do about it.
Once the upgrade is finished, the script will ask you of you want to reboot immediately. Unless you have a good reason to reboot manually, you can let the upgrade process do that for you.
Updating the SSH keys on the client machine
If you attempt to reconnect to your server via ssh straight after the upgrade, you will be greeted by a worrying message and you won't be able to go further:
Helsinki:~ brunogirin$ ssh bruno@szczecin @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that the RSA host key has just been changed. The fingerprint for the RSA key sent by the remote host is dc:11:1a:78:f4:34:c3:a2:ab:9d:52:1e:98:6d:7f:36. Please contact your system administrator. Add correct host key in /Users/brunogirin/.ssh/known_hosts to get rid of this message. Offending key in /Users/brunogirin/.ssh/known_hosts:2 RSA host key for szczecin has changed and you have requested strict checking. Host key verification failed.
This is normal and is due to the fact that the upgrade process has re-generated the ssh RSA keys on the server. Those keys are stored on all client machines that have previously connected to that server so that they can verify the identity of the server. To resolve that problem, the error message is giving us a hint. On the example above taken from my OS-X box, it tells me that the offending key is on line 2 of file
/Users/brunogirin/.ssl/known_hosts. So open that file in an editor and remove the offending line then try to connect again. As it doesn't have the key anymore, it will ask for confirmation before adding the new one to that file and let you connect:
Helsinki:~ brunogirin$ ssh email@example.com The authenticity of host 'szczecin.home (192.168.1.253)' can't be established. RSA key fingerprint is dc:11:1a:78:f4:34:c3:a2:ab:9d:52:1e:98:6d:7f:36. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'szczecin.home' (RSA) to the list of known hosts.
Note that if you have several keys for the same host, for instance if you've connected through its name and IP address in the past, it may give you another warning, as shown on my Ubuntu laptop:
Warning: the RSA host key for 'szczecin' differs from the key for the IP address '192.168.1.253' Offending key for IP in /home/bruno/.ssh/known_hosts:1 Are you sure you want to connect (yes/no)?
Once again, it tells you which is the offending key so you can remove it and attempt to connect via the IP address to renew the key. Note that this only works as explained above if SSH on the client is configured so that the
StrictHostKeyChecking option is set to
ask. If it is set to
no, it will never check and will happily connect. If it is set to
yes, you will have to update the keys manually. See
man ssh_config for the full details.
There you go: apart from the SSH malarkey at the end, it was rather straightforward and very quick too! In fact, it took me more time to write this post that do the upgrade.
Now that I have this server on 8.04, I could upgrade immediately to 8.10 but I'll leave that for another day. In fact, considering that 8.04 is an LTS release, I may leave my server on that version until the next LTS release, 9.10 aka Karmic Koala, scheduled for October.