Changes

Jump to: navigation, search

32 bit chroot environment for Wine

495 bytes added, 1 year ago
Marked this version for translation
<translate>
<!--T:1-->
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.
<!--T:2-->
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.
<!--T:3-->
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 )
<!--T:4-->
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 <b>{{c|X redirection}}</b>.
<!--T:5-->
{{console|body=
$##i## mkdir ~/gentoo
$##i## wget <stage3_URL>}}
<!--T:6-->
Become root from now on, or else the stage3 won't decompress properly. Then follow the installation procedure according to the Gentoo manual.
<!--T:7-->
{{console|body=
$##i## sudo su
\##r####b##(chroot)##bl#####i## eselect profile list}}
<!--T:8-->
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.
<!--T:9-->
{{console|body=
\##r####b##(chroot)##bl#####i## eselect profile set 5 }}
<!--T:10-->
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.
<!--T:11-->
{{console|body=
\##r####b##(chroot)##bl#####i## emerge -avuDN @world }}
<!--T:12-->
Once done, set up <b>{{c|X redirection}}</b> in chroot so it displays the image on the host.
<!--T:13-->
On the host in another terminal:
<!--T:14-->
{{console|body=
$##i## xauth list }}
<!--T:15-->
will show you the "magic" cookie of your host display. Put it into .Xauthority on the chroot:
<!--T:16-->
{{console|body=
$##i## sudo xauth extract <path_to_chroot>/root/.Xauthority <hostname>/unix:0 }}
<!--T:17-->
...where <hostname> is the name of your host machine.
<!--T:18-->
<b>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.</b>
<!--T:19-->
Back to the chroot, and verify that the cookie is set correctly:
<!--T:20-->
{{console|body=
\##r####b##(chroot)##bl#####i## xauth list }}
<!--T:21-->
should show the same cookie as on the host.
<!--T:22-->
Next set the DISPLAY variable in chroot:
<!--T:23-->
{{console|body=
$##i## echo $DISPLAY }}
<!--T:24-->
should show ":0.0"
<!--T:25-->
{{console|body=
\##r####b##(chroot)##bl#####i## export DISPLAY=":0.0" }}
<!--T:26-->
You can add the above line to /etc/profile in Gentoo so it gets automatically set every time you enter the chroot.
<!--T:27-->
Verify that it works. In chroot run xcalc (you may have to install xcalc first), and it should display on the host.
<!--T:28-->
{{console|body=
\##r####b##(chroot)##bl#####i## xcalc }}
<!--T:29-->
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)
<!--T:30-->
{{console|body=
\##r####b##(chroot)##bl#####i## emerge wine }}
<!--T:31-->
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.
<!--T:32-->
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:
<!--T:33-->
{{file|name=/home/<username>/gentoo/chr.sh|body=
rm /home/<username>/gentoo/root/.Xauthority
env -i HOME=/root TERM=$TERM /bin/chroot . bash -l}}
<!--T:34-->
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.
<!--T:35-->
To get the (chroot)# prompt, you can add the line
<!--T:36-->
<b>export PS1="(chroot) $PS1"</b>
<!--T:37-->
at the end of your /home/<username>/gentoo/etc/profile file.
</translate>
[[Category:HOWTO]]
[[Category:Official Documentation]]
wiki-editors
658
edits

Navigation menu