Links

Box86

x86 emulator for arm(64)

Box86

Introduction

Running Linux version of Steam using box86 using chroot and install Wine. Note: Box86 uses sofware multithreaded-cpu based GPU emulation.
Parts of this guide are based on this article by rna from armbian forum https://forum.armbian.com/topic/16584-install-box86-on-arm64/

Setting up

1. Host side

We need debootstrap to create the chroot and schroot to enter the chroot. We need to install virgl-test-server to have GPU acceleration.
  1. 1.
    Install build dependencies
Ubuntu :
sudo apt update -y
sudo apt install -y git ninja-build python3 python3-pip libgbm-dev schroot debootstrap
python3 -m pip install --upgrade meson
Fedora:
sudo dnf install --refresh -y debootstrap schroot virglrenderer-test-server xorg-x11-server-Xephyr
  1. 1.
    Compile virgl-server and libepoxy (SKIP THIS STEP ON FEDORA)
# Build and install libepoxy
git clone https://github.com/anholt/libepoxy
cd libepoxy; meson -Dprefix=/usr build; ninja -j$(nproc) -C build; sudo ninja -C build install; cd ../
# Build and install virglrenderer
git clone https://gitlab.freedesktop.org/virgl/virglrenderer
cd virglrenderer; meson -Dprefix=/usr build; ninja -j$(nproc) -C build; sudo ninja -C build install; cd ../
  1. 2.
    Create chroot directory
sudo mkdir -p /srv/chroot/debian-armhf
  1. 3.
    Create an schroot config file for your debian-armhf chroot replace by your host username
sudo nano /etc/schroot/chroot.d/debian-armhf.conf
[debian-armhf]
description=Debian Armhf chroot
aliases=debian-armhf
type=directory
directory=/srv/chroot/debian-armhf
profile=desktop
personality=linux
preserve-environment=true
root-users=<username>
users=<username>
  1. 4.
    Edit nssdatabases
sudo nano /etc/schroot/desktop/nssdatabases
# System databases to copy into the chroot from the host system.
#
# <database name>
#passwd
shadow
#group
gshadow
services
protocols
#networks
#hosts
#user
  1. 5.
    Create the chroot using debootstrap
sudo debootstrap --include=nano,sudo,git,wget,mesa-vulkan-drivers,libglx-mesa0,libegl-mesa0,libgles2-mesa,libglapi-mesa,libgl1-mesa-glx,libegl1-mesa,zenity,nginx,xterm,ca-certificates,gnupg,libayatana-appindicator1,libnm0,libtcmalloc-minimal4 --arch armhf --foreign testing /srv/chroot/debian-armhf http://deb.debian.org/debian
  1. 6.
    Run debootstrap second stage
sudo chroot /srv/chroot/debian-armhf /debootstrap/debootstrap --second-stage
  1. 7.
    Prevent host home directory mounting
sudo nano /etc/schroot/desktop/fstab
# /home /home none rw,bind 0 0
And add or uncomment the following binds in the same file:
/run /run none rw,bind 0 0
/run/lock /run/lock none rw,bind 0 0
/dev/shm /dev/shm none rw,bind 0 0
/run/shm /run/shm none rw,bind 0 0
  1. 8.
    Before entering the chroot, start Xephyr and virgl_test_server in a separate terminal.
Xephyr -resizeable :2 & virgl_test_server --use-glx

2. Chroot side

Now you should be able to schroot by typing
sudo schroot -c debian-armhf
  1. 1.
    Edit the chroot's default environment. You are free to set another display number (DISPLAY=) for Xephyr (starting from :2 when using Xephyr).
nano /etc/bash.bashrc
Append the following variables at the end of the file then save:
export LANGUAGE="C"
export LC_ALL="C"
export DISPLAY=:2
export LIBGL_ALWAYS_SOFTWARE=1
export GALLIUM_DRIVER=virpipe
export STEAMOS=1
export STEAM_RUNTIME=1
  1. 2.
    Fix apt and install box86
apt update -y && apt -f -y install && apt upgrade -y
wget https://itai-nelken.github.io/weekly-box86-debs/debian/box86.list -O /etc/apt/sources.list.d/box86.list
wget -qO- https://itai-nelken.github.io/weekly-box86-debs/debian/KEY.gpg | apt-key add -
apt update && apt install -y box86
  1. 3.
    Before we proceed further in chroot, we need to copy binfmt.d config from chroot to host and restart systemd-binfmt to make box86 works automaticly with bash scripts that includes i386 files.
exit
sudo cp /srv/chroot/debian-armhf/etc/binfmt.d/box86.conf /etc/binfmt.d/box86.conf
sudo systemctl restart systemd-binfmt
  1. 4.
    Create your <username> and grant it sudo privileges
sudo schroot -c debian-armhf
echo "<username> ALL=(ALL:ALL) NOPASSWD:ALL" >> /etc/sudoers
useradd -u 1000 --shell /bin/bash -rmUG sudo,video,audio,render <username>
exit

Steam

Be sure that virgl-server is still running, then run :
schroot -c debian-armhf
wget https://steamcdn-a.akamaihd.net/client/installer/steam.deb
sudo apt install -y ./steam.deb
setarch -L linux32 steam -no-browser -noreactlogin -no-cef-sandbox steam://open/minigameslist
You should be able to run steam in the chroot using the following command : setarch -L linux32 steam -no-browser -noreactlogin -no-cef-sandbox steam://open/minigameslist

Wine

Regarding Wine we recommend to use this guide: https://github.com/ptitSeb/box86/blob/master/docs/X86WINE.md
Adding i386 arch and installing package traditional way can cause issues with native ARM64 GPU acceleration in system.
Every time you start app from this chroot you need to have Xephyr and virgl_test_server running with command from earlier. You can define Xephyr resolution with -display variable.
Last modified 1mo ago