Elite software development.

Using Xen With Debian Lenny on 64-bit AMD To Emulate (Paravirtually) 32-bit IA32, A Log, Part 2

This documents my efforts to produce a 32-bit Debian Lenny image for Xen with a 64-bit Debian Lenny dom0.

  • arch: AMD64 Athlon X2
  • os: Xen 3.2 (via Debian Lenny's install)
  • dom0: Debian Lenny 64-bit
  • domU: Debian Lenny 32-bit (desired)

I want to produce the 32-bit domU, which I'll call "lenny-32-mc". ["lenny" describes the distro (Debian 5.0.2), "32" describes the CPU architecture to be emulated/paravirtualized, and "mc" is for Mozilla Central, which is the code base that I plan on working on within this image.]

Problems

There are several major impediments to this. It is a simple task, but Debian makes it difficult. In fact, the impediments were so serious that they have destroyed the good reputation of the Debian distro, for me. I've never installed another Debian.

The first problem is that 'apt', the package management suite, does not easily allow the installation of 32-bit kernels on the 64-bit dom0. This is a major problem because we need a 32-bit kernel (and ramdisk) for the lenny-32-mc domU. The amount of learning required to use 'apt' and 'dpkg' on a 64-bit dom0 to install 32-bit packages in staggering. Still, I learned.

Sadly, the problem did not end there. The 32-bit kernels available did not boot properly. Those that made some progress booting hung.

I studied, analyzed, and followed the advice of the following how-to documents. None of them helped me make any progress:

Solution

Finally, a solution: download a pre-built image from http://stacklet.com. Here's what worked for me.

I selected the appropriate 32-bit Debian Lenny image from stacklet's menu, and downloaded to my dom0 in /home/xen/domain/lenny-32-mc:

/home/xen/domains/lenny-32-mc# curl -O http://stacklet.com/sites/default/files/debian/debian.5-0.x86.20090517.i...
...
/home/xen/domains/lenny-32-mc# curl -O http://stacklet.com/sites/default/files/debian/debian.5-0.x86.20090517.i...
...
/home/xen/domains/lenny-32-mc# openssl md5 debian.5-0.x86.20090517.img.tar.bz2
MD5(debian.5-0.x86.20090517.img.tar.bz2)= f299ecc3e90398aeafae93009be2111e
/home/xen/domains/lenny-32-mc# cat debian.5-0.x86.20090517.img.tar.bz2.md5 
f299ecc3e90398aeafae93009be2111e  debian.5-0.x86.20090517.img.tar.bz2
/home/xen/domains/lenny-32-mc# tar -jxf debian.5-0.x86.20090517.img.tar.bz2 

The unarchived .tar.bz2 delivers 3 files:

  1. debian.5-0.x86.img, the disk image (1GB)
  2. debian.5-0.x86.xen3.cfg, a Xen .cfg file, and
  3. debian.5-0.x86.xen3.pygrub.cfg, a pygrub .cfg file.

On my Debian system, only the pygrub boot method worked. Also, the alternate method requires loop-mounting the image, extracting the kernel onto the dom0's filesystem, and configuring appropriately. Even if it had worked, it would not be as easy as using pygrub. I deleted debian.5-0.x86.xen3.cfg.

I renamed debian.5-0.x86.xen3.pygrub.cfg to simply pygrub.cfg, and edited it appropriately. Note that Debian installs the 'pygrub' bootloader into /usr/lib/xen-3.2-1/bin. Careful, that's not likely in your $PATH. Here's the edited pygrub.cfg:

bootloader = "/usr/lib/xen-3.2-1/bin/pygrub"
memory = 1024
name = "lenny-32-mc"
vif = [ '' ]
disk = ['file:/home/xen/domains/lenny-32-mc/lenny-32-mc.img,sda1,w']
root = "/dev/sda1"
extra = "fastboot"

Next, I symlinked to the pygrub.cfg file from /etc/xen, which is where the Debian xen-tools look for Xen VM configuration files, and then started the Xen image:

/home/xen/domains# cd /etc/xen/
/etc/xen# ln -s /home/xen/domains/lenny-32-mc/pygrub.cfg lenny-32-mc.pygrub.cfg
/etc/xen# xm create lenny-32-mc.pygrub.cfg 

This allowed me to log in as root, with password "password". My final steps were:

  1. Use passwd to change the root password to "Collabora".
  2. Issue apt-get update to update the Debian package list database.
  3. Issue apt-get upgrade to upgrade the installed packages.
  4. Reboot the 'lenny-32-mc' VM with xm reboot lenny-32-mc from the dom0. This verifies that the new Debian packages have not broken things.
  5. Resize the VM image.

Now, see Part III of this article.

References