Let me put it straight right away; I didn’t get bx to work reliably on amd64 and I don’t have the necessary C knowledge nor enthusiasm to endulge myself in finding the problems. What I’ll outline here is just the same style instruction on how to set up an ia32 chroot that can be found in many places on the net.

Update: It seems that some other linux distributions invest a bit more into amd64 compatibility than debian. I haven’t tested these patches yet, though. (But I could spot the /window crash bux fix.)

This post will give me enough information to recreate this setup at a later time — if you need any more details feel free to contact me.

Some sample instructions on how to set up such a 32bit chroot inside an amd64 environment can be found on https://alioth.debian.org/docman/view.php/30192/21/debian-amd64-howto.html#id292281

I just did debootstrap --arch i386 etch /var/ia32; of course you need to install debootstrap first. However, my 64bit are on a virtual server which does not allow me to execute mount commands even as root. That gave me a little headache, as debootstrap would crash in the middle; the reason apparently being that it tried to mount /proc, which it couldn’t (but it didn’t tell me that!):

[...]
I: Extracting zlib1g...
zsh: exit 2     debootstrap --arch i386 etch /var/ia32

The result was a broken debian installation without any much needed programs like apt, that with the help of Myon from #debian I could fix - however, I have no clean path. First, I entered the chroot: SHELL=sh chroot /var/ia32, then I needed to create a few files: touch /var/lib/dpkg/{diversions,statoverride}, next, I tried to install all the packages debootstrap had downloaded: dpkg -i /var/cache/apt/archives/*.deb, however, that wouldn’t quite work and I got a shitload of errors.

So the next thing I did was to run dpkg --configure -a, a typical command to execute whenever something with dpkg isn’t working quite right. Then I reran the dpkg -i command, which still bailed out, but with a few less packages on the list. Now started the fun part, I resolved all the dependencies by hand, installing each package manually with dpkg -i /var/cache/apt/archives/PACKAGENAME.deb. Oh the joy. After each install I reran dpkg --configure -a and looked at the top line to see what it was complaining about, for example

dpkg: dependency problems prevent configuration of lsb-base:
 lsb-base depends on sed; however:
  Package sed is not installed.

which I then follewed with a dpkg -i /var/cache/apt/archives/sed*.

For the last error:

Setting up base-files (3.1.16) ...
mkdir: cannot create directory `/var/mail': File exists
dpkg: error processing base-files (--configure):
 subprocess post-installation script returned error exit status 1

I simply had to rm /var/mail. Phew. Set up.

(Note: I did not follow the “fstab / mount” steps outlined in the AMD64 HOWTO nor did I set up schroot.)

Hit the jump if you want to learn about BitchX.

The next thing I did was to leave the chroot (^D) and copy my /etc/apt/sources.list as well as my /etc/apt/apt.conf into the chroot.

Back in the chroot, I ran apt-get clean and aptitude update. Now I could simply aptitude install bitchx-ssl and a first BitchX -N inside the chroot confirmed that it was working nicely. (A /window xx also confirmed that it wouldn’t crash as nicely as the 64bit debian package…)

Now I wanted to integrate bx into my main system without using chroots and other annoying hacks; so I went for a worse hack.

The first thing I did was to leave the chroot and aptitude install ia32-libs in the main server. Now I could try to run /var/ia32/usr/bin/BitchX, but that would obviously still fail since BitchX was missing its openssl libraries.

So I edited my /etc/ld.so.conf like this:

/lib
/usr/lib
/usr/X11R6/lib
/var/ia32/lib
/var/ia32/usr/lib
/var/ia32/usr/X11R6/lib

and ran ldconfig. Basically that’s it, now I could run BitchX from outside of the chroot with above command. However, things like the help files would be broken, so I threw in a few symlinks into the ia32 directory. I used a small perl script like such:

chroot /var/ia32 dpkg -L bitchx-ssl bitchx|perl -e 'while (<>) { chomp; print, print "\n" unless -e }'

This would spit out a list of all the files in dpkg’s file list for the package which do not exist outside the chroot; so if there was a line like

/usr/lib/bitchx

I simply cd‘d to /usr/lib and ln -s /var/ia32/usr/lib/bitchx — that would also take care of virtually every file below /usr/lib/bitchx from the script output.

I repeated that step until the output from the dpkg -L command was silent.

Now I can start BitchX in a 64bit linux and it will work as expected and without crashes; however, it will be the 32bit version.

Enjoy.