Upgrading debian 32 to 64 bit

I had an old VM running 32 bit Debian Squeeze and wondered whether it is possible to upgrade it to 64 bit.
Officially this is inpossible, but there are ways to do is

WARNING You should know what you are doing, you should have both a backup and a live-CD or similiar!

I've found found a procedure at http://teddyb.org/~rlpowell/hobbies/debian_arch_up/ from Robin Lee Powell (thanks!), but I used another approach which is using debootstrap to get a base paket of 64 bit binaries to minimize the risk that the system get completly broken.

That works quite flawless, because I have the core utils always workable and at the same version. The only risky process is copying the files - but if that causes the system to crash (did in my case), that can be done safely with a Live-CD. perl-base refused to install because of conflicting files with libperl, which I cured with a dpkg -i --force-all.

The whole command-log:

aptitude update
aptitude dist-upgrade
debootstrap --arch=amd64 testing /de  http://ftp.debian.org/debian
mkdir -p /de/a
mount -o bind / /de/a
mount -o bind /de/var/cache/apt/archives /var/cache/apt/archives
on a new shell:
chroot /de
# mc is nice (has all built in)
apt-get install ia32-libs libc6-i386 openssh-server openssh-client mc
#if one of the following commands crash, redo it from a Live-CD
cp -r /bin/ /a/
cp -r /sbin/ /a/
cp -r /lib/ /a/
cp -r /lib32/ /a/
cp -r /lib64/ /a/
cp -r /usr/lib/ /a/usr/
cp -r /usr/lib64/ /a/usr/
cp -r /usr/bin/ /a/usr/
cp -r /usr/sbin/ /a/usr/
#now, the most important binaries are 64 bit
cp -r /var/cache/apt/ /a/var/cache/
on the old:
cd /var/cache/apt/archives
dpkg -i libc6_2.11.2-6_amd64.deb
aptitude update
aptitude dist-upgrade
rm /var/lib/doc-base/info/*
dpkg -i --force perl-base*.deb
aptitude dist-upgrade
aptitude install "kernel-image" "kernel-headers"
reboot

Back

Valid XHTML 1.0 Strict