The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.
Difference between revisions of "32 bit chroot environment for Wine"
(Marked this version for translation) |
|||
(14 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<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. | 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. | 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 ) | 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## cd ~/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. | 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--> | ||
$ sudo su | {{console|body= | ||
# tar xpf <stage3> | $##i## sudo su | ||
# cp /etc/resolv.conf /home/<username>/gentoo/etc | ###i## tar xpf <stage3> | ||
# mount -t proc none proc | ###i## cp /etc/resolv.conf /home/<username>/gentoo/etc | ||
# mount --rbind /sys sys | ###i## mount -t proc none proc | ||
# mount --rbind /dev dev | ###i## mount --rbind /sys sys | ||
# env -i HOME=/root TERM=$TERM /bin/chroot . bash -l | ###i## mount --rbind /dev dev | ||
# export PS1="(chroot) $PS1" | ###i## env -i HOME=/root TERM=$TERM /bin/chroot . bash -l | ||
(chroot)# emerge-webrsync | ###i## export PS1="(chroot) $PS1" | ||
(chroot)# emerge --sync | \##r####b##(chroot)##bl#####i## emerge-webrsync | ||
(chroot)# eselect profile list}} | \##r####b##(chroot)##bl#####i## emerge --sync | ||
\##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. | 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--> | ||
(chroot)# eselect profile set 5 }} | {{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. | 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--> | ||
(chroot)# emerge -avuDN @world }} | {{console|body= | ||
\##r####b##(chroot)##bl#####i## emerge -avuDN @world }} | |||
Once done, set up | <!--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: | 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: | 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. | ...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: | Back to the chroot, and verify that the cookie is set correctly: | ||
{{ | <!--T:20--> | ||
(chroot)# xauth list }} | {{console|body= | ||
\##r####b##(chroot)##bl#####i## xauth list }} | |||
<!--T:21--> | |||
should show the same cookie as on the host. | should show the same cookie as on the host. | ||
<!--T:22--> | |||
Next set the DISPLAY variable in chroot: | Next set the DISPLAY variable in chroot: | ||
{{ | <!--T:23--> | ||
{{console|body= | |||
$##i## echo $DISPLAY }} | |||
<!--T:24--> | |||
should show ":0.0" | should show ":0.0" | ||
{{ | <!--T:25--> | ||
(chroot)# export DISPLAY=":0.0" }} | {{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. | 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. | Verify that it works. In chroot run xcalc (you may have to install xcalc first), and it should display on the host. | ||
{{ | <!--T:28--> | ||
(chroot)# xcalc }} | {{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) | 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--> | ||
(chroot)# emerge wine }} | {{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 | |||
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}} | |||
<!--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:HOWTO]] | ||
[[Category:Official Documentation]] |
Latest revision as of 07:13, April 13, 2020
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.