Installing wine on Jetson Nano

Right now I’m trying to install Wine so it will run with Metatrader 5. Following messages come up:

pc1@pc1-desktop:~$ sudo apt-get install --install-recommends winehq-stable
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package winehq-stable

Please help regard this thanks.

Have you confirmed the winehq-stable is able to support and run on arm system?
I can’t find the compatible version.

This post mentions getting running MetaTrader 4 for Windows x86 in Linux with ARM CPU.

But when I actually tried it myself on Jetson Nano, it did not work. This is how to install wine and windbind:

sudo apt -y install wine-development winbind

And when I tried to run MetaTrader installer, I got the error:

0009:err:process:create_process L"F:\\home\\lissanro\\Downloads\\icmarkets5setup.exe" not supported on this installation (x86_64 binary)
wine: Bad EXE format for F:\home\lissanro\Downloads\icmarkets5setup.exe

The same thing happens with x86 binary:

0009:err:process:create_process L"F:\\home\\lissanro\\Downloads\\icmarkets4setup.exe" not supported on this installation (x86 binary)
wine: Bad EXE format for F:\home\lissanro\Downloads\icmarkets4setup.exe.

This is expected, to be honest I was surprised that the author of the article was able to run it that simple. Either Raspberry Pi comes with special version of Wine with built-in emulation (but the author did not mention this and claimed it should work on any ARM platform) or the post linked above is fake.

Here is another post which describes steps how to get x86 emulation working for Wine, this post is Raspberry Pi specific but it can be used as reference to achieve something similar on Jetson Nano:

It is not going to be easy though. To make things more complicated, MetaTrader 5 is usually offered as x86_64 executable, so x86 emulation is not going to be enough.

So this is from Metatrader 5 website. It’s instruction to install on Linux instead of Ubuntu, but it seems like it’s the same thing.

MetaTrader works fine in Linux/Ubuntu with amd64 CPU, the issue is to install and run it in Linux with arm64 CPU. It is completely different CPU architecture, and as far as I know there is no MetaTrader build for arm64 version of Windows, so it will not run with just Wine alone on Jetson Nano, it needs amd64 emulation. There is also a possibility to get ARM version of Windows running in qemu, it includes amd64 emulation: Introducing x64 emulation in preview for Windows 10 on ARM PCs to the Windows Insider Program | Windows Insider Blog. I did not test it myself, but here you can find more information how to get ARM version of Windows working in Jetson Nano with qemu if you decide to go this route:

Another way, is to use qemu to run amd64 chroot Linux environment with Wine, and use that to run MetaTrader (I already provided a link in the previous post to a tutorial which describes how to achieve this, but you need amd64 emulation instead of x86 if you want to run MetaTrader 5). This way may consume less RAM than running whole Windows just to run MetaTrader.

I run into this. I don’t know if any helpful. I’m trying this today.

If it does work, I’ll run it with Kubernete MS Azure DevOP, along with TensorFlow. Wish me luck.

Since the description does not mention anything about amd64 emulation on ARM platform, it probably will not run on Jetson Nano. However, if you setup amd64 chroot with qemu first, and then run the container there, it may work.

Hi Lissanro, can you show me how to setup amd64 chroot with qemu? Thank you.

I really need help with this. If anybody can help please do thank you. I try to install wine/wine32 but it doesn’t install. When I type ‘yes’ under the last command a infinite vertical column of ‘y’ comes up. Please help thanks.

When I try sudo apt-get wine32 following happens:

Nano don’t have correct CPU architecture to use Wine with just installing it. You can try to run it using armhf chroot and box86 or qemu and i386/amd64 chroot. First option is faster, but less stable and compatible so metatrader may crash, second one is slower.

Thank you for replying Maciek. I’ve tried qemu but it doesn’t work.


when I type ‘yes’ after prompt following happens

when I type sudo apt-get install qemu this happens:

please help thanks.

Sorry, I just noticed your message yesterday since I did not visit the forum for a while. I already gave you a link how to setup chroot in one of my previous messages and how to build and install qemu. But it may be difficult to follow and adapt commands to your needs if you are not very familiar with Linux and Ubuntu.

By the way, it does not make sense to run apt or apt-get without sudo when running as non-root user. It looks like you already installed qemu, but you used prebuild qemu from Ubuntu 18 - old qemu will not work neither for wine in chroot nor for Windows. So you may want to remove it.

I wrote below instructions specific for Jetson Nano. There is still a chance you can encounter unexpected errors, if so please let me know.

The commands below will use precompiled qemu 6.0.0 deb. If you prefer to compile it yourself, this is how I did it: Compile and install qemu 6.0.0 on Jetson Nano - Pastebin.com.

cd /tmp/ \
&& wget -c http://dragon.studio/2021/05/qemu-user-static_6.0.0_arm.deb http://dragon.studio/2021/05/qemu-binfmt-conf.sh http://dragon.studio/2021/05/qemu-debootstrap \
&& sudo chmod +x qemu-binfmt-conf.sh qemu-debootstrap \
&& sudo cp -a qemu-binfmt-conf.sh qemu-debootstrap /usr/local/bin/ \
&& sudo apt-get remove \*qemu\* \
&& sudo apt install ./qemu-user-static_6.0.0_arm.deb
&& sudo apt -y install binfmt-support debootstrap binutils ubuntu-dev-tools \
&& cd /usr/bin/ \
&& sudo rm -f qemu-*-static \
&& for exe in qemu-*; do sudo ln "$exe" "$exe-static"; done

If you choose to install precompiled deb, you do not need to mess with /etc/apt/sources.list and do not need build dependencies such as newer libssh, and getting apt build-dep to work will not be necessary too.

&& means that next command will run only if previous was successful. You need to copy and paste in the terminal above commands all at once. If an error happens (perhaps internet connection goes down and download fails, or something else), you can just copy and paste them all one more time to try again if the issue was temporary. The installed deb with qemu will have version “1:2.11+dfsg-1ubuntu7.36-1” which is not correct (actual version is 6.0.0) but it seems to be necessary to fake it otherwise mk-sbuild script below will uninstall the package and will replace with real “1:2.11+dfsg-1ubuntu7.36-1” version from Ubuntu repositories which will not work. Creating “-static” versions of installed binaries is also needed to satisfy the mk-sbuild script. If the block of commands above finished without errors, all of this should be already done.

To register binfmt run this (it is necessary to run non-native binaries with qemu):

sudo qemu-binfmt-conf.sh --qemu-path="/usr/bin" --qemu-suffix="-static"

After installing qemu, create amd64 chroot:

mkdir -p ~/ubuntu/build \
&& cd ~/ubuntu/build \
&& mk-sbuild --arch amd64 focal \
&& sudo cp -a /usr/bin/qemu-i386-static /var/lib/schroot/chroots/focal-amd64/usr/bin/

If at the end you see the following message:

***********************************************
* Before continuing, you MUST restart your    *
* session to gain "sbuild" group permissions! *
***********************************************

Then exit (or reboot), login and then run these commands again:

mkdir -p ~/ubuntu/build \
&& cd ~/ubuntu/build \
&& mk-sbuild --arch amd64 focal \
&& sudo cp -a /usr/bin/qemu-i386-static /var/lib/schroot/chroots/focal-amd64/usr/bin/

Please note that if you reboot, you need to run the following command first (before trying to use mk-sbuild or trying to login to amd64 chroot environment):

sudo qemu-binfmt-conf.sh --qemu-path="/usr/bin" --qemu-suffix="-static"

It is good idea to add the above line to your startup script (the startup script will need to run as root so you will not need sudo otherwise it will ask your password each time).

In /etc/schroot/default/fstab uncomment the line for /run:

sudo nano /etc/schroot/default/fstab    

Then find these lines:

#/run           /run            none    rw,bind         0       0
#/run/lock      /run/lock       none    rw,bind         0       0

And change them like this (by deleting # symbol):

/run           /run            none    rw,bind         0       0
/run/lock      /run/lock       none    rw,bind         0       0

Assuming you are using nano, press Ctrl+O to save and then Ctro+X to exit.

Finally, copy Xauthority:

sudo cp ~/.Xauthority /var/lib/schroot/chroots/focal-amd64/root/

This command can also be added to your startup script so you do not have to run it manually each time after reboot. In the startup script you will need to replace ~ with full path (for example, in my case it is /home/lissanro).

Now we are ready to login to amd64 chroot environment:

sudo schroot -c source:focal-amd64 --directory="/root" -u root /bin/bash

If this is successful, you can install wine (no sudo in commands below because we are running as root in chroot environment):

dpkg --add-architecture i386
apt update
apt install --install-recommends wget curl nano ssl-cert ca-certificates winbind software-properties-common wine64 wine32 wine

Note: wine-development and wine32-development packages in Ubuntu Focal are broken; wine and wine32 are older but they work correctly. Wget, curl and nano are not necessary, but they are useful tools to have if you will need to edit or download files in your chroot environment. Both ssl-cert and ca-certificates are needed if to download from HTTPS sites so it is good idea to install them too.

Now you can try to run winecfg:

DISPLAY=:0 winecfg

If it works, you may try to install and run your Windows application. If necessary, you can use wget to download it and then run installation. Please note OpenGL does not work in qemu. At least I was not able to run glxgears in amd64 chroot, not even after installing OpenGL libraries and using LIBGL_ALWAYS_SOFTWARE=1 for software rendering. Also, some applications may try to use “illegal instructions” which qemu does not support.

You may want to add export DISPLAY=:0 to /etc/profile (or /etc/zsh/zshenv if you are using fizsh or zsh instead of bash), then after logging in again to the chroot environment you will not have to set DISPLAY variable manually each time.

I tested the setup above and I was able to run winecfg and wine notepad. I also was able to install some windows application and run it.

In case using qemu with wine will not work for you, there are other options. For example, GitHub - ptitSeb/box86: Box86 - Linux Userspace x86 Emulator with a twist, targeted at ARM Linux devices can be used instead of qemu if OpenGL support in Wine is necessary. But setting it up is very different from setting up qemu.

Running Windows for ARM in qemu (Xubuntu 20.04 Focal Fossa L4T R32.3.1 - Custom Image for the Jetson Nano - #98 by marietto2008) is yet another option, it includes i386 and amd64 emulation (Windows on Arm: This is how well 64-bit emulation is working - TechRepublic). Only downside running Windows in qemu will eat some additional memory compared to running wine with qemu.

I tried your tutorial on the fly and this is what happened :

root@zi-desktop:/home/zi/qemu# sudo apt -y install ./libkrb5support0_1.17-6ubuntu4.1_arm64.deb

Reading package lists… Done
Building dependency tree
Reading state information… Done
Note, selecting ‘libkrb5support0’ instead of ‘./libkrb5support0_1.17-6ubuntu4.1_arm64.deb’
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
libgtk-3-0 : Depends: libcups2 (>= 1.6.2) but it is not going to be installed
Depends: librest-0.7-0 (>= 0.7) but it is not going to be installed
Recommends: libgtk-3-bin
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

root@zi-desktop:/home/zi/qemu# apt install ./libkrb5-3_1.17-6ubuntu4.1_arm64.deb

Reading package lists… Done
Building dependency tree
Reading state information… Done
Note, selecting ‘libkrb5-3’ instead of ‘./libkrb5-3_1.17-6ubuntu4.1_arm64.deb’
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
libkrb5-3 : Depends: libkrb5support0 (= 1.17-6ubuntu4.1) but 1.16-2ubuntu0.2 is to be installed
lxlock : Depends: light-locker but it is not going to be installed or
xscreensaver but it is not going to be installed or
gnome-screensaver but it is not going to be installed or
i3lock but it is not going to be installed or
suckless-tools but it is not going to be installed or
slim but it is not going to be installed

root@zi-desktop:/home/zi/qemu# apt install ./libssh-4_0.9.3-2ubuntu2.1_arm64.deb

Reading package lists… Done
Building dependency tree
Reading state information… Done
Note, selecting ‘libssh-4’ instead of ‘./libssh-4_0.9.3-2ubuntu2.1_arm64.deb’
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
libssh-4 : Depends: libgssapi-krb5-2 (>= 1.17) but 1.16-2ubuntu0.2 is to be installed
E: Unable to correct problems, you have held broken packages.

root@zi-desktop:/home/zi/qemu# apt install ./libssh-4_0.9.3-2ubuntu2.1_arm64.deb

Reading package lists… Done
Building dependency tree
Reading state information… Done
Note, selecting ‘libssh-4’ instead of ‘./libssh-4_0.9.3-2ubuntu2.1_arm64.deb’
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
libssh-4 : Depends: libgssapi-krb5-2 (>= 1.17) but 1.16-2ubuntu0.2 is to be installed
E: Unable to correct problems, you have held broken packages.

root@zi-desktop:/home/zi/qemu# apt install ./libssh-dev_0.9.3-2ubuntu2.1_arm64.deb

Reading package lists… Done
Building dependency tree
Reading state information… Done
Note, selecting ‘libssh-dev’ instead of ‘./libssh-dev_0.9.3-2ubuntu2.1_arm64.deb’
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
libssh-dev : Depends: libssh-4 (= 0.9.3-2ubuntu2.1) but 0.8.0~20170825.94fa1e38-1ubuntu0.7 is to be installed
E: Unable to correct problems, you have held broken packages.

I imagine that you didn’t use ubuntu 18.04.but 20.04. if it’s true,it’s not good because 20.04 is not yet supported. Using 20.04 will break all the nvidia stuff. You should have said that on the beginning that you have used 20.04. So,your tutorial requires more much work to be adapted on the 18.04.

I’m using Ubuntu 18.04, JetPack 4.5.1. I’m not sure why you have so many package conflicts. Is this on fresh JetPack 4.5.1 install?

If I had Ubuntu 20, installing newer libssh would not be necessary. So installation of these packages is mentioned because my tutorial is adapted to Ubuntu 18.04. On Ubuntu 18.04 they are required because of this bug which developers marked as “won’t fix”: https://bugs.launchpad.net/qemu/+bug/1838763:

Thomas Huth (th-huth) wrote on 2020-07-13: #4
I think that libssh in Ubuntu 18.04 is just broken. I don’t think that we’ll include a work-around in QEMU for this anymore, now that 20.04 is already released and works fine. Thus closing this as WONTFIX.

Changed in qemu:
status: Confirmed → Won’t Fix

Your first errors mention a conflict related to libgtk-3-0, libcups2 and librest-0.7-0 but I already have them installed and they did not get in the way when I was intsalling libkrb5support:

> sudo apt install libgtk-3-0 libcups2 librest-0.7-0 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
librest-0.7-0 is already the newest version (0.8.0-2).
librest-0.7-0 set to manually installed.
libcups2 is already the newest version (2.2.7-1ubuntu2.8).
libgtk-3-0 is already the newest version (3.22.30-1ubuntu4).

So I cannot reproduce your issues on my system. Please let me know if you have these issues on fresh JetPack 4.5.1 installation. If you do, I will try to reproduce and find a fix.

root@zi-desktop:~/Desktop/jetsonUtilities# ./jetsonInfo.py

NVIDIA Jetson Nano (Developer Kit Version)
L4T 32.4.2 [ JetPack 4.4 DP ]
Ubuntu 18.04.5 LTS
Kernel Version: 4.9.201+
Xlib: extension “NV-GLX” missing on display “:1.0”.
Xlib: extension “NV-GLX” missing on display “:1.0”.
Xlib: extension “NV-GLX” missing on display “:1.0”.
CUDA 11.0.207
CUDA Architecture: 5.3
OpenCV version: 4.1.1
OpenCV Cuda: NO
CUDNN: 8.0.0.145
TensorRT: 7.1.0.16
Vision Works: 1.6.0.501
VPI: 0.2.0
Vulcan: 1.2.70

root@zi-desktop:~/Desktop/jetsonUtilities# sudo apt install nvidia-jetpack

Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package nvidia-jetpack

Thank you for trying to help Lissanro. I encounter the following when copying and pasting your commands from the first window.





I think I forgot to mention one preliminary step because I did this long time ago:

sudo nano /etc/apt/sources.list

Then every line with:

# deb-src ...

Edit like this, by removing # symbol:

deb-src

Assuming you are editing the file with nano, save by pressing Ctrl+O and exit (Ctrl+X). After this run:

sudo apt update

Then try to run sudo apt build-dep -y qemu by itself. If it finished without errors, try to run the whole block of commands again.

UPDATE: I have updated my tutorial to include the following lines - they will remove # symbol before deb-src automatically and update:

sudo perl -pin -e "s/#* *deb-src/deb-src/" /etc/apt/sources.list \
&& apt update

So you can just rerun the updated command block, no need to manually edit /etc/apt/sources.list.