New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot run foreign architecture AppImages directly with binfmt_misc support #965
Comments
Possibly this has to do with the magic bytes that we are adding to the ELF header. What happens if you edit the magic hex |
Interesting. After editing the file, I now get:
It still runs qith |
Hello, I have a similar issue: I cannot run chromium/electron based apps using binfmt since they call /proc/self/exec in order to spawn their subprocesses. /proc/self/exec points to the qemu executable thou. AppImage files are binaries with their payload following the executable code. They obviously also try to extract their payload from /proc/self/exec which fails. Solution obviously is to modify that pointer so that it points to the executable in question instead of to the qemu executable! This probably has to be done by the qemu devs. |
Thanks for explaining what is going on @L3P3. Sounds like an edge use case to me so I will not invest time into it, but I will be open to pull requests implementing a solution/workaround. |
Duplicate of #1056 I have similar issue, but the other way around: I'm trying to run x64 AppImage inside arm64 environment (Docker Desktop for m1 macOS -> arm64 linux VM -> arm64 ubuntu container -> qemu-x86_64 bash process).
Anyway, qemu user-space emulation seems to be unreliable anyway, I'm not sure AppImage will be able to successfully run after the |
Small update: Docket Desktop for macOS now supports running x64 executables via Rosetta so the second issue I mentioned above is no longer relevant. So the fix with removing AppImage magic now works fine. And I found the root cause of that. It's not the emulation of binfmt inside user-space emulation, it's because AppImage's magic conflicts with Rosetta's recommended binfmt magic which Docker Desktop also uses. Rosetta's magic and mask:
AppImage first 20 bytes:
That's why it doesn't work: kernel doesn't find the matching binfmt entry, tries to run x64 binary in arm64 OS and fails. Given how often binfmt masks for ELF files are used (at least with userspace QEMU and Rosetta) I think it was a wrong decision to put AppImage's magic bytes there. |
We all agree on this from today's perspective. If we ever do a new version of the AppImage format, we'll change the position of the magic. |
add workaround for appimage format being incompatible with QEMU AppImage/AppImageKit#965
add workaround for appimage format being incompatible with QEMU AppImage/AppImageKit#965
add workaround for appimage format being incompatible with QEMU AppImage/AppImageKit#965
I cannot directly run foreign architecture (ARM, ARM64) AppImages on an x64 installation even with binfmt-support and qemu-user-static installed.
Trying to run
appimagetool-armhf.AppImage
gives:I can run it by explicitly invoking qemu-arm-static though:
I can run other ARM executables directly without explicitly invoking qemu:
Would be great if this could be made to work for AppImages too.
The text was updated successfully, but these errors were encountered: