Adding a 32bit runtime to UOS

AKA what happens when your OS is from one Debian like distribution and lags behind the rest of the world, but you want to run a parallel infastructure. Obviously for people who have sane setups their stuff is in sync and this doesn’t apply.

HOWEVER for people who use USO they will find out quickly that it’s a Debian derived MIPS64EL based distribution, but they don’t keep any MIPSEL (32bit) binaries. So I was thinking add in the dpkg arch, and some deb sources and I’d be good to go, right? Except the stuff is out of step so what happens is that UOS decides it wants to replace the OS with what is on the mipsel repos. Even when specfiying the arch’s directly.

deb [by-hash=force arch=mips64el] eagle main contrib non-free
deb [arch=mipsel] buster main contrib non-free

I tried.

So the good news is that I asked around and found a solution that I’d never heard of, “debootstrap”. The general page is here:

What it boils down to is that it’s a script set that will download enough DEB’s and extract them onto a directory and prep it out as a chroot/jail. And you can specify whatever architecture you want, you can even use qemu to run totally alien stuff! I’d never heard of this before, such a shame.

From my rough notes I did something like this:

/usr/sbin/debootstrap --arch mipsel buster /usr/local/mipsel

This will install the mipsel platform of Buster into /usr/local/mipsel

running the following gets me into the chroot/jail/container..

LANG=C.UTF-8 sudo chroot /usr/local/mipsel /bin/bash

YES it’s that simple! Although there is some house cleaning to be done:

apt install makedev
mount none /proc -t proc
cd /dev
MAKEDEV generic

Making the devices sure took long enough, but now I could do the regular update, add in some compilers and stuff, X11, and whatnot and get things going. Remember to mess around with xauth to get X11 forwarding from chroot working

Now for the ‘fun’ part of linking the libs…

ln -fs /usr/local/mipsel/usr/lib/mipsel-linux-gnu /usr/lib32
ln -fs /usr/lib32/ /lib/

Then you need to ‘config’ ld.config with

cat > /etc/

Phew we are almost there!

$ file /usr/local/mipsel/bin/dash
/usr/local/mipsel/bin/dash: ELF 32-bit LSB shared object, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked, interpreter /lib/, for GNU/Linux 3.2.0, BuildID[sha1]=22877e3a9a83675b22a121c9d2f8943d7339e7db, stripped
$ sudo ldconfig;/usr/local/mipsel/bin/dash

And just like that we now can run dynamically linked 32bit MIPSEL binaries on UOS.

As a bonus (from stackexcahnge) here is how to run Xauth to get forwarding from the chroot. From the ‘base’ physical machine run:

$ xauth list
latitude/unix:0  MIT-MAGIC-COOKIE-1  d4474d13c

Now with that cookie run this in the chroot:

# xauth add latitude/unix:0 MIT-MAGIC-COOKIE-1 d4474d13c
# xclock

and the 32bit Xclock should pop up on your 64bit desktop.

Wasn’t that fun?!

3 thoughts on “Adding a 32bit runtime to UOS

  1. Nice, I’ve never done any of that kind of thing under Debian! I’ve used Debian tools under Red Hat-based distributions though.

    Instead of running chroot directly, schroot is a tool that wraps it and offers nice things like an fstab-like file which says which host filesystems should be mounted inside the chroot (so you can have your home directory in there), hook scripts, etc. With what I seem to recall is the default setup, I find I don’t need to run xauth, just tell it to pass through environment variables using the -p option, because processes inside the chroot will be able to find the X server’s socket. I had to do a tiny bit of extra configuration to get sound working in the chroot though.

    Another interesting tool is rinse. It’s like debootstrap, but instead of installing a Debian-like distribution into a directory, it installs an RPM-based one. If you’re already on an RPM-based distribution it’s not all that useful though since the rpm and yum commands have chroot support built-in.

    • There is also a tutorial of sorts for this board of installing a base fedora, doing a rm -rf of the mounted root, and a debootstrap into the root to convert it to Debian by force.

      As much as I like UOS, it appears to be for government and military only. Sad, it’s really nice though

  2. I used debootstrap a lot all those years ago when i changed whatever annoying distro I was using over to Debian. A simpler process than the one you went through – I simply wanted to get Debian installed – but it was fun watching the “magic”.

Leave a Reply