Install bundled 32-bit system in 64-bit system - ArchWiki

# Install bundled 32-bit system in 64-bit system

This article is being considered for archiving.

Reason: https://www.archlinux.org/news/phasing-out-i686-support/ (Discuss in ArchWiki:Requests#Drop of i686 support)

This article presents one way of running 32-bit applications, which may be of use to those who do not wish to install the lib32-* libraries from the multilib repository and instead prefer to isolate 32bit applications. The approach involves creating a "chroot jail" to handle 32-bit apps.

## Installation

Install the arch-install-scripts package and create the chroot. Make sure to use a pacman configuration that does not use the `[multilib]` repository.

    # mkdir /opt/arch32
    # linux32 pacstrap -C path/to/pacman.conf -di /opt/arch32 base base-devel

### Settings

This article or section needs language, wiki syntax or style improvements.

Reason: "Key" configuration files is subjective (Discuss in Talk:Install bundled 32-bit system in 64-bit system#)

Key configuration files should be copied over:

    # cd /etc
    # for i in passwd* shadow* group* sudoers resolv.conf localtime locale.gen vimrc inputrc profile.d/locale.sh; do cp -p /etc/"$i" /opt/arch32/etc/; done

Remember to define the correct the number of MAKEFLAGS and other vars in `/opt/arch32/etc/makepkg.conf` before attempting to build.

## Configuration

    # linux32 arch-chroot /opt/arch32

Note: If access to the Xorg server of the host is required, allow it for a given user with `xhost +si:localuser:chroot_user`. See Xsecurity(7) for details.

It is recommended to use a custom bash prompt inside the 32-bit chroot installation in order to differentiate from the regular system. You can, for example, add a `ARCH32` string to the `PS1` variable defined in `~/.bashrc`.

## Schroot

Install schroot to the native 64-bit installation:

Edit `/etc/schroot/schroot.conf`, and create an [Arch32] section.

    [Arch32]
    type=directory
    profile=arch32
    description=Arch32
    directory=/opt/arch32
    users=user1,user2,user3
    groups=users
    root-groups=root
    personality=linux32
    aliases=32,default

### Using Schroot to run a 32-bit application

The general syntax for calling an application inside the chroot is:

    # schroot -p -- htop

In this example, htop is called from within the 32-bit environment.

## Troubleshooting

### Video problems

If you get:

    X Error of failed request: BadLength (poly request too large or internal Xlib length error)

while trying to run an application that requires video acceleration, make sure you have installed appropriate video drivers in your chroot.

### Sound in Flash

Install the alsa-oss package inside the chroot, and export the `FIREFOX_DSP` environment variable before launching Firefox:

    $ export FIREFOX_DSP="aoss"

Every chroot into the 32-bit system requires this environment variable.

For Wine this works the same way. The alsa-oss package will also install the alsa libraries required by Wine to output sound.

## Tips and tricks

### Java in a chroot

See Java. After installation, adjust the path:

    $ export PATH="/opt/java/bin/:$PATH"

### Allow 32-bit applications access to 64-bit PulseAudio

Additional paths have to be bind-mounted to the chroot environment:

    # mount --bind /var/run /opt/arch32/var/run
    # mount --bind /var/lib/dbus /opt/arch32/var/lib/dbus

Unmount them when leaving the environment:

    # umount /opt/arch32/var/run
    # umount /opt/arch32/var/lib/dbus

Optionally add the commands to the `/usr/local/bin/arch32` script after the other bind-mount/umount commands. See PulseAudio from within a chroot for details

### Sound in Firefox

Create `/usr/bin/firefox32` as root:

    #!/bin/sh
    schroot -p firefox $1;export FIREFOX_DSP="aoss"

Make it executable:

    # chmod +x /usr/bin/firefox32

### Printing

To access installed CUPS printers from the chroot environment, one needs to bind the `/var/run/cups` directory to the same (relative) location in the chroot environment.

Simply make sure the `/var/run/cups` directory exists in the chroot environment and bind-mount the host `/var/run/cups` to the chroot environment:

    # mkdir /opt/arch32/var/run/cups
    # mount --bind /var/run/cups /opt/arch32/var/run/cups

and printers should be available from 32-bit chroot applications immediately.

Category:

- Getting and installing Arch

Hidden categories:

- Pages flagged with Template:Archive
- Pages or sections flagged with Template:Style