PureOS support for running i386 binaries is broken by the absence of i386 architecture in the distribution. This can be worked around in the following fashion:
- Install Debian buster (i386 architecture) inside the chroot
- Configure dynamic linker to look for shared libraries also in the chroot
- Leverage the chroot environment to install all needed shared libraries and keep them updated.
The gory details follow.
1. setup a chroot
Launch terminal, get root by
sudo su, and do:
root@ayers2:~# apt-get install debootstrap root@ayers2:~# mkdir /srv/busteri386 root@ayers2:~# debootstrap --arch i386 buster /srv/busteri386 http://deb.debian.org/debian
You may want to use another debian mirror
http://deb.debian.org/debian, you may want to use another mirror. It might be faster. Refer to Debian mirror list or use
netselect-apt. Be careful with
netselect-apt though, as it will happily overwrite
/etc/apt/sources.list if you don’t tell it to write the result somewhere else.
/srv/busteri386/etc/apt/sources.list so it contains:
deb http://deb.debian.org/debian buster main deb http://deb.debian.org/debian buster-updates main deb http://deb.debian.org/debian-security buster/updates main
Make sure the chroot is up to date
root@ayers2:~# chroot /srv/busteri386 root@ayers2:/# apt-get update root@ayers2:/# apt-get upgrade root@ayers2:/# exit
2. Configure dynamic linker
The magic commands are:
root@ayers2:~# cd /lib root@ayers2:/lib# ln -s /srv/busteri386/lib/ld-linux.so.2 . root@ayers2:/lib# ln -s /srv/busteri386/lib/i386-linux-gnu . root@ayers2:/lib# cd root@ayers2:~# cp /srv/busteri386/etc/ld.so.conf.d/i386-linux-gnu.conf /etc/ld.so.conf.d/. root@ayers2:~# rm /etc/ld.so.cache root@ayers2:~# ldconfig
And that is it. The core support for i386 applications is installed.
3. Example usage: make Drox Operative game run.
This game is simple to setup because it consists of single executable.
First step is to enumerate missing shared librarires:
dwaff@ayers2:~/games/drox/Drox-Operative$ ldd DroxOperative | grep 'not found' libGL.so.1 => not found libopenal.so.1 => not found
Next, find out which packages they are in. Go to https://www.debian.org/distrib/packages#search_contents, enter
libGL.so.1 in the keyword field, choose distribution stable, architecture 32-bit PC (i386), click search. Repeat for the other library. In this example case the packages in question are:
dwaff@ayers2:~/games/drox/Drox-Operative$ sudo su root@ayers2:/home/dwaff/games/drox/Drox-Operative# chroot /srv/busteri386 root@ayers2:/# apt-get install libgl1 libopenal1 root@ayers2:/# exit root@ayers2:/home/dwaff/games/drox/Drox-Operative# exit
The game now can be run. Screenshot or it did not happen
4. Keeping chroot up-to-date.
I have no good solution for this part. For now, I enter the chroot when I remember it and do
apt-get update; apt-get upgrade in there. I’m looking for suggestions how to plug that into the Gnome Software, so it does that for me automatically.