This HOWTO describes an easy way to run any programme installed in the 32-bit OS in a chroot jail running under the 64-bit OS. It is so simple to implement that people might even consider installing a new 32-bit OS for exactly that purpose in a spare partition (don't even think of messing with debootstrap).
I'm running Debian Sid in both 32- and 64-bit versions, but clearly Etch or Lenny will do just as well. I do recommend, though, that you run the same distro in both cases, dist-upgrading one of them as needed. I'll use Etch in the examples below, change that to Lenny or Sid as appropriate. My 32-bit OS root partition is /dev/sda8, change that also to match your installation.
The following setup must be run from the 64-bit OS. All commands prefixed with # are to be run as root; user commands use $.
Mount points
First make a mount point for the 32-bit root partition,
Code: Select all
# mkdir /mnt/etch32
Code: Select all
/dev/sda8 /mnt/etch32 ext3 defaults 0 0
/home /mnt/etch32/home none bind 0 0
/tmp /mnt/etch32/tmp none bind 0 0
/media/cdrom0 /mnt/etch32/media/cdrom0 none bind 0 0
/dev /mnt/etch32/dev none bind 0 0
proc-chroot /mnt/etch32/proc proc defaults 0 0
Code: Select all
# mount -a
This completes the setting up of the chroot, what remains is making it simple to use.
Schroot users
Install the schroot package with
Code: Select all
# apt-get install schroot
Code: Select all
[etch32] # some name for the chroot environment
description=Etch 32-bit chroot
location=/mnt/etch32
aliases=default
personality=linux32
priority=1
users=henk
How to use
Schroot allows the user to run any programme in the 32-bit OS from the 64-bit OS without ever having to enter the chroot. What's more, this can optionally be done with the current 64-bit environment (as in /etc/profile) preserved. For example,
Code: Select all
$ schroot -p iceweasel
Note that maintenance of the 32-bit OS can also be done this way,
Code: Select all
# schroot apt-get update
Code: Select all
$ sudo schroot apt-get dist-upgrade
We'll leave it to the reader as an exercise to provide icons on the 64-bit desktop that will start 32-bit IceWeasel, Kaffeine, Mplayer, etc, this way.
Removing the chrooted environment
This must be done with care, since some regular directories in the host OS (like /home) are bound to it -- these should not be removed inadvertently! The proper way to remove the chroot environment is by first removing the added lines in /etc/fstab (see above), and then to reboot. Let's hope you do this because Debian GNU/Linux has become fully multi-arch bootable and/or all the multimedia programmes and codecs have become fully functional in 64-bit (that'll be the day...).
Have fun!
Acknowledgements: I started with the Howto by michael7, see http://forums.debian.net/viewtopic.php?t=12061, and consulted recursively the sources listed there. Those sources say that the system libraries of the 32-bit OS should be linked with those of the host 64-bit OS, but this is clearly not needed if all you want to do is run 32-bit programmes in a chroot jail. I have also upgraded from dchroot to schroot. Consult michael7's Howto if you can't solve the icon exercise...
Edited 13 August 2007: rewrote the introductory paragraphs, no changes to the code.