Flatpak 2.2.0 fails to launch: spawn ENOTDIR in startBackendServer (asar / asar.unpacked path mismatch)
Environment
- OS: Fedora Linux 44 (kernel 6.19.14)
- Termix: 2.2.0 (flatpak,
com.karmaa.termix, master branch, commit41bca4f7…7af86ab5) - Source:
termix_linux_flatpak.flatpakfrom the release-2.2.0 GitHub release - Runtime:
org.freedesktop.Platform/x86_64/24.08
Steps to reproduce
flatpak install --user termix_linux_flatpak.flatpak- Launch via GNOME activities search, dock icon, or
flatpak run com.karmaa.termix
Expected
Termix window opens.
Actual
Process exits during startup. No window appears. 100% reproducible.
Journal trace
com.karmaa.termix.desktop[…]: dist/backend contents: [ 'backend', 'types' ]
com.karmaa.termix.desktop[…]: Unhandled Rejection at: Promise {
<rejected> Error: spawn ENOTDIR
at ChildProcess.spawn (node:internal/child_process:441:11)
at spawn (node:child_process:810:9)
at fork (node:child_process:174:10)
at e.fork (node:electron/js2c/node_init:2:19367)
at /app/bin/resources/app.asar/electron/main.cjs:615:22
at new Promise (<anonymous>)
at startBackendServer (/app/bin/resources/app.asar/electron/main.cjs:582:10)
at /app/bin/resources/app.asar/electron/main.cjs:2513:26 {
errno: -20, code: 'ENOTDIR', syscall: 'spawn'
}
}
Diagnosis
The flatpak deploy lays out:
/app/bin/resources/app.asar (file, ~73 MB)
/app/bin/resources/app.asar.unpacked/dist/backend/backend/starter.js (file)
/app/bin/resources/app.asar.unpacked/dist/backend/backend/{database,guacamole,ssh,utils}/ (dirs)
startBackendServer in electron/main.cjs:582 (fork at line 615) appears to build the child path from __dirname, which resolves into app.asar. Since child_process.fork() does not go through Electron's asar redirector — it does a plain stat() against the real filesystem — the OS sees app.asar as a file and returns ENOTDIR when traversing app.asar/dist/backend/backend/… as if it were a directory.
Fix is the standard Electron asar pattern: when forking child processes whose code lives in app.asar.unpacked, replace app.asar with app.asar.unpacked in the spawn target path before calling fork(). The same applies anywhere else in main.cjs that hands a path inside app.asar to a non-Electron API (child_process, native modules, etc.).
Also confirmed: previous 1.10.0 flatpak release exhibited the identical error on the same machine, so this isn't new in 2.2.0.
Workaround
The x64 AppImage and portable tar.gz from the same release should be unaffected (no asar redirection issue), so they're a viable fallback for affected users.
Please move this issue to the Support repository.
Refiled at Termix-SSH/Support#673 since I don't have transfer permissions. Closing this one.