Ubuntu 8.04 on Linode: Cloning and Upgrading to 10.04

Annika Backstrom
in misc, on 2 November 2010. It is tagged #Computers, #Linux, #linode, #ubuntu, and #upgrade.

Here are some jumbled notes from my Linode VPS's upgrade from Ubuntu "Hardy Heron" 8.04 to "Lucid Lynx" 10.04. I wanted to do a test run before such a huge upgrade, and I did so by cloning my VPS to a  VMware Fusion virtual machine. Note that I also used Linode's backup feature before the real upgrade, just to be on the safe side.

Before the Storm: Finnix

I had no experience with Finnix before this upgrade, but it was exactly what I needed throughout the process. It's built into the Linode dashboard so you can use it as a recovery console if things go wrong. I also used it as my boot disk while cloning the Linode hard disk to my VM.

The Backup

rsync is my weapon of choice, since it allows for transport over SSH and incremental backups. I used this article to get started with some suggested rsync flags. I ran this several times throughout the process:

rsync -avzPH --numeric-ids --delete --delete-excluded \
    --exclude-from=backup.lst root@server.example.com:/ /mnt/sda1/

Here's my backup.lst exclusion file:

+ /dev/console
+ /dev/initctl
+ /dev/null
+ /dev/zero
- /dev/*
- /proc/*
- /sys/*
- /tmp/*
- *lost+found

After rsync, chroot to the cloned filesystem:

mount -R /proc /mnt/sda1/proc
mount -R /dev /mnt/sda1/dev
chroot /mnt/sda1 /bin/bash
vi /etc/fstab # update mountpoints. change xvda to sda1, xvdb to sda2

Install a bootloader. The Linode VPS is in Xen and doesn't normally boot its own kernel. (I know next to nothing about Xen, but this is what I've gleaned.)

apt-get install grub
mkdir -p /boot/grub
cp -r /usr/lib/grub/i386-pc/{stage1,stage2,e2fs_stage1_5} /boot/grub
apt-get install linux
echo defoptions=vga=791 >>/boot/grub/menu.lst

Reboot. Make sure you kill your cron jobs while the VM is on, as many are probably inappropriate for a backup server.

sudo service cron stop

I recommend taking a snapshot of your backup, here. It may actually be faster to just rsync again, but it's nice to have a complete backup at the ready.

I used a couple commands to update IP addresses on my backup so I could more accurately test services post-upgrade:

sudo ~/bin/ack --follow -al '207\.192\.74\.235' /etc | sudo xargs sed -i.bak 's/207\.192\.74\.235/'
sudo ~/bin/ack --follow -al '69\.164\.216\.5' /etc | sudo xargs sed -i.bak 's/69\.164\.216\.5/'

The Upgrade

The following notes were taking during my test upgrade, and referenced during the real upgrade. I referenced the Ubuntu Community Documentation project's "Upgrading to Ubuntu 10.04 LTS" page. There is also a Linode article on upgrading to Ubuntu 10.04.

On the first pass, python-setuptools killed my install. This was fixed by manually reinstalling before upgrade:

sudo dpkg -r python-setuptools && apt-get install python-setuptools

Ensure the update manager is installed, and issue the upgrade command:

sudo apt-get install update-manager-core
sudo do-release-upgrade

I encountered conflicts in the following packages, where I had modified local files. Also included is my resolution, which may or may not be helpful to anyone else.

  • /etc/securetty -- keep currently installed version; package adds some unneeded ones, and removes tty0 (but does include the Xen ones added by Linode)
  • /etc/sysctl.conf -- use new; uncomment "kernel.prink = 4 4 1 7" and add "fs.inotify.max_user_watches = 524288"
  • /etc/mysql/my.cnf -- kept my version
  • /etc/dhcp3/dhclient.conf -- kept Linode version: "request subnet-mask, broadcast-address, time-offset, routers, domain-name, domain-name-servers, host-name, ntp-servers;"
  • /etc/dbconfig-common/config -- nothing meaningful in the diff; use new
  • /etc/dovecot/dovecot.conf -- kept mine
  • /etc/default/openvpn -- was missing; installed package version
  • /etc/snmp/snmpd.conf -- kept mine
  • /etc/apache2/apache2.conf -- kept mine, as well as other apache2 files (but I did use the new mime.types file)
  • /etc/stunnel/stunnel.conf -- kept mine
  • /etc/default/stunnel4 -- kept mine
  • /etc/udev/rules.d/75-persistent-net-generator.rules -- kept installed, looked like the GOTO="persistent_net_generator_end" at the start was intentional

Got a warning about vulnerable SSL keys generated by older versions of Ubuntu; solution is to regenerate your keys. The dialog recommended using openssl-vulnkey and openvpn-vulnkey to test.

Other than having to resolve the file conflicts, the upgrade was very smooth. I found some notes about fixing the Xen serial console, and syslog breaking in 10.04. I also upgraded to a newer paravirt kernel in the Linode dashboard.

python-setuptools error

More about that error with python-setuptools: this thread was helpful. From /var/log/apt/term.log:

Log started: 2010-10-06  08:35:15
Setting up python-setuptools (0.6c9-0ubuntu1) ...
pycentral: pycentral pkginstall: not overwriting local files
pycentral pkginstall: not overwriting local files
dpkg: error processing python-setuptools (--configure):
 subprocess post-installation script returned error exit status 1
Errors were encountered while processing:
Log ended: 2010-10-06  08:35:15

Per the article, ran "apt-get remove python-setuptools" and "apt-get install python-setuptools"

Post-upgrade Recompiling

Something required apt-get install libltdl-dev. Useful info for this post, no?

I recompiled all my custom stuff, including nginx, memcached, mod_php and php-fpm, and mysqld.