Running x86 Programs on the Rasp Pi
Out of This World
Some of your favorite programs might not run on Raspberry Pi because no version is available for the ARM architecture. ExaGear Desktop changes that by acting as a translator between the ARM and x86 worlds.
The open source advantage was evident from the beginning with the Raspberry Pi: Since free software usually runs on many different platforms, almost all Debian packages could be ported to the new system in a very short time. In addition, there was software that exploited the Rasp Pi's special hardware features.
But for proprietary programs, including most Windows applications, the path to the Raspberry Pi is much less assured. Unless the developers want to port their code to the Rasp Pi, users are out in the cold – unless they know about ExaGear.
ExaGear is a tool that provides a special translation layer that converts x86 commands to ARM equivalents. You can use ExaGear to run software written for x86 systems on the ARM-based Raspberry Pi. Support for the Wine integration layer means you can even run old Windows programs directly on the Rasp Pi.
Installation
For a proprietary program, the download and installation is extremely easy [1]: ExaGear can be found in the Raspbian package sources. You can thus install it conveniently via the package manager and then start the emulator (Listing 1).
Listing 1
Installing ExaGear Desktop
$ sudo apt update $ sudo apt install exagear-desktop $ exagear Starting /bin/bash in the guest image /opt/exagear/images/debian-8
The last command in Listing 1 switches to the x86 environment. The first time you call it, a form appears, prompting you for your name and email address (Figure 1). The trial version can then be used in full for 72 hours. The license is tied to the CPU's serial number, which prevents users from simply reinstalling.
With a full license, the procedure is somewhat different (see the "Versions" box). Download a tarball specific to the Rasp Pi model used and unpack it in the same directory as the license file. Then start the installation command (Listing 2). (Eltechs kindly provided us with a license for this article.)
Versions
ExaGear Desktop costs between EUR11.95 for the Pi Zero/RPi1-compatible basic version and EUR40.95 for the RPi3-compatible enterprise version, depending on the platform and scope of functions. However, there are always special offers; for example, at the beginning of the 2018 FIFA World Cup, you could get two licenses for the price of one.
In addition to the focus on a specific Rasp Pi model, the versions also differ in terms of flexibility and support. The basic version is tied to a specific device – if your Rasp Pi dies, the license is also lost. The Pro version, on the other hand, allows you to transfer the license to another device of the same class. The basic version costs EUR23.95 Euro, and the pro version costs and additional 12 euros. The enterprise version supports use in the enterprise, offers better support, and simplifies the installation via volume licenses.
The cheapest license (for the Rasp Pi Zero/RPi1) is not really all that useful even for general use. Many programs fail due to meager resources. For special programs, however, the combination of Pi Zero and ExaGear can be a sensible alternative to a dusty Windows XP PC that only runs because there is no modern replacement for the beloved old laboratory software.
Listing 2
Installation Command
exagear-desktop-v-2-2/exagear-desktop-rpi3.tar.gz $ tar -xvzpf exagear-desktop-v-2-2/exagear-desktop-rpi3.tar.gz $ sudo ./install-exagear.sh
The tarball essentially contains a number of deb packages with guest systems, from which the installation script then selects the most suitable alternative for the installation. It also checks the license and activates the program.
First Steps
After starting the ExaGear environment with the command exagear
, nothing happens except a welcome message. The output of the commands uname -a
and cat /etc/os-release
(Figure 2) show that the system now runs – with identical kernel versions – under an x86 architecture instead of an armv7l architecture. With the command exit
, you leave the x86 environment again.
Later on, you can avoid the detour via the exagear
command for installed x86 programs, because the kernel identifies the binary format and launches the wrapper automatically. Of course, this is not automatically the case, but needs to be configured using the ExaGear installer.
Installing ExaGear puts a minimal Debian "Jessie" distribution on your system. Unlike real emulators or virtual machines, the x86 environment makes use of the host system environment – ExaGear is thus explicitly unsuitable for clean program isolation.
The Jessie filesystem is located below /opt/exagear/images/debian-8/
. From the normal Raspbian system, you can access the data stored there without any problems. Conversely, you can access the home directories of the host system: ExaGear integrates both /home/
and /dev/
.
If you need access to the complete host system, simply remount the original root partition completely (Listing 3). After that, the guest system sees the complete host filesystem below /host
– whether or not this makes sense is up to you to decide.
Listing 3
Remounting the Original Root Partition
$ sudo mkdir /opt/exagear/images/debian-8/host $ sudo mount /dev/mmcblk0p2 /opt/exagear/images/debian-8/wirt
The dpkg -l
command shows the few installed packages of the frugal ExaGear Debian. However, the retroactive installation of further software works without problems and – in the usual Raspbian style – relies on the command:
sudo apt-get install <package>
The guest system also relies on the host for services and udev rules. It would thus be pointless to reinstall services like cron inside the emulator. It only makes sense that the software prevents this.
Architecture
ExaGear Desktop is not a classic emulator that provides a complete operating system environment – in particular, it lacks its own kernel. In principle, the software works in a similar way to Wine, which provides a Windows environment under Linux. The run-time environment intercepts x86 commands and translates them into corresponding ARM commands. For graphics output, ExaGear uses the host's X server; the Linux desktop's architecture helps the emulator here (see the "X Architecture on Linux" box).
X Architecture on Linux
On Linux, the operating system traditionally does not draw the graphical output, but instead relies on a separate program known as the X server. Applications that want to output a graphical user interface communicate with the X server and tell it what to draw. The X server then calls the kernel's low-level system driver interfaces. Communication between the X clients and the X server takes place via the network interfaces.
On workstations, the X server and its clients usually run on the same system. The X clients could also run on a computer at the other side of the world and send their graphics commands via the Internet to the home computer, which then displays the interface. Thanks to the standardized protocol, this also works across operating system boundaries. A Rasp Pi program's graphical output could therefore be easily displayed on an X server running Windows.
In relation to ExaGear Desktop, this means that the emulator does not have to take care of the graphical user interface. The x86 programs are ultimately equivalent to additional X clients. They send the output commands to the host's X server, which then displays the output. The server returns keyboard and mouse events to the X client in the emulator.
The advantage of the lean emulation layer is that it automatically supports multithreading; however, you still experience a loss of performance. Eltechs promises up to 80 percent of native performance, with the loss depending on the specific commands an application uses. In extreme cases, up to two-thirds of the Rasp Pi performance is lost.
On the Raspbian side, you should definitely take some precautions to ensure optimal conditions. This includes at least a newer generation RPi2 (the same processor as the RPi3) or higher. A fast hard disk (SSD) for the system also helps. You should also give the GPU enough memory, at least 256MB, which you can set with the parameter gpu_mem
in the /boot/config.txt
file.
Graphic-intensive applications also benefit from enabling hardware-supported graphics acceleration. You can do this in raspi-config
, where you will find the setting GL Driver below Advanced Options. Select GL (Full KMS) OpenGL desktop driver with full KMS. Applications such as Skype (32-bit Linux version) have a problem with this. When Skype accesses the video camera, whether it's a Pi or USB camera, the X server crashes.
On the network side, emulation is less of a performance brake. Cloning a 260MB GitHub project took 140 seconds natively and 231 seconds in the emulator. The download rate in the emulator was only seven percent lower, the rest of the loss was attributable to the CPU for encryption and processing the Git metadata. With NFS or Samba transfers, on the other hand, the loss is in the range of measurement uncertainty.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Thousands of Linux Servers Infected with Stealth Malware Since 2021
Perfctl is capable of remaining undetected, which makes it dangerous and hard to mitigate.
-
Halcyon Creates Anti-Ransomware Protection for Linux
As more Linux systems are targeted by ransomware, Halcyon is stepping up its protection.
-
Valve and Arch Linux Announce Collaboration
Valve and Arch have come together for two projects that will have a serious impact on the Linux distribution.
-
Hacker Successfully Runs Linux on a CPU from the Early ‘70s
From the office of "Look what I can do," Dmitry Grinberg was able to get Linux running on a processor that was created in 1971.
-
OSI and LPI Form Strategic Alliance
With a goal of strengthening Linux and open source communities, this new alliance aims to nurture the growth of more highly skilled professionals.
-
Fedora 41 Beta Available with Some Interesting Additions
If you're a Fedora fan, you'll be excited to hear the beta version of the latest release is now available for testing and includes plenty of updates.
-
AlmaLinux Unveils New Hardware Certification Process
The AlmaLinux Hardware Certification Program run by the Certification Special Interest Group (SIG) aims to ensure seamless compatibility between AlmaLinux and a wide range of hardware configurations.
-
Wind River Introduces eLxr Pro Linux Solution
eLxr Pro offers an end-to-end Linux solution backed by expert commercial support.
-
Juno Tab 3 Launches with Ubuntu 24.04
Anyone looking for a full-blown Linux tablet need look no further. Juno has released the Tab 3.
-
New KDE Slimbook Plasma Available for Preorder
Powered by an AMD Ryzen CPU, the latest KDE Slimbook laptop is powerful enough for local AI tasks.