Monthly Archives: December 2013
Debian Architectire Change i386 to AMD64

Last week I upgraded the Debian System on my Laptop from i386 to AMD64. Some people
may say: “this never works” but from a technical point of view it should not be a problem in a well
packaged linux environment, so I started to try it out.

Basically you have to exchange every binary on the system with the 64bit version. which means
that you have to reinstall every package on the system. All of the config files user data and
some databases in /var should stay as they are.

My first Problem was the Kernel. My original Kernel that I used was 32 bit only. The Debian AMD64
Kernel freezes during Hardware detection. I think there is some problem with the Firmware Loader
infrastructure and 64bit. ifconfig does not return when the firmware cant be loaded. (note to
myself: report that to the kernel people) The compiler suite could only produce 32 bit binarys
and therefore 32 bit kernels by default. I think there is a way to let it produce 64 Bit binarys
but I simply used the Kernel from a grml life system.

After I could boot a 64bit system I was able to debootstrap a new Installation to the harddisk,
download a kernel source and compile a fresh 64 bit kernel.

I then installed the same packages on the bootstrapped system as there are on the original one.
therefore I fetched a package list with aptitude, stripped out all automatic installed packages
and did an apt-get install on the bootstrapped 64bit system. Sorry that I cant write down every
command I used for this but I didn’t make to many notes, but you are surely an awakened head so
you may figure out the right shell commands for yourself.

I planned to use /etc and /home as well as the mountpoints in /media as they are. /var needs to be
migrated for the LDAP Database Log, Cups and Mysql. /usr/src and /usr/local schould be delivered
from the i386 System. All the other Files should come from the new
system. In /etc the /etc/ld.so.conf.d should come from the new system, the passwd and group should
come from the old one, especially the passwd is a bit tricky.

Because some of the users are installed dynamically, userids change from the old system to the new
one. A good solution would have been to copy the passwd directly after bootstapping, but i missed that
point, so I had to adopt all the userids of the existing (amd64) system users to the UIDs on my old system.
I did that with “find -uid” by finding all filed owned by all old uids, giving them a temorary new uid. I then
mapped all temporary uids to the old (i386) passwd database. With that two step process I ensured that I do
not switch an existing uid to another one I have to chane later.

I later discovered that the alternatives system is also messed up a bit at the moment, I have to fix that,
but it does not harm operations at the moment.

After copying all the files together all I had to do was to make the new system bootable, create a new initrd,
recompile any customized packages (like wmii-hg) reboot, and experience the really fast amd64 performance.