PureOS + Buster 32bit HOWTO

Abstract

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

Instead of 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.

edit /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:
libgl1 (for libGL.so.1) and libopenal1 (for libopenal.so.1).

Install them:

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 :slight_smile:

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.

10 Likes

yes but sudo su first requires that the account you are using to issue this command from to be into the sudoers file … no? at least this is how it is on my machine …

good initiative for x86 arch …

Yes it does. And it is so by default on fresh PureOS install.

1 Like

Thanks @Dwaff for this. Good piece of information here.

2 Likes

:heart: :laughing: I love that aside type inline commentary.

1 Like

and HOWTO in CAPS … :smiley:

1 Like

@Dwaff
Hi Sir,
I try to install crossover 19.0.1
it needs i386 architecture
so i followed your instructions.
I wonder if you could please help with the following output from my terminal:

sherabk@sherab-VM-PureOS:~/Downloads$ sudo apt-get install ./crossover_19.0.0-1.deb 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'crossover:i386' instead of './crossover_19.0.0-1.deb'
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 crossover:i386 : Depends: libc6:i386 (>= 2.11) but it is not installable
                  Depends: libx11-6:i386 but it is not installable or
                           xlibs:i386 but it is not installable
                  Depends: libxext6:i386 but it is not installable or
                           xlibs:i386 but it is not installable
                  Depends: libxi6:i386 but it is not installable
                  Depends: libfreetype6:i386 but it is not installable
                  Depends: libpng12-0:i386 but it is not installable or
                           libpng16-16:i386 but it is not installable
                  Depends: libz1:i386 but it is not installable
                  Depends: libnss-mdns:i386 but it is not installable or
                           lib32nss-mdns:amd64 but it is not installable
                  Depends: libcups2:i386 but it is not installable
                  Depends: liblcms2-2:i386 but it is not installable
                  Depends: libglu1-mesa:i386 but it is not installable
                  Depends: libxcursor1:i386 but it is not installable
                  Depends: libxrandr2:i386 but it is not installable
E: Unable to correct problems, you have held broken packages.
sherabk@sherab-VM-PureOS:~/Downloads$ 

Many thanks in advance

My instructions allow for 32bit support, but they do not integrate it with apt. On the contrary, they work around package conflicts by installing 32bit libs inside a chroot.

So you can’t install 32bit debs on your main system. It will trigger a lot of conflicts, as you are seeing with crossover, and installation will fail.

But there is a way:

  1. Install crossover.deb inside a chroot. This will pull a whole lot of 32bit dependencies in.
  2. Download install-crossover-19.0.0.bin from codeweavers and run this one on the main system.

And there may be other gotchas. For example when setting up Neverhood, the setup program shows in advanced options that additional packages need to be installed:


Those two packages libsane and libxslt1.1 need to be installed inside the chroot, and the checkbox saying The following Unix pacakges… needs to be unchecked.

Other programs may of course need different extra packages. Everything 32bit must go into the chroot.

The Neverhood screenshot

That’s how it worked for me, with crossover trial version.

Hello.
Could you please give any advice, what can I do, if the file ‘‘ld-linux.so.2’’ already exists in /lib/ ?
Because in this case I can’t create a symbolic link to /srv/busteri386/lib/ld-linux.so.2 .
Thank you.

Interesting, looks like a left over from other attempts to run 32bit things. Does it belong to any package? Would you share what does dpkg -S /lib/ld-linux.so.2 says?

Anyway, if /lib/ld-linux.so.2 already exists, leave it alone. Things should work with it as well.

dpkg -S /lib/ld-linux.so.2 says:
libc6-i386: /lib/ld-linux.so.2

I opened the properties of the file /lib/ld-linux.so.2 in the file manager - it says, this is a link to /lib32/ld-linux.so.2.

This is in my main system.

I haven’t tried to install 32-bit things (like wine, crossover, playonlinux) in my main system yet.
But I tried to install them in a virtual machine. And I was not able to create a symbolic link to /srv/busteri386/lib/ld-linux.so.2, because the file /lib/ld-linux.so.2 already existed.
I did all other instructions ok, but the applications in crossover still didn’t work due to the lack of i386 packages.
They only started working after I deleted the existing file /lib/ld-linux.so.2 and created a new link to /srv/busteri386/lib/ld-linux.so.2 .
That’s why I’m not sure, if this will work in my main system, unless I create a new link to /srv/busteri386/lib/ld-linux.so.2 .

Fraqnkly, i know too litle aout ld-linux.so.2, but it seems you need the one from the /srv/busteri386/lib/ld-linux.so.2 .

libc6-i386 is not installed on my system. Wonder what did pull this in for you, because you’d better check if that is not broken by altering dynamic linker with /srv/buster-i386 stuff.

Do you think this approach can be adapted to provide support for wine32 Windows apps? I’m trying to install Metatrader4 on PureOS Byzantium but got stopped cold by 64bit only support for wine. I have configured the chroot as described in your initial post and also installed wine32 inside of the chroot. I’m unclear how to proceed.

When I try to launch the metatrader installer app via wine, I get the following warning at the terminal, and a pop-up error message by the installer, complaining that it needs Windows 10. I’ve actually installed Metatrader into Windows 7 wine profiles before, so I assume that’s being triggered by lack of 32bit wine support.

$ wine coinexx4setup.exe 
it looks like wine32 is missing, you should install it.
multiarch needs to be enabled first.  as root, please
execute "dpkg --add-architecture i386 && apt-get update &&
apt-get install wine32"

Screenshot from 2024-03-02 11-14-23

I then tried

$ sudo ln -s /srv/busteri386/lib/wine/wine /usr/lib/wine/wine
$ wine coinexx4setup.exe

and got

wine client error:0: version mismatch 595/571.
Your wine binary was not upgraded correctly,
or you have an older one somewhere in your PATH.
Or maybe the wrong wineserver is still running?

Wine version inside of Buster chroot is wine-4.0 (Debian 4.0-2), so that’s probably the issue. Maybe I can resolve by creating a Bullseye chroot instead and seeing if that offers the same wine 5.0.3 version in 32-bit.

1 Like

I resolved the wine32/64 version mismatch issue by creating a Debian Bullseye chroot installation and linking the libraries accordingly.

Terminal commands to setup Bullseye chroot with wine32

mkdir /srv/bullseyei386
debootstrap --arch i386 bullseye /srv/bullseyei386 http://deb.debian.org/debian
cp -r /usr/share/terminfo/ /srv/bullseyei386/usr/share/
chroot /srv/bullseyei386/
vi /srv/bullseyei386/etc/apt/sources.list
deb http://deb.debian.org/debian bullseye main
deb http://deb.debian.org/debian bullseye-updates main
deb http://deb.debian.org/debian-security bullseye-security main
apt update; apt upgrade -y; apt autoremove; apt install -y wine
exit chroot
cd /lib
ln -fs /srv/bullseyei386/lib/ld-linux.so.2 .
ln -fs /srv/bullseyei386/lib/i386-linux-gnu .
cp /srv/bullseyei386/etc/ld.so.conf.d/i386-linux-gnu.conf /etc/ld.so.conf.d/.
rm /etc/ld.so.cache 
ldconfig
cd /usr/lib/wine/; sudo ln -fs /srv/bullseyei386/lib/wine/wine .
1 Like