Install Box86 on Arm64


rna

Recommended Posts

Dear All,
I just want to make a Tutorial on my successful attempt in Installing Box86 on Arm64 and Install Wine X86 apps. In this example it is Sketchup 7.1 and Sketchup 8
But before starting I want to thanks to PtitSeb for his hard work to bring this dream into reality (running x86 apps on arm64 box).

My system is X96 Max+ S905x3. I used @balbes150 older image to boot to Armbian, many thanks for him. So In general every box running Armbian 64bit should work.

This tutorial will use debootstrap Debian Buster Armhf as base for chroot. The keyword is "Arm64" support "Armhf", therefore you do not need to use Qemu or Binfmt_misc as it is very slow. Here's my report on Manjaro Arm Forum: https://archived.forum.manjaro.org/t/x86-64-chroot-on-manjaro-arm-install-x86-64-deb-install-wine-windows-apps/150420/103

Here's what you need:

1. Open terminal, then type:

sudo apt install schroot debootstrap

sudo mkdir /srv/chroot

sudo mkdir /srv/chroot/debian-armhf

sudo debootstrap --arch armhf --foreign buster /srv/chroot/debian-armhf http://debian.xtdv.net/debian

sudo chroot "/srv/chroot/debian-armhf" /debootstrap/debootstrap --second-stage

2. Then add a config file for debian-armhf:

sudo nano /etc/schroot/chroot.d/debian-armhf.conf

Copy paste this code, and change <username> into your computer username

[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>

3. Then edit the nssdatabases

sudo nano /etc/schroot/desktop/nssdatabases

copy paste this code

# System databases to copy into the chroot from the host system.
#
# <database name>
#passwd
shadow
#group
gshadow
services
protocols
#networks
#hosts
#user

4. Edit the stateoverride, and change the first contrab to root

sudo nano /srv/chroot/debian-armhf/var/lib/dpkg/statoverride

copy paste this code

root root 2755 /usr/bin/crontab

5. Now you should be able to schroot by typing

sudo schroot -c debian-armhf

6. edit the bashrc

nano ~/.bashrc

add this code to the bottom of the line

export LANGUAGE="C"
export LC_ALL="C"
export DISPLAY=:0

7. let's restart chroot environment by exit and login again, then add a username that is similar to your main system username

exit

id

sudo schroot -c debian-armhf

adduser <username>

su - <username>

then again add bashrc

nano ~/.bashrc

again add this code to the bottom of the line

export LANGUAGE="C"
export LC_ALL="C"
export DISPLAY=:0

8. Then restart chroot by double exit and login again, then install the following package

exit

exit

sudo schroot -c debian-armhf

apt update && apt upgrade

apt install git wget cmake build-essential python3

apt install gcc-arm-linux-gnueabihf

9. Now let's compile the Box86 within Chroot environment

git clone https://github.com/ptitSeb/box86

cd box86

mkdir build; cd build; cmake .. -DARM_DYNAREC=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo; make

exit

10. Now login to chroot again then download wine from twisteros: https://twisteros.com/wine.tgz then extract it to your home folder. Your extracted wine location should be in: ~/wine/bin/wine

sudo schroot -c debian-armhf

wget https://twisteros.com/wine.tgz

tar zxvf wine.tgz

 11. Install Zenity in chroot environment, as wine will not have window without it:

apt install zenity

12. Exit from chroot environment by typing

exit

13. To install a windows app, in this case sketchup 7.1 and 8 you can download it from: http://www.oldversion.com/windows/google-sketchup/ then type:

schroot -c debian-armhf ~/box86/build/box86 ~/wine/bin/wine 'your/installation/folder/It/is/better/to/drag/and/drop/the/installer'

14. To run the installed program you can type this or make it as a shortcut from desktop launcher:

schroot -c debian-armhf ~/box86/build/box86 ~/wine/bin/wine your/installed/program/location

 

and here's my final sketchup running smoothly on LLVM Pipe Graphics. I also attached the Box86 running on Manjaro Arm with the good performance as well for addition.


To be honest, I didn't expect the performance to be this good. It almost remind me of "Rosetta 2" of Apple Silicon, but it is open source.

Big respect for PtitSeb for bringing this magic to the Arm64 World. I also want to thanks to Xabbu and Lolix from Manjaro Forum to help me figuring out the chroot environment in my older Manjaro Forum Post.
 

Hope that helps,

 

Many Thanks,

rna

 

56e96f7da3a28868ec8189028d28daa8083cf06a

0c35198dc0ccd3b3d883f3814f676814c8caffbe

 

a974692c2d3cd7ba5851af50237c8d886c81ff57

 

e10f85c1da28239431fbcf8dc40898e9ef5ee937

 

8d7749e9b9bc6c7639873c53f42736ae74e24b76
 

 
UPDATE 1
*IMPORTANT NOTE:

To fix Sketchup 7/8 OpenGL Display Error:

You have to edit the wine regedit and change the sketchup display setting from "0" to "1"

- Open Sketchup then close

- Open terminal then run regedit by typing:

schroot -c debian-armhf ~/box86/build/box86 ~/wine/bin/wine regedit

- Then find:
   HKEY_CURRENT_USER\Software\Google\SketchUp7\GLConfig\Display

- Then change the “HW_OK” from “0” to “1”

- Then close your regedit

- Then open Sketchup 7/8. Now you should be ok.


UPDATE 2

you can also follow the Box86 compatibility list here:
https://github.com/ptitSeb/box86-compatibility-list/issues

You can also use winetricks to install some dependency, like .NET 4.0 as detailed by WheezyE here:

https://github.com/ptitSeb/box86-compatibility-list/issues/46

In fact, by using WheezyE method I was able to install all depencencies to install sketchup 2014 successfully from winetricks in Armbian Reforge (Just to let you know that Armbian Reforge is embedded with Box86 by default).

 

However, at the moment winetricks does not works in our chroot method. Therefore, Help would be appreciated.

BONUS:
For those of you that desperately want to install blender 2.79 on Armbian Focal / Manjaro, you can use this method.

Open terminal, then type:

sudo schroot -c debian-armhf

apt install blender

exit

Now to open blender, you can use this command (you can also make launcher):

schroot -c debian-armhf blender

Now Blender 2.79b should run perfectly on you system

 

Link to post
Share on other sites
Donate and support the project!

On 12/27/2020 at 4:45 PM, markonmoto2 said:

I followed your guide and installed it (looks successfuly - i only opened steam installer with it without finilizing instalation) on Nanopi M4 running Manjaro ARM and except of using -DRK3399 compile parameter and installing debian-archive-keyring via pacman it went smoothly :)
thank for this guide !

Great, so happy to hear that it works. If you can test, maybe you could report some applications that work by using this method. So that we can have a list of x86 program than can run for the others. Many thanks

Link to post
Share on other sites

Thanks for this, it looks really nice and is easy to follow. Unfortunately, I have come across an issue in the very first step:

 

When I run 

~$ sudo debootstrap --arch armhf --foreign buster /srv/chroot/debian-armhf http://debian.xtdv.net/debian

 

I get this


mknod: /srv/chroot/debian-armhf/test-dev-null: Operation not permitted
E: Cannot install into target '/srv/chroot/debian-armhf' mounted with noexec or nodev

 

I have tried to do this: 

~$ sudo mount -o -i remount,exec,dev /srv/chroot/debian-armhf/

 

but I get this


mount: /srv/chroot/debian-armhf: permission denied.

 

I am on a Lenovo duet chrome book (Arm64, debian 10)

 

Can you help?

 

Link to post
Share on other sites
On 1/5/2021 at 1:31 AM, Le Raccoon said:

Thanks for this, it looks really nice and is easy to follow. Unfortunately, I have come across an issue in the very first step:

 

When I run 

~$ sudo debootstrap --arch armhf --foreign buster /srv/chroot/debian-armhf http://debian.xtdv.net/debian

 

I get this


mknod: /srv/chroot/debian-armhf/test-dev-null: Operation not permitted
E: Cannot install into target '/srv/chroot/debian-armhf' mounted with noexec or nodev

 

I have tried to do this: 

~$ sudo mount -o -i remount,exec,dev /srv/chroot/debian-armhf/

 

but I get this


mount: /srv/chroot/debian-armhf: permission denied.

 

I am on a Lenovo duet chrome book (Arm64, debian 10)

 

Can you help?

 

try to use Armbian Ubuntu Focal.

Link to post
Share on other sites

To fix Sketchup 7/8 Display Error:

 

You have to edit the wine regedit and change the display setting

1. Open Sketchup then close

2. Open terminal then run regedit by typing:

schroot -c debian-armhf ~/box86/build/box86 ~/wine/bin/wine regedit

3. Then find:
HKEY_CURRENT_USER\Software\Google\SketchUp7\GLConfig\Display

4. Then change the “HW_OK” from “0” to “1”

5. Then close your regedit

6. Then open Sketchup 7/8, you should be ok.

Link to post
Share on other sites

Box86 only supports 32bit, so Arm64 needs to install arm32 to work.

@rna in your case, you add a 32bit chroot env to run Box86, could you try add armhf architecture `sudo dpkg --add-architecture armhf` (I remember armbian already added armhf to arm64)

and repeat everything in armbian.

Link to post
Share on other sites
15 minutes ago, ning said:

in your case, you add a 32bit chroot env to run Box86, could you try add armhf architecture `sudo dpkg --add-architecture armhf` (I remember armbian already added armhf to arm64)

It didn't work, I came up with this tutorial because adding multi-arch simply does not make box86 works. You can also try it yourself.

I read somewhere that there are two versions of Arm64, one is compatible with multiarch 32bit, and one is not. But I don't know which one is armbian. But my trial attempts told me that Multi-Arch armhf does not works as expected in my box. There are many dependencies that are broken. even installing as simple as "0ad" armhf does not work.

Chroot 32bit is the solution for that. I personally contacted PtitSeb, the creator of Box86, and the advice was using a chroot for Arm64.

I would be very happy if multi-arch is working for Armbian, that would be my first option if it would be possible in the future.

Link to post
Share on other sites

Aditional steps for Tegra devices without armhf GPU driver (Jetson, Switch etc.) mount /tmp to chroot /tmp, install Xephyr and virglrenderer (recent versions are bugging out with xcb issues, use git checkout to one of November commits and compile working version) on host side and compile virgl mesa driver in chroot. .bashrc of chroot needs also DISPLAY set to :1 (or any port you want to use for Xephyr) and add this two lines
```export LIBGL_ALWAYS_SOFTWARE=1
export GALLIUM_DRIVER=virpipe```
Before you launching wine or any chroot app, you need to start ```Xephyr :1``` and ```virgl_test_server --use-glx```. I'm not sure if you need use Xephyr on Switch, but default xserver from L4T don't want to work for armhf apps.
On my Jetson Nano using jetson_clock gives nice performance boost.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...