LWN.net Logo

How to set up 32-bit support on Debian

How to set up 32-bit support on Debian

Posted Jun 17, 2004 1:17 UTC (Thu) by BrucePerens (guest, #2510)
Parent article: The 64-bit question

apt-get install debootstrap
mkdir /32
debootstrap sid /32
chroot /32
run 32-bit software.

Now, this can be made to run 32-bit executables without chroot. What we need to support that is for ld-linux.so to determine when it is being called from a 32-bit program. by reading its header, and transfer control to the 32-bit version. The 32-bit ld-linux.so would then prepend /32/ to all of the directories in the loader path.

Then, you would only have to chroot to run apt to update the 32-bit stuff.

This seems to be very viable, and should be done as a Debian package that sets up the proper environment and installs shell scripts to maintain it. A framable "Bruce Thinks You Rock" certificate will be awarded to the person who does this :-)


(Log in to post comments)

How to set up 32-bit support on Debian

Posted Jun 17, 2004 2:53 UTC (Thu) by ewen (subscriber, #4772) [Link]

Except that from within the chroot you can't access files that are outside the chroot (this being the raison d'etre of a chroot). So your 32-bit-program-in-chroot can't access, eg, your home directory. You can work around this by, eg, nfs mounting the relevant directories inside the chroot (or permanently locating them inside the chroot and symlinking from the outside in) but it can get to be non-trivial to maintain.

What might work better is a custom ld-linux.so which recognised 32-bit binaries and changed all their references to /lib, /usr/lib, etc to be references to /lib32, /usr/lib32, etc (in some cases just setting the library path for them may be sufficient).

Then all that would be needed is a dpkg modification (or a wrapper) that could intercept i386 library packages (ie 32-bit ones) as they were installed and put them into /lib32, /usr/lib32, etc. Plus perhaps some apt magic to allow installing both amd64 and i386 architecture packages on the same system.

FWIW, given Debian's release schedule -- roughly every 2 years or so now -- I suspect the problem will go away by itself before there's another (sarge+1) Debian release. So probably all that is needed is a simple-as-possible work around for use in Sarge.

Ewen

How to set up 32-bit support on Debian

Posted Jun 17, 2004 3:22 UTC (Thu) by busterb (subscriber, #560) [Link]

How about mount /home /32/home -obind; mount /proc /32/proc -obind ?
The bind option functions like a transparent symlink. Gentoo used to
recommend this during installation, which occurs in a chrooted
environment. You can do the same thing with other file systems or just
plain directories, like /var, /etc and /dev.

How to set up 32-bit support on Debian

Posted Jun 17, 2004 10:49 UTC (Thu) by stuart (subscriber, #623) [Link]

I read Bruce's post as wanting to remove the need to chroot an instead make ld.so smarter -- i.e. for a 32 bit binary pick the 32 bit libraries. This makes all your stated problems go away.

Stu.

How to set up 32-bit support on Debian

Posted Jun 17, 2004 21:06 UTC (Thu) by ewen (subscriber, #4772) [Link]

On re-reading Bruce's post I see that you are right -- he was suggesting that ld-linux.so should be doing library-path-modification (prepending /32). I was confusing it with other posts on this topic (eg, Debian mailing lists) where people were suggesting just running it in a chroot.

Bruce's approach (constant string prepended) is probably an easier hack than my approach (make ..../lib/... into .../lib32/...), and provides a more direct way to update the libraries (chroot /32; apt-get update && apt-get upgrade).

So it seems quite feasible.

Ewen

How to set up 32-bit support on Debian

Posted Jun 17, 2004 3:00 UTC (Thu) by jreiser (subscriber, #11027) [Link]

...ld-linux.so to determine when it is being called from a 32-bit program. by reading its header, and transfer control to the 32-bit version...

http://www.BitWagon.com/rtldi/rtldi.html seems to be a good start on that part.

How to set up 32-bit support on Debian

Posted Jun 17, 2004 5:20 UTC (Thu) by ncm (subscriber, #165) [Link]

John Reiser is always amazing. Thanks, John!

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds