The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.
32 bit chroot environment for Wine
In Funtoo 1.4, 32-bit applications cannot run directly, including 32-bit Wine. However, 32-bit Wine is required to run legacy Windows applications. There are several methods for using x86 applications on a "pure" 64-bit system such as Funtoo 1.4. You can use containers like LXD for instance. Here is another method, which I have tested and works.
The idea is to install a 32-bit Linux distribution in a chroot-ed environment, and redirect its graphical output to the host system. You can use the distribution of your choice, but in this example I use 32-bit Gentoo as it's quite similar to install and use to Funtoo.
You can put the chroot folder anywhere you want, but I think it's a good idea to put it in your regular user's home directory. Download in that folder a x86 Gentoo stage3 tarball from http://distfiles.gentoo.org/releases/x86/autobuilds/current-stage3-i686/ (at the time of this article's creation, http://distfiles.gentoo.org/releases/x86/autobuilds/current-stage3-i686/stage3-i686-20191008T214502Z.tar.xz )
Alternatively, you can use a Funtoo 1.4 x86 stage3, either a generic 32-bit from https://www.funtoo.org/Generic_32 or a i686 one https://www.funtoo.org/I686 then follow standard installation instructions in the Funtoo installation guide then resume below at X redirection
.
user $ mkdir ~/gentoo user $ cd ~/gentoo user $ wget <stage3_URL>
Become root from now on, or else the stage3 won't decompress properly. Then follow the installation procedure according to the Gentoo manual.
user $ sudo su root # tar xpf <stage3> root # cp /etc/resolv.conf /home/<username>/gentoo/etc root # mount -t proc none proc root # mount --rbind /sys sys root # mount --rbind /dev dev root # env -i HOME=/root TERM=$TERM /bin/chroot . bash -l root # export PS1="(chroot) $PS1" (chroot)# emerge-webrsync (chroot)# emerge --sync (chroot)# eselect profile list
and select a desktop profile. For me it was #5, default/linux/x86/17.0/desktop (stable). The desktop profile brings in Xorg which will be needed later for wine anyway.
(chroot)# eselect profile set 5
Edit make.conf to add the correct MAKEOPTS ("-j7" worked for me) then do a world update, and go do something else for a couple of hours.
(chroot)# emerge -avuDN @world
Once done, set up X redirection
in chroot so it displays the image on the host.
On the host in another terminal:
user $ xauth list
will show you the "magic" cookie of your host display. Put it into .Xauthority on the chroot:
user $ sudo xauth extract <path_to_chroot>/root/.Xauthority <hostname>/unix:0
...where <hostname> is the name of your host machine.
NB: when you log out of your host then log back in, the cookie changes so you will have to redo the line above, or X redirection will stop working.
Back to the chroot, and verify that the cookie is set correctly:
(chroot)# xauth list
should show the same cookie as on the host.
Next set the DISPLAY variable in chroot:
user $ echo $DISPLAY
should show ":0.0"
(chroot)# export DISPLAY=":0.0"
You can add the above line to /etc/profile in Gentoo so it gets automatically set every time you enter the chroot.
Verify that it works. In chroot run xcalc (you may have to install xcalc first), and it should display on the host.
(chroot)# xcalc
If no errors, emerge wine in the chroot and configure it. You should have a 32-bit wine now, ready to run 32-bit Windows binaries (minus configuring, figuring out missing libs etc - but this is beyond the scope of this writeup)
(chroot)# emerge wine
Final size of the chroot Gentoo on my disk was close to 4.5GB. Of course you can use the chroot x86 Gentoo/Funtoo for other things that require a 32-bit environment, not only Wine.
And a final trick. Once you have everything setup, if you know how to use shell scripts you can automate the process of setting the cookie and entering the chroot. For instance I use a script that I put in ~/gentoo:
/home/<username>/gentoo/chr.sh
rm /home/<username>/gentoo/root/.Xauthority
xauth extract /home/<username>/root/.Xauthority <hostname>/unix:0
mount -t proc none proc
mount --rbind /sys sys
mount --rbind /dev dev
env -i HOME=/root TERM=$TERM /bin/chroot . bash -l
Replace <username> with your user name, and <hostname> with your machine's name. By executing that script as root from the ~/gentoo directory it automatically sets the cookie and enters the chroot.
To get the (chroot)# prompt, you can add the line
export PS1="(chroot) $PS1"
at the end of your /home/<username>/gentoo/etc/profile file.