Sunday, July 12, 2009

Upgrading Ubuntu Server from 6.06 (dapper) to 9.04 (jaunty)

Ubuntu has come a long way over the last three years. As the long-term support (security fixes) for many Ubuntu dapper packages are coming to an end, I chose to upgrade one of my operational servers all the way from dapper to the latest release, jaunty.

That is: dapper → edgy → feisty → gutsy → hardy → intrepid → jaunty

After much messing around, it was clear an "aptitude dist-upgrade" wasn't going to get me there in one go. Changing /etc/apt/sources.list to use the jaunty repositories causes aptitude kept dying with a rather esoteric error message "E: Internal Error, Could not perform immediate configuration (2) on libc6 A package failed to install. Trying to recover".

The upgrade process that worked for me involved repeatedly upgrading from one version of Ubuntu to the next. Fortunately this was a headless server mostly running a LAMP setup, with ~350 packages installed in total. Your mileage my vary on a desktop install with X11. Make sure you start with enough free disk space. I started with 800MB free, and finished with ~600MB.

To upgrade through the non-supported edgy, feisty and gutsy releases the "old-releases" archives must be used. Edit your /etc/apt/sources.list file, replacing the server name eg "archive.ubuntu.com" (or your local variant) with "old-releases.ubuntu.com".

For each release in (dapper, edgy, feisty, gutsy, hardy, intrepid, jaunty):
sudo gedit /etc/apt/sources.list
change every instance of the release name, eg. "dapper" to the
next release eg. "edgy". Also change the server address to
 "old-releases.ubuntu.com" where necessary.
sudo aptitude update
sudo aptitude dist-upgrade
click through prompts to upgrade configuration files. Try and
stick with the package maintainer's updates where possible.
reboot

The process took several hours and was surprisingly painless. Note that this Ubuntu install was running a custom kernel on a Linode VPS. While theoretically the dist-upgrades and subsequent reboots should work fine with the stock Ubuntu kernels, there's additional room for error/issues here. Again, on anything but a simple server your mileage may vary.

1 comment: