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] https://professional-packages.chinauos.com/desktop-professional eagle main contrib non-free
deb [arch=mipsel] http://deb.debian.org/debian buster main contrib non-free
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 http://deb.debian.org/debian
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
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/ld.so.1 /lib/ld.so.1
Then you need to ‘config’ ld.config with
cat > /etc/ld.so.conf.d/mipsel-buildroot.conf
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/ld.so.1, 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
and the 32bit Xclock should pop up on your 64bit desktop.
Wasn’t that fun?!