Difference between revisions of "32 bit chroot environment for Wine/es"

From Funtoo
Jump to navigation Jump to search
(Created page with "De igual forma, puede utilizar un tarbal Funtoo 1.4 x86 stage3, sea una construcción genérica de 32 bits de https://www.funtoo.org/Generic_32 o una i686 de https://www.funto...")
(Created page with "Tome el control de root por ahora, de otra forma el stage3 no podrá extraerse correctamente. Luego, siga los pasos de instalación que le proporcione el manual de Gentoo.")
Line 12: Line 12:
$##i## wget <stage3_URL>}}
$##i## 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.
Tome el control de root por ahora, de otra forma el stage3 no podrá extraerse correctamente. Luego, siga los pasos de instalación que le proporcione el manual de Gentoo.


{{console|body=
{{console|body=

Revision as of 07:26, April 13, 2020

En Funtoo 1.4, las aplicaciones de 32 bits no pueden ser ejecutadas directamente, esto incluye a Wine de 32 bits. Sin embargo, Wine de 32 bits es necesario para ejecutar aplicaciones comunes de Windows. Existen varios métodos para utilizar aplicaciones x86 en un sistema "puro" de 64 bits como Funtoo 1.4. Puede utilizar contenedores LXD por ejemplo. Aquí documentaremos otra forma, una que ya se ha probado y funciona.

La idea es instalar una distribución Linux de 32 bits en un entorno al que se pueda acceder por chroot y redirigir su salida gráfica hacia el sistema anfitrión. Puede utilizar la distribución que le apetezca, pero en este ejemplo utilizaremos una instalación de Gentoo de 32 bits ya que es muy similar en uso e instalación con respecto a Funtoo.

Usted puede colocar el directorio de chroot donde lo prefiera, le sugerimos hacerlo dentro de su carpeta home. Descargue dentro de ese directorio el tarball "x86 Gentoo stage3" de http://distfiles.gentoo.org/releases/x86/autobuilds/current-stage3-i686/ (En el tiempo de esta edición, http://distfiles.gentoo.org/releases/x86/autobuilds/current-stage3-i686/stage3-i686-20191008T214502Z.tar.xz )

De igual forma, puede utilizar un tarbal Funtoo 1.4 x86 stage3, sea una construcción genérica de 32 bits de https://www.funtoo.org/Generic_32 o una i686 de https://www.funtoo.org/I686 luego, siga las instrucciones de instalación de la Guía de instalación y continúe más abajo en X redirection.

user $ mkdir ~/gentoo
user $ cd ~/gentoo
user $ wget <stage3_URL>

Tome el control de root por ahora, de otra forma el stage3 no podrá extraerse correctamente. Luego, siga los pasos de instalación que le proporcione el manual de Gentoo.

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.