Getting around x64 flaws through chroot to a x86 installation

As mentioned before, 64 bit Linux distributions have some flaws regarding 32-bit-only third party software like browser plugins, multimedia players and so on. This especially applied to Debian and therefore Ubuntu, who does not provide a complete set of 32 bit libraries as e.g. SuSE does.

A subarticle "Basis für Entwickler" on page 115 of issue 2008/8 of german magazine c't suggested that chroot-ing to a complete 32 bit  installation gives you complete access to any 32 bit stuff. (The main article starts on page 112 and is titled "Höhen und Tiefen").

Today I followed this path, extended the list of --bind mounts, and created this script which provides easy entering of such an environment for non-root users (withsudo permission):

#!/bin/sh
for D in dev home proc root sys tmp
do
  mount |grep /ubu32/$D >/dev/null || sudo mount --bind /$D/ /ubu32/$D/
done
sudo setarch i686 chroot /ubu32/ su - $USER

I stored this script as /usr/local/bin/cr32.
To ease the usage of X11 programs, you might include something like this in your ~/.profile or ~/.bashrc script:

MYARCH=$(uname -a |awk '{print $12}')
if [ "$MYARCH" = "i686" ]
then
  echo "Welcome chrooted to your 32 bit installation"
  export DISPLAY=:0.0
fi
 

So after all I have a 64 bit installation using all my RAM and I still can use all the gimmicks that are only provided for 32 bit environments!

 


From: IBCL BLog.
Originally posted: 2008-07-19