Issues and comments with FEX on Fedora 42

Hi, I previously made a post about running fex-emu months ago on my Snapdragon X Elite laptop which didn’t work at all, since then Fedora 42 launched with support for x86 emulation built-in, provided by using FEX, muvm, and binfmt-dispatcher.

So I decided to test it out on my laptop again and it still doesn’t work but acts slightly different. I am running Fedora 42 KDE Plasma which is supposed to have everything needed to run x86 and x86_64 programs OOBE. It only seems to have binfmt-dispatcher which does tell you need FEX and installs it for you (plus muvm which I don’t think is needed on 4K page systems like the Snapdragon X Elite?) whenever you run an x86 program directly so that’s cool UX to prevent increasing the file size of the distro by default.

But the current distribution of FEX is still broken in seemingly the same way. The official fedora rootfs is downloaded but isn’t loaded into FEX by default and trying to set it manually using FEXConfig from fex-emu-utils also still doesn’t work. The fedora rootfs is a .erofs and the configuration expects .sqsh or .ero.

So after renaming it to .ero it sort of starts to work but even just running uname is still broken.

$ FEXBash uname
erofsfuse 1.8.6
<W> erofs: /usr/share/fex-emu/RootFS/default.ero mounted on /run/user/1000/.FEXMount12166-JvBxXO with offset 0
[binfmt_dispatcher] Using FEX
pipe:[117070]: command not found

Previously when I ran uname it would bring up an error about libc:

But now it seems like errors are intercepted by binfmt_dispatcher? Removing muvm and then running uname inside of FEXBash again seems to make binfmt think it’s missing dependencies and tries to install muvm again

$ FEXBash uname
erofsfuse 1.8.6
<W> erofs: /usr/share/fex-emu/RootFS/default.ero mounted on /run/user/1000/.FEXMount12432-VKhdHt with offset 0
[binfmt_dispatcher] Will attempt to install missing requirements for FEX
Updating and loading repositories:
Repositories loaded.
Package                             Arch       Version                             Repository             Size
Installing:
 muvm                               aarch64    0.4.1-1.fc42                        updates             2.8 MiB
Installing dependencies:
 libkrun                            aarch64    1.11.2-1.fc42                       updates             3.8 MiB
 libkrunfw                          aarch64    4.9.0-1.fc42                        updates            20.9 MiB
 virglrenderer                      aarch64    1.1.0-2.fc42                        fedora              1.2 MiB

Transaction Summary:
 Installing:         4 packages

Again, I don’t think muvm is needed on my laptop specifically, fex-emu has worked on Ubuntu before.

Also a bug I noticed is you can’t cancel out of installing fex-emu or it’s dependencies if you try running a x86 appimage by double clicking it. The binfmt_dispatcher pop up shows up with only an OK button and no way to close it visually. Closing it via the desktop overview or pressing esc makes it proceed anyways and after cancelling dnf the pop up comes back. There is some weird behavior with appimages where if they fail the system keeps on trying to run them. Starting an appimage from the terminal will show a bunch of [binfmt_dispatcher] Using FEX messages before failing with fuse: socketpair() failed: Too many open files

Additionally, I think your build of FEX might only work on ARMv8.4+ systems? I don’t know how to check this, I am just basing it off someone’s experience trying to run FEX on their Libre Computer Alta (Cortex A73 + A53: ARMv8 only) in which they kept getting segmentation errors.

the muvm dependency can be removed by commenting use_muvm in /usr/lib/binfmt-dispatcher.d/00-default.toml

After that binfmt-dispatcher isn’t trying to automatically install muvm.

I’m not sure if muvm is the root issue, after that I still get pipe:[85132]: command not found when trying to start steam.

The “command not found” message is a signal that FEXServer process died.

Restart it (or run as FEXServer -f in some terminal to see when it crash) and retry.

with FEXServer -f in a different console,

FEXBash-robclark@yoda:~> steam
[binfmt_dispatcher] Using FEX
[binfmt_dispatcher] Using FEX
[binfmt_dispatcher] Using FEX
STEAMDATALINK: /home/robclark/.steam/steam
LAUNCHSTEAMDIR: /run/user/1000/.FEXMount126732-tpQRsP/usr/bin/readlink
/home/robclark/.local/share/Steam
[binfmt_dispatcher] Using FEX
srt-logger[126810]: E: srt-logger --mkfifo takes no other arguments
bin_steam.sh[126801]: Couldn't set up srt-logger, not logging to console-linux.txt
[binfmt_dispatcher] Using FEX
srt-logger[126812]: E: srt-logger --mkfifo takes no other arguments
bin_steam.sh[126801]: Couldn't set up srt-logger, not logging to console-linux.txt
LAUNCHSTEAMDIR: /home/robclark/.local/share/Steam
[binfmt_dispatcher] Using FEX
srt-logger[126813]: E: srt-logger --mkfifo takes no other arguments
bin_steam.sh[126801]: Couldn't set up srt-logger, not logging to console-linux.txt
[binfmt_dispatcher] Using FEX
/run/user/1000/.FEXMount126732-tpQRsP/usr/sbin/bash: /run/user/1000/.FEXMount126732-tpQRsP/usr/sbin/bash: cannot execute binary file
FEXBash-robclark@yoda:~> 

In /usr/lib/binfmt-dispatcher.d/00-default.toml there is an option for log_level, I changed it to debug and I don’t know how to diagnose this very well but I thought I’d share feedback. It seems running stuff with FEXBash appended causes issues in certain applications for some reason. I have successfully ran the x64 version of SuperTuxKart by double clicking run_game.sh but if I run it by using FEXBash ./run_game.sh it fails.

$ FEXBash ./run_game.sh 
[binfmt_dispatcher] Using FEX
[binfmt_dispatcher] Running:
    Command {
        program: "/usr/bin/FEXInterpreter",
        args: [
            "/usr/bin/FEXInterpreter",
            "/run/user/1000/.FEXMount28619-3QNQYg/usr/bin/readlink",
            "/run/user/1000/.FEXMount28619-3QNQYg/usr/bin/readlink",
            "readlink",
            "-f",
            "./run_game.sh",
        ],
        create_pidfd: false,
    }
[binfmt_dispatcher] Using FEX
[binfmt_dispatcher] Running:
    Command {
        program: "/usr/bin/FEXInterpreter",
        args: [
            "/usr/bin/FEXInterpreter",
            "/run/user/1000/.FEXMount28619-3QNQYg/usr/bin/dirname",
            "/run/user/1000/.FEXMount28619-3QNQYg/usr/bin/dirname",
            "dirname",
            "/run/user/1000/.FEXMount28619-3QNQYg/usr/bin/readlink\n/home/r/Downloads/SuperTuxKart-1.4-linux-x86_64/readlink\n/home/r/Downloads/SuperTuxKart-1.4-linux-x86_64/run_game.sh",
        ],
        create_pidfd: false,
    }
./run_game.sh: line 9: cd: $'/run/user/1000/.FEXMount28619-3QNQYg/usr/bin\n.\n/run/user/1000/.FEXMount28619-3QNQYg/usr/bin/readlink\n/home/r/Downloads/SuperTuxKart-1.4-linux-x86_64/readlink\n/home/r/Downloads/SuperTuxKart-1.4-linux-x86_64': No such file or directory
./run_game.sh: line 12: /run/user/1000/.FEXMount28619-3QNQYg/usr/bin
.
/run/user/1000/.FEXMount28619-3QNQYg/usr/bin/readlink
/home/r/Downloads/SuperTuxKart-1.4-linux-x86_64/readlink
/home/r/Downloads/SuperTuxKart-1.4-linux-x86_64/bin/supertuxkart: No such file or directory

I also tried running the x64 version of fastfetch just to experiment and there’s also slightly different behavior running by itself first and then with FEXBash appended.

$ ./fastfetch 
[binfmt_dispatcher] Using FEX
[binfmt_dispatcher] Running:
    Command {
        program: "/usr/bin/FEXInterpreter",
        args: [
            "/usr/bin/FEXInterpreter",
            "/home/r/Downloads/fastfetch-linux-amd64/usr/bin/fastfetch",
            "./fastfetch",
            "./fastfetch",
        ],
        create_pidfd: false,
    }
erofsfuse 1.8.10
<W> erofs: /usr/share/fex-emu/RootFS/default.ero mounted on /run/user/1000/.FEXMount30678-kca24h with offset 0
Error: invalid option: ./fastfetch. An option must start with `-`

With FEXBash appended:

$ FEXBash ./fastfetch 
erofsfuse 1.8.10
<W> erofs: /usr/share/fex-emu/RootFS/default.ero mounted on /run/user/1000/.FEXMount30713-yVSIV9 with offset 0
[binfmt_dispatcher] Using FEX
[binfmt_dispatcher] Running:
    Command {
        program: "/usr/bin/FEXInterpreter",
        args: [
            "/usr/bin/FEXInterpreter",
            "pipe:[193848]",
            "./fastfetch",
            "./fastfetch",
        ],
        create_pidfd: false,
    }
pipe:[193848]: command not found

Thanks to a tip from jannau, the secret seems to be sudo dnf rm binfmt-dispatcher

After that FEXBash steam works!

2 Likes

I’ll give it a try later but hopefully the underlying bug with binfmt-dispatcher can be found because having something to automatically pick an emulation layer based on a list is a really cool idea.

In the case FEX-EMU doesn’t work, Box64 can be set as the default as an example.

Cool thanks, FEX-EMU seems to work now. How did you get steam installed on your system? I know Asahi Linux has a copr repo for installing Steam but it has Asahi specific requirements. I guess that’s something that Fedora needs a bit of work on for a seamless ARM experience as well: You can enable apt to download and install packages that aren’t compatible with your system on Ubuntu but dnf doesn’t seem to have such an option?

tbh, I’m not sure I remember how I installed it.. maybe found the rpm from asahi and manually extracted it?