AppImage built with webkit2gtk dependencies cannot start on non-Ubuntu distributions
See original GitHub issueThe issue is described in eneshecan/whatsapp-for-linux#160. Here is just the error:
<13>Jan 21 23:42:13 whatsapp-for-linux[7682]: ** (whatsapp-for-linux:7676): ERROR **: 23:42:13.184: Unable to spawn a new child process: Failed to execute child process “/usr/lib/x86_64-linux-gnu/webkit2gtk-4.0/WebKitNetworkProcess” (No such file or directory)
This is a fix for the issue in another framework that supports building AppImage binaries: tauri-apps/tauri#2940
Thanks!
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Bottles AppImage · Issue #1272 · bottlesdevs/Bottles - GitHub
Bottles need 1.6 but Ubuntu 21.10 is stuck with 1.2. I think the Appimage can be built using any distro, right?
Read more >[SOLVED] Debug Appimage? - LinuxQuestions.org
This Appimage works in some system or it would hardly be released, but fails in Slackware giving this output in an xterm Code:...
Read more >Can't run AppImage on desktop by doubleclicking or clicking ...
Solution 1 : Right Click On The Appimage File And Go In Properties. enter image description here. Then Go In Permissions.
Read more >Blank lines of SVG 1.2 text aren't rendered anymore - GitLab
Right now, the latest APPImage of Inkscape its working as expected (V1.0.1). Can create text with spaces between lines. no issues.
Read more >How to Build a Cross-Platform Application with Next.js and Tauri
Canonical provides all Linux application distributions and does not work for macOS and Windows. Before building a snap, first you need to ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@andrewda I’m glad my writeup was helpful!
Sure! I just used an
after_bundle
script, inspired by Tauri’s scripts.I’m developing an application that depends on WebKitGTK and I’ve stumbled upon this issue. Setting path mappings does like this in the recipe file does not work:
After reading the AppRun and WebKitGTK source code, in addition to testing on my Linux box by breaking WebKitGTK on purpose by running
sudo mv /usr/lib/x86_64-linux-gnu/webkit2gtk-4.0/WebKitWebProcess /usr/lib/x86_64-linux-gnu/webkit2gtk-4.0/.WebKitWebProcess
(this is a terrible thing to do, please don’t copy and paste this command), I’ve arrived at the following conclusions:posix_spawn
,fork
orexec
, and as far as I can tell the AppRun hooks do not touch all of these functions.(From the webkitgtk-2.38.2 release, file
WebKit/UIProcess/Launcher/glib/ProcessLauncherGLib.cpp
)WEBKIT_EXEC_PATH
environment variable to change the path where binaries are expected to be at runtime, but it only does so if the developer mode flag is enabled when building WebKitGTK. This is not the case for Debian Bullseye packages, for example, so it can’t be relied upon. (Source: thefindWebKitProcess
function atWebKit/Shared/glib/ProcessExecutablePathGLib.cpp
)I don’t know what the rationale of the WebKitGTK team was to lock down the
WEBKIT_EXEC_PATH
environment variable behind a developer mode flag (if an attacker can set arbitrary environment variables, can’t it already change the behavior of the dynamic linker and/or the WebKit binary itself to run malicious code?), but the only feasible way I can see to deal with this is to do what Tauri did in the linked issue and binary-patch the strings embedded in the libraries. Or patch AppRun to hook the process spawning calls, but I’m not sure how feasible is that to do.The main problem with Tauri’s approach is that I’ve tested it, and it doesn’t work for
appimage-builder
as-is. Tauri’s solution replaces the offending/usr
path prefix by././
, so it probably relies on the working directory being set to some value that differs inappimage-builder
:For completeness and reference purposes, this is the relevant script that Tauri uses to generate the AppDir and patch the WebKitGTK binaries.
Edit: I found out the rationale for
WEBKIT_EXEC_PATH
being only honored on development builds. Some WebKit developer thought on 2014 that environment variable was only useful for “internal tools and tests”, and decided to gate it behind that flag, with the approval of another developer. Clearly they didn’t have AppImages in mind 😅Edit 2: oddly enough, when mounting the AppImage with
--appimage-mount
and trying to run the offending WebKit processes from a terminal, I’m also greeted with a “No such file or directory” error, despite the file being there and having execute permission. Perhaps it’s necessary to tweak some ELF loader bits too?Edit 3: the error I mentioned on “Edit 2” was caused due to
appimage-builder
relativizing the path to the dynamic link interpreter tolib64/ld-linux-x86-64.so.2
. Switching the working directory to the runtime directory within the AppImage filesystem worked. This suggests that maybe Tauri’s workaround is okay, but the missing piece is getting the spawned process to use the dynamic linker embedded in the AppImage.Sadly, all of this means that AppImages containing applications that depend on WebKitGTK don’t work properly, relying on WebKitGTK binaries to be present in the target system. I hope that my thorough description at least is useful to give more insight on what’s going on and possible ways to tackle it.