Tuesday, October 25, 2011

Upgrade Xen VM Debian from sarge to lenny, howto

Here's how to upgrade a Debian Linux distribution to 'lenny', on a cheap Xen VM plan such as TekTonic.net's, which (of Debian) offers only version 3.1 ('sarge').

Upgrading to Debian 'squeeze' is inadvisable on TekTonic (until they offer an upgraded Linux kernel); please see my experimental blog post.

MISCELLANEOUS

I used Tektonic's shell access (through SSH), without logging in further to the account, 'root'.

One cannot change the date or time (apparently, as a DomU) under Xen. The command, 'date' appeared to work, but the time wasn't actually changed:

$ date --set=HHMM

My CPU is a 32-bit, dual-core AMD Opteron 242 (per, '/proc/cpuinfo').

WITHIN SARGE

First, upgrade within sarge, per '[Sarge] upgrades from previous releases', '[Etch] upgrading your sarge system' and 'Distribution archives':

$ mkdir /root/upgrade
$ script -t 2>/root/upgrade/sarge-to-sarge-latest.time -a /root/upgrade/sarge-to-sarge-latest.script
$ cd /

Edit (see the command, below):
1. Make sure the word, 'stable' is not in there. (If it is, change it to, 'sarge'.)

2. Change http.us.debian.org/debian to archive.debian.org/debian/ .

3. Comment out (with a leading '#', or remove) the non-us.debian.org/debian-non-US line.

4. Comment out the security.debian.org line.

$ nano /etc/apt/sources.list

Here is the desired result:

deb http://archive.debian.org/debian/   sarge main contrib non-free

Do this twice, to see error messages go away:

$ aptitude update

Then:

$ aptitude install aptitude
$ aptitude -f upgrade
$ exit

One should see the message, 'File is /root/upgrade/sarge-to-sarge-latest.script'.

SARGE TO ETCH

Next, upgrade from sarge to etch, per 'Upgrades from previous releases' and 'Upgrading the rest of the system':

$ script -t 2>/root/upgrade/sarge-to-etch.time -a /root/upgrade/sarge-to-etch.script

Edit, changing 'sarge' to 'etch':

$ nano /etc/apt/sources.list

Twice fetch the new list:

$ aptitude update

Then:

$ aptitude install aptitude
$ aptitude upgrade
$ aptitude install initrd-tools
$ aptitude --download-only dist-upgrade
$ aptitude dist-upgrade
$ exit

One should see the message, 'File is /root/upgrade/sarge-to-etch.script'.

ETCH TO LENNY

Next, upgrade from etch to lenny, per 'Upgrades from previous releases':

$ script -t 2>/root/upgrade/etch-to-lenny.time -a /root/upgrade/etch-to-lenny.script
$ dpkg --audit
$ dpkg --get-selections | grep hold
$ aptitude search "~ahold" | grep "^.h"

Edit:
1. Change 'etch' to 'lenny'.

2. Change, 'archive.debian.org/debian/' to, 'ftp.us.debian.org/debian/'.

$ nano /etc/apt/sources.list

Fetch the new list:

$ aptitude update

To fix an error saying, 'public key is not available':

$ aptitude install debian-archive-keyring
$ aptitude install aptitude apt dpkg

Make a request (in order to start aptitude working):

$ aptitude search "?false"

Then:

$ aptitude update
$ aptitude --download-only safe-upgrade

Thrice, till nothing changes:

$ aptitude safe-upgrade

Then:

$ aptitude --download-only dist-upgrade
$ aptitude dist-upgrade

POST-RELEASE & SECURITY

Per:
Updates & backports - Debian Reference - Debian.org
Debian volatile replaced by new updates suite - News - Debian.org

Edit:
1. Uncomment and change the security line (use '/', not '-'):

deb http://security.debian.org/   lenny/updates main contrib non-free

2. Add post-release updates:

deb http://volatile.debian.org/debian-volatile/   lenny/volatile main contrib non-free

$ nano /etc/apt/sources.list

Fetch the new list:

$ aptitude update

Repeat till nothing changes:

$ aptitude safe-upgrade

Remove a now-unused, old file:

$ rm -i /etc/network/options

Then:

$ exit

One should see the message, 'File is /root/upgrade/etch-to-lenny.script'.

BACKUP

Back up:

$ dpkg --get-selections "*" > /root/upgrade/dpkg-get-selections.txt
$ cd /
$ mkdir /backup
$ mkdir /backup/full
$ tar --create --one-file-system --file=/backup/full/upgraded-to-lenny.tar bin boot etc home lib opt root sbin selinux usr var/lib/apt/extended_states var/lib/aptitude/pkgstates var/lib/dpkg
$ cd /backup/full
$ gzip --best upgraded-to-lenny.tar

Shut down:

$ shutdown -h now

One must, on HyperVM, also click, 'shutdown' in order for its File Manager to see any files. Navigate (in it) to, '/backup/full' and click the icon under, 'Dn' to offload the corresponding, '.gz' file, made by gzip.

Copyright (c) 2011 Mark D. Blackwell.