AppRun
AppRun copied to clipboard
Ubuntu 24.04: Wrong runtime selected, app doesn't start ("No such file or directory")
I've been yanking my hair out the last couple of days trying to understand why I couldn't get appimage-builder to build and run properly on a newer OS and with updated Python.
Turns out, the updates to python or whatever else don't really have anything to do with the issue, which was AppRun failing to load due to an ENOENT somewhere I couldn't quite figure out.
But, I finally did. The problem is AppRun. After much trial and error, I realized it specifically wasn't finding ld-linux-x86-64.so.2
Played with it for a pretty long while until I realized the following:
According to USAGE.md, the file layout should be something like the following:
# Compat runtime
AppDir/runtime/compat/lib64/ld-linux-x86-64.so.2
AppDir/runtime/compat/lib/x86_64-linux-gnu/libtinfo.so.6
AppDir/runtime/compat/lib/x86_64-linux-gnu/libc.so.6
AppDir/runtime/compat/lib/x86_64-linux-gnu/libdl.so.2
AppDir/runtime/compat/usr/bin/bash # links to: ../../../../usr/bin/bash
# Default runtime
AppDir/runtime/default/lib64/ld-linux-x86-64.so.2 # links to: /lib64/ld-linux-x86-64.so.2
AppDir/runtime/compat/usr/bin/bash # links to: ../../../../usr/bin/bash
Except for the fact that the AppDir is missing AppDir/runtime/compat/lib64.
Now, I don't know why it's not picking up the absolute /lib64/ld-linux-x86-64.so.2 reference report by ldd but it just isn't.
The final nail on the coffin is the following, https://github.com/AppImageCrafters/AppRun/blob/407700ccef58e1a64cc49856074aee4b1c75d599/src/apprun/runtime_interpreter.c#L207-L213
Which results in AppRun selecting the compatibility runtime when both the bundle and the system have the same libc version.
There are several potential ways to fix it:
- Make sure the
compatruntime has the appropriate linker underlib64/. - Symlink
compat/lib64pointing to the default runtime or wherever the file is inside thecompatruntime, although this would entirely defeat the purpose.
The third option (which I think is the correct one), is to not use the compat runtime if the libc version matches the system, or:
- if (compare_version_strings(system_ld_version, appdir_ld_version) > 0) {
+ if (compare_version_strings(system_ld_version, appdir_ld_version) >= 0) {
runtime_path = resolve_runtime_path("runtime/default");
configure_system_libc();
} else {
runtime_path = resolve_runtime_path("runtime/compat");
configure_embed_libc();
}
Doing that results in my copy of AppRun going for the default runtime and thus loading normally.