clockworkpi

Installing Box86/Box64/Wine x86

Hey everyone, just wanted to make a small post about installing Box86,Box64,Wine x86 onto a fresh untouched Devterm A06 install (this might work for A04 or CM3, not sure). Box86 and Box64 are runtimes that let you run x86 and x64 Linux architecture programs under ARM, most notably a lot of games that look really rad on this machine. Wine is a runtime that lets you run Windows programs on Linux, to various degrees. I’ve been at this for about a week and wanted to share my findings and save some of you guys the headaches I ran into figuring out how to install this stuff.

  1. Clone the armbian gaming install script to a download folder or something and run the script
git clone https://github.com/NicoD-SBC/armbian-gaming
/bin/bash ./armbian-gaming.sh
  1. Run option 1, “install all”, it should take care of all dependencies

If you don’t care about running Windows Apps with Wine you can stop here.

  1. Download wine from Wine - Browse /Slackware Packages/5.13/i686 at SourceForge.net
    Unarchive and copy the content of /wine-5.13-i686-1sg/usr/ folder to ~/wine/

  2. Download and install latest winetricks

cd ~/Downloads && wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks
sudo chmod +x winetricks && sudo mv winetricks ~/wine/      
  1. Install a few more useful dependencies
sudo apt-get install libncurses5 libncurses5:armhf libxslt1.1:armhf winbind
  1. Setup wine for the first time
wine wineboot
  1. Install some additional dependencies in wine such as Visual C++ runtime and Dotnet2.0
    // NOTE: you can also edit the /usr/local/bin/winetricks launch script and remove ‘box86’ if you want it to run without the BOX86_NOBANNER=1 which needs to be run everytime
BOX86_NOBANNER=1 winetricks -q corefonts vcrun2010 dotnet20sp1

And you’re done! With this you should be able to run any x86 or x64 program just by running it in terminal, it will automatically detect which architecture it is and run Box86 or Box64 appropriately.

Some recommended Linux version of games I got to run, for an idea of the range of games that you should be expected to be ‘able’ to run:
Dwarf Fortress (Linux x64)
Brogue CE (Linux x64)
Loop Hero (Linux x64)
TIS-100 (Linux x86)
Cataclysm Dark Days Ahead (Linux x64)
Shovel Knight (Linux x64, iffy performance)
Mixolumia (Linux x64)
Bada Is You (Linux x64)

DwarfFortressDevterm
loopheroDevterm

Unfortunately I have not really been able to get Wine to run anything really well, a lot of times won’t even boot but I still included it as part of this tutorial so maybe someone else can figure it out or maybe comment on if I didn’t install something correctly. If I find out anything else I will update more details here. Good luck and have fun!

FAQ:
I can’t get this program to run?
Always check the error messages if you have any missing dependencies and make sure they are installed under the correct architecture. e.g. If you try to run a game that’s x86 and it outputs that you’re missing say libsdl2-2.0.o or something, install that, and make sure you install it as say libsdl2-2.0:armhf. If it’s under x64 you install it with just libsdl2-2.0.

All the dependencies seem to be installed correctly, it still doesn’t run! (either an error loading the lib, or nothing happens)
Box86 and Box64 are both works in progress, that said a lot of libs have not been wrapped yet and will not run (e.g. GTK support on box64, libxkbcommon on box86, etc.). You can go in depth a bit more with extra logging by using BOX86_LOG=2 or BOX64_LOG=2 before you run the program to be more sure about what is error-ing out. Do check the issues on the git repos for more information or please report any issues you might find.

I got the program to run and it’s super slow.
Unfortunately there’s a few explanations for this, and it also depends on the game. Naturally you won’t be able to run Cyberpunk or even Fallout 3, so you’ll have to temper your expectations. Also be wary of your current CPU/GPU frequency settings (DevTerm A-06 core CPU frequency scaling) Usually I run programs in the 5th gear which enables only the A72 CPUs on and then go into the CPU GUI manager to turn it up to 1800MHZ with performance mode governor. Apparently when any of the first 4 slower CPUs are on, those will take priority and use those and you’ll get lower FPS. Oddly enough though even in best case scenarios so far I haven’t been able to play anything more than 30fps so there might be some weird cap somewhere. There are several Youtube videos showing examples of games running straight up 1080p 60fps on RK3399 hardware so it’s definitely possible but will take a bit more investigation. I feel it might have something to do with drivers/CPU/GPU settings but I’m not sure. Best case would be if we can install TwisterOS on this.

Does this setup have DXVK support?
This does NOT have DXVK support right now on Box86 or Box64. DXVK which is a Vulkan based implementation of D3D9 and D3D11 for Wine. Unfortunately it does not work and trying to install it will absolutely break a bunch of things. You can try to get those two running with the native wine implementations by running wine winecfg and adding it in the libraries tab.

Does Steam work on this setup?
Although it is ‘technically’ possible and absolutely runs on other RK3399 setups (TwisterOS, etc.), however I couldn’t get it to run at least with this setup. There were a lot of weird dll issues, I’m still looking into trying to get it to run and there’s most likely something I’m forgetting to install. If you can get it to run please mention it here! All the earlier mentioned games that I got to run are also all running DRM free either from GoG or itch.io so do keep that in mind.

Shout out to the ptitSeb and the rest of the Box86/Box64 teams, you can check out the repos for more help/issues here:

There is also a pretty active discord with a lot of people who know way more about this stuff than I do:

Also to NicoD-SBC for his install script as well as youtube video explanation:

8 Likes

yo. thank you so much. this will help an untold amount of people out.

Thanks so much for sharing this! It’s one of the main reasons I decided to get an A06. Box86 (an older version – I know there’s been a lot of work since then which I haven’t tried) ran on the GameShell, but not particularly well. It was great for simple indie games though.

I’m curious if you had many issues with the resolution of the display. Does box86/64 scale the games itself, or do they have to be able to support 1280x480 themselves? What resolution were you using in game? I’m glad to see the screens are scaled and centered though. I’m guessing anything with lots of text or small fonts may not work well? I figured that would be the main issue, since the DevTerm should have enough power to run most stuff that was compatible, even if seeing it was a challenge.

1 Like

You’ve probably already seen this but the games mentioned as working in this thread are likely to work on the DevTerm. The details and options have almost certainly changed but it might be useful for identifying games to try. Some.were freely available to download.

Have you tried any games with an external monitor connected? That might help in terms of higher resolution, though I’m guessing there may be a performance hit.

1 Like

I managed to get my DevTerm (CM3) running Steam by installing it from the Pi-Apps store but I never could get Terraria installed because I think I broke the WiFi antenna when making it and the device always freezes when attempting to download (via USB WiFi card). I might try an Ethernet adapter but I still don’t have high hopes.

So far have had a tough time getting any DirectX game running through Wine on the Devterm A06, and I’ve tried a couple things, like setting MESA_GL_VERSION_OVERRIDE or building mesa and libdrm from source (with the panfrost drivers enabled in flags). Kept getting eitherGLXBadFBConfig or just a page fault from wine. It’s weird, seeing as some other SBC’s running RK3399 seem to not have this issue.

Is there some other way I can troubleshoot this?

EDIT: I remembered when testing some other games via Box86/Box64, Godot games for Linux would also throw the GLXBadFBConfig error and fall back to GLES2. Wonder what’s up with that…

2 Likes

Something I noticed that might help others… When following the instructions @lethardicus posted, either reboot afterward, or run the following command:

sudo systemctl restart systemd-binfmt

Otherwise, the system won’t be able to recognize x86/x64 binaries and won’t run them.

I tried setting up wine, and all went well, but this command didn’t work:

cpi@clockworkpi-a06:~$ BOX86_NOBANNER=1 winetricks -q corefonts vcrun2010 dotnet20sp1`
Error: reading elf header of /home/cpi/wine/winetricks, try to launch natively instead
/usr/local/bin/winetricks: line 2: 15387 Segmentation fault      env BOX86_NOBANNER=1 box86 $HOME/wine/winetricks "$@"

Weird thing is, (non windows) x86 and x64 programs I’ve tried have been working. And some simple Windows programs have been working via wine too.

That command didn’t work for me either, but I was able to open winetricks and install those apps manually.

1 Like

How did you launch it? When I try running it, I get a seg fault.

cpi@clockworkpi-a06:~$ winetricks
Error: reading elf header of /home/cpi/wine/winetricks, try to launch natively instead
/usr/local/bin/winetricks: line 2: 3431 Segmentation fault env BOX86_NOBANNER=1 box86 $HOME/wine/winetricks “$@”

I’m seeing a lot of the GLXBadFBConfig errors preventing programs from working too. I did some poking around and found this thread which offers a solution, of sorts, although it doesn’t really make anything usable:

If I use LIBGL_ALWAYS_SOFTWARE=1 I get a display, but it’s horribly slow since it’s rendering everything via software. It does actually work though, and I guess could be used to check if the application is failing because of this mesa bug, or if it’s got other issues.

As a means of testing, I’ve been using commands like:

LIBGL_ALWAYS_SOFTWARE=1 wine explorer /desktop=windows,640x480 application.exe

or

LIBGL_ALWAYS_SOFTWARE=1 wine explorer /desktop=windows,1280x480 application.exe

The MESA_GL_VERSION_OVERRIDE=4.6 never worked for me, but I’ve seen it mentioned a lot too in my searching.

I’ve also found a workaround for Steam using steamcmd. Usually it’s meant to be for installing dedicated game servers, but you can use it with your Steam login info to install a game without needing the Steam UI.

More info here:
https://developer.valvesoftware.com/wiki/SteamCMD

I’ve been using something like the following. I get the game’s steamid from either https://steamdb.info/ or the URL for the game on Steam.

(all one line)

./steamcmd.sh +@sSteamCmdForcePlatformType windows +force_install_dir /home/cpi/steam/yourgame/ +login username password +app_update steamid validate +quit

I’ve gotten these running, with Boson X being the best one by far. It looks gorgeous fullscreen on the DevTerm, and it plays well too! It and Cheap Golf are not free (they’re really cheap though), and 1982 is free. Cheap Golf starts off terribly slow, but if you press “s” twice to turn the shader off, it runs full speed. Unfortunately it doesn’t save that setting so you have to do it every time.

I apologize for missing this for a while. Unfortunately I’m not sure why you’d be getting that segfault since you seem to have the NOBANNER environment variable set up correctly.

As an aside (that may help with your issue,) newer versions of box86 are improving rapidly when building from source from the box86 github. I recommend trying them out, they’ve fixed a lot of issues for me.

And, the SteamCMD tip is a great idea that I’m looking forward to trying out!

1 Like

If you installed with the armbian gaming script first, did you just do builds of box86 from the latest source on github and then replace the binaries? I have to admit, I never looked into the details of what that script was doing and just assumed it was a grabbing the latest code and never even considered how to update it later. Is the best thing to start from scratch from a clean OS image and set it up manually, ignoring the script entirely, or were you successful in updating (after manually building) on top of the script install?

I may at least reinstall winetricks and/or try to reinstall the wine component too. Clearly something is wrong with my install since winetricks is broken.

I initially installed from the script above, but have had no issues updating each of its components individually over time. A new box86/64 install just overwrites the previous one. (ptitseb provides compile instructions for the A06’s RK3399, it’s super easy to do.)

I had some issues with wine at first when following the exact procedure of the tutorial, and have had more success with the newest version from the same sourceforge above.

1 Like

I installed using the armbian-gaming script, but I am not familiar with how to actually run programs that have the ‘.x86_64’ file extension. Is this possible?

I built box86 and box64 and installed them over the previous version, and I replaced my wine components with the ones from the latest (7.0 RC4). Unfortunately, I still got the segfault when I ran winetricks. I even grabbed a new copy of winetricks (in case the other was somehow corrupt), but that didn’t help. I took a closer look at the winetricks script and it mentioned near the top that there were dependencies to install, so I did that manually in case I was missing something, but it didn’t affect the segfault.

sudo apt install aria2 binutils cabextract fuseiso p7zip-full policykit-1 tor unrar unzip wine xdg-utils xz-utils zenity

Not sure I should be installing wine like that, but it and a few other things were missing and got installed.

But I realized I CAN run winetricks if I go to ~/wine and run

./winetricks

I also managed to install the windows components mentioned above by running

BOX86_NOBANNER=1 ./winetricks -q corefonts vcrun2010 dotnet20sp1

Though it did hang several times with a warning, saying it would hang until all wine processes in prefix=/home/cpi/.wine terminated. So to get past that (after waiting a bit), I manually killed the wineserver -w process and the script continued.

Speaking of scripts, I think the segfault problem was caused by the contents of the wineserver script in /usr/local/bin:

#!/bin/bash
env BOX86_NOBANNER=1 box86 $HOME/wine/winetricks “$@”

I’m guessing that was created by the armbian-gaming script, but I think there’s an error there. I don’t think it should have “box86” on that line since it would be trying to run the script through box86, which doesn’t make any sense. If I remove that, it would just function as a wrapper that would include that environment variable, which I think is what we want.

I didn’t really see any differences with the newer box86/64 binaries, with the exception of one game that used to run and now doesn’t. I haven’t done much testing yet though. And I’m curious to see if the winetricks script changed anything for the better. Seems weird to me that I’m having to kill the wineserver every time the script runs it, but that’s moving things along, so hopefully this will work.

Hello.
I followed the instruction from top post.
DevTerm A06.
I successfully (or so it seemed) finished steps 1 to 5.
I fail at step 6:
wine wineboot fails.
Actually any call to wine fails

6.b:~> wine wineboot
Box86 with Dynarec v0.2.5 bd5c8fd4 built on Jan  8 2022 12:58:44
Error: loading needed libs in elf /home/b/wine/bin/wine
6.b:~> ls -l /home/b/wine/bin/wine
-rwxr-xr-x 1 b b 9708 Jan  8 13:33 /home/b/wine/bin/wine
6.b:~>

As seen above /home/b/wine/bin/wine that is complained above does exist but something wrong.
Yes, on my system ~ is /home/b because I changed my username and home folder since beginning.

I don’t know how to continue.

Edited to add:
I also noticed that after doing this the sound output no longer works. I don’t hear anything.
I had to revert to a previous state from the SD card backup image I made before this.

Doare you able to play games with the integrated gamepad? I’ve succesfully run some games and in the logs the devterm controller appears but is not functional in game