Repository navigation
On Linux every game plays from a plain folder, never an AppImage - #310
Conversation
swap.rs sets the old release's files aside in the game's folder, moves the new ones in, and puts everything back on any failure. A marker written first lets the next start finish or undo an update the launcher was closed in. Not wired into installs yet.
The release is unpacked beside the game first, then the old files it replaces or drops are set aside and the new ones moved in. A failure, or a later step like the repo clone failing, puts everything back and says what stopped it. The old files go only once the library is saved, and a launcher closed partway finishes or undoes the update at its next start. Scans for the program, setup, backups and saves skip the set-aside folder.
A tarball compressed with xz or zstd installed nowhere: .tar.xz was refused at unpacking, and .tar.zst wasn't known at all. Both unpack now, and rank as a .tar.gz does, so which build is picked doesn't change. xz2 is named as a dependency for it; backhand already built it in.
They were unpacked beside their folder and then moved in one file at a time, so a locked file or a full drive left half of a mod in a game's folder. They now go in the way a game's update does (swap.rs): every file in, or the folder as it was. A launcher closed in the middle undoes it at the next start, since no game's record has the swap's marker.
AppImages get deleted after they're extracted, need FUSE to mount, and can't mount at all in the Flatpak. Plain folders are what stays. - A release's AppImage is unpacked at install and update with the launcher's own SquashFS reader (appimage.rs, backhand): nothing of it runs. Its files become the game's folder, the AppImage goes, and the game starts from its AppRun. Several AppImages each unpack into a folder named after them. Every Linux build does this, not only the Flatpak. - No fallback to running it: when the AppImage won't unpack, the release's tarball is installed instead, or the install stops and says why. - An AppImage the player brings in is unpacked into the Recomp Library, read once and its path not kept; their file stays where it is. One inside the library is replaced by the unpacked game. Games added or installed as AppImages before this unpack the same way on their next Play, or before their setup step. A game the launcher doesn't know updates by bringing in its newer AppImage. The window says where it went, the same on the desktop and in Big Picture. - Play's mount, extract-and-run, and the Flatpak's first-Play unpack into its cache are gone (the cache is removed once). APPDIR is set as before. - Before a Linux game installs, a library folder on an exFAT, NTFS or FAT drive, or one mounted noexec, is refused: games there lose their run permission and links.
Tarball vs AppImage trial (70 catalog projects that ship both)On bazzite-kde, each project's latest release: the AppImage unpacked the way this PR does it (started from its
Also checked: Headline
DwarFS AppImages: needs a decision. A header check of all 254 catalog Linux AppImages found 247 SquashFS, which this PR handles, and 3 packed with DwarFS ( The ranking is unchanged in this PR. Full table
{"ai_host": 61, "ai_fp": 53, "tb_host": 44, "tb_fp": 42, "tb_none": 10, "ai_none": 1, "n": 70, "appimage_env": 45, "skipped": 0, "error": 0} Why the ones that didn't start stopped:
|
The "runs anywhere" AppImage tooling (pkgforge's Anylinux/uruntime, and Tauri's portable AppImage branch) packs with DwarFS, not SquashFS. Three catalog games ship that way (OpenGOAL, Carpocalypse 2, Bloodborne Linux) and would have stopped installing on Linux. They're read with the dwarfs crate (zstd only) and written out by the same code as SquashFS ones: setuid dropped, links leaving the folder dropped, room checked first, a damaged image caught. Their embedded recomplauncher.json is read too. dwarfs-enc builds the test images and is test-only.
…rs work U's review made swap::put_in_place take the old release's files: a file where the game has a folder (or the other way round) is set aside only when all of it is the old release's. D's callers pass: - install: the previous record's files, as U does; - bringing in an AppImage in place (plain.rs): the record's files (an older launcher's release, or what an earlier unpack put there); - mods, installer releases, game copies (install::unpack_with): nothing, since no list of what they put there before is kept. Such a clash stops the unpack with nothing changed, never sets the player's files aside. A file over a file of the same name is replaced as before. Tested with a mod whose file lands on a folder of the player's.
Found running the launcher's own AppImage on Bazzite and dumping what a game it starts gets: linuxdeploy's GTK hook pins GTK_THEME to Adwaita:light or Adwaita:dark for the launcher (custom themes break inside an AppImage), and its AppRun sets PYTHONDONTWRITEBYTECODE=1. Both reached every game, so a GTK game (or a game's GTK launcher) lost the player's theme. They're taken out for games when the launcher runs as an AppImage and has exactly those values; a theme the player set themselves stays. Everything else the AppImage runtime sets (APPIMAGE, APPDIR, OWD, LD_LIBRARY_PATH, GTK_PATH, GST_*, GIO, PERLLIB...) was already kept from games, and the run confirmed it.
From U's review. swap's remove_any asked symlink_metadata, which says a link to a folder (a symlink or a junction) isn't a folder, so it called remove_file: Windows refuses that (Access is denied, os error 5), and install::patient then retried the refusal for about ten seconds. Such a link carries the directory attribute, and goes with remove_dir, which takes the link and leaves the folder it points at. Tested on Windows 11 (windows-vm) with a junction made by mklink /J (no administrator needed): the link goes, the folder and its files stay. The test fails on the old code with os error 5. All 19 swap tests pass there.
… is unpacked there Bringing in an AppImage that sits in a game folder of the player's own, inside the Recomp Library, unpacked it in place and marked the folder the launcher's (unpacked), so uninstall's "delete files" could remove everything else of theirs in it. Only a folder the launcher made, or a game it installed, is marked now; the unpack's files are still in the record. A newer AppImage is matched, and an earlier unpack's files dropped, by from_appimage instead, and Bring Your Recomps still doesn't move such a game.
play is async and reaches in_plain_folder through the sync start_game path, and setup_copy and setup_inputs_run are sync commands Tauri runs as futures, so a multi-GB unpack held a runtime worker. It now runs in block_in_place, as adopt_add's does. Where there's no multi-threaded runtime (a test, a plain thread) it runs directly, since block_in_place would panic on a single-threaded one.
0d03826 to
b71ee8f
Compare
…em, and the guide on running unpacked (#486) * A program named inside an unpacked AppImage gets the libraries it brings With Easy Setup on, MKW Recomp closed at once with code 127 on Linux: "mkw: error while loading shared libraries: libvpx.so.6". Its profile names mkw, which since AppImages are unpacked (#310) is found in the game's folder and started by itself. Its AppRun is what puts the AppImage's lib/ folder on LD_LIBRARY_PATH, so without it the libraries mkw ships with weren't found. Before #310 the profile's program wasn't there and the AppImage started instead. A program inside an unpacked AppImage that isn't its AppRun now gets the AppImage's own library folders first on LD_LIBRARY_PATH (lib, lib64, usr/lib, usr/lib64 and usr/lib/<arch>-linux-gnu, those that exist), with the PC's own list after them, for Play and for a setup step. A profile can't set that variable itself. The developer guide says so beside the AppRun rules. On bazzite-kde, a fresh MKW install with Easy Setup on stopped with the libvpx error on the old build and reached the game's start screen on this one. * A program in an unpacked AppImage gets APPDIR and OWD, and links left out are named What the AppImage runtime sets for the program it starts now comes from one place (appimage_vars), the same for Play and a setup step: APPDIR (the AppImage's folder), OWD (the folder it starts in) and, for AppRun, ARGV0. A program named inside the AppImage instead of its AppRun gets APPDIR and OWD too, besides the AppImage's libraries, so one that finds its files through APPDIR does when a profile names it. A program in a plain folder gets nothing of this. APPIMAGE is still never set. The trail named only how many links an unpack left out (absolute ones, or ones leading out of the AppImage). It now names the first five and where they pointed, so a game that won't start for a missing file is found. Tried on bazzite-kde with real releases: Shipwright, Savage Wind, SpartanPort, Dusklight, Wind Waker HD, Melee, Super Mario World, Prime, LAS and MKW all start from their unpacked folders with Easy Setup skipped, with APPDIR, OWD and ARGV0 set. With Easy Setup on, Wind Waker HD, Ridge Racer Type 4, LAS and UltraCombo start (UltraCombo's program named directly, with APPDIR and its lib folder); the others ask for the player's copy first, as they should. * Developer guide: why Linux plays AppImages unpacked, and how to make yours run that way The AppImages section now says why every Linux build of the launcher unpacks an AppImage instead of running it: mounting needs FUSE (and can't happen in the Flatpak at all), a mount is read-only and moves on every start, and updates, saves and mods need a folder they can reach. A new part, "Your AppImage has to run unpacked", asks for the same thing as a tarball, with a way to try it (--appimage-extract, then AppRun with APPIMAGE unset) and what makes it work: find files through APPDIR or /proc/self/exe, bring libraries an rpath or AppRun finds, don't move yourself out of your folder, don't bundle system libraries an AppRun's LD_LIBRARY_PATH would hand to cp and mkdir, and keep links inside. The release rules and Recomp Standards point there, and the AppRun bullets mention OWD and the links left out. * Developer tools warn about a program named inside an unpacked AppImage, and check an AppImage entry as its AppRun A start.program or prepare.program that names a program inside an unpacked AppImage (mkw-recomp's mkw) starts without its AppRun. The launcher gives it the AppImage's library folders, APPDIR and OWD, but nothing else that AppRun sets up. Developer tools now say so in yellow, and say when that's fine: when the program runs on its own. They use the same appimage_root as the start code, so the check and what Play does can't drift apart. Checking a release's own recomplauncher.json, developer tools read it as written, without the AppRun mapping Play applies (profile::to_apprun). So every profile that names its AppImage, as the guide asks, got a red "None of start.program is in this folder" once the AppImage was unpacked, while Play started it fine. The file is now read as Play reads it. The developer guide says when to name a program inside an AppImage and that developer tools warn about it. Tested on bazzite-kde with a debug build and real releases: MKW (profile names mkw) shows "Play starts mkw" with the warning; Savage Wind (profile names its AppImage) shows "Play starts AppRun --game", with no error. cargo test: 1019 passed, 4 of them new.
…ame the folder that stopped it (#467) * A save that can't be put back says which folder stopped it Restoring a copy wrote its folders and files with a bare ?, so a read-only save folder showed only "Read-only file system (os error 30)": no step and no path. It now says the save couldn't be written to its folder, with the folder and the system's reason on the line under it. The file is also closed before its rename, as it was when it was a temporary. * A cloud save that can't be put in place before Play no longer stops the game A player who reinstalled MKW on Linux with cloud saves on got "Read-only file system (os error 30)" on every Play, and the game never started: the newer cloud save was put in place first, a folder it wrote to was read-only, and the error stopped Play. With cloud saves off it played. Before Play, a cloud save that can't be put in place now lets the game start with this PC's save, and the toast says why and names the folder (the trail notes it too). The game's saves are held for the player's pick: the last sync is forgotten and the cloud copy is marked as a conflict, so the save this session makes stops as a conflict instead of going up over the cloud's. Sync Now still shows the error. Downloading the cloud copy into the save copies folder names that folder when it fails, too. * Translations for the cloud save that couldn't be put in place * A program named inside an unpacked AppImage gets the libraries it brings With Easy Setup on, MKW Recomp closed at once with code 127 on Linux: "mkw: error while loading shared libraries: libvpx.so.6". Its profile names mkw, which since AppImages are unpacked (#310) is found in the game's folder and started by itself. Its AppRun is what puts the AppImage's lib/ folder on LD_LIBRARY_PATH, so without it the libraries mkw ships with weren't found. Before #310 the profile's program wasn't there and the AppImage started instead. A program inside an unpacked AppImage that isn't its AppRun now gets the AppImage's own library folders first on LD_LIBRARY_PATH (lib, lib64, usr/lib, usr/lib64 and usr/lib/<arch>-linux-gnu, those that exist), with the PC's own list after them, for Play and for a setup step. A profile can't set that variable itself. The developer guide says so beside the AppRun rules. On bazzite-kde, a fresh MKW install with Easy Setup on stopped with the libvpx error on the old build and reached the game's start screen on this one. * Before Play, a cloud save that can't be put in place asks whether to play with this PC's save The last change let the game start on its own when the cloud's newer save couldn't be put in place, and held the sync for every such failure: a brief download error left a conflict to pick, and the player was never asked. Now the check before Play only says what happened and changes nothing. The window asks "Play Without Your Cloud Save?", naming the folder and the system's reason, with Play with this PC's save and Cancel (Big Picture shows the same as a sheet). Cancel is the old blocked Play. On Play, saves_play_without_cloud keeps the reason on the game's page, and holds the sync only where it has to: when this PC last synced exactly the cloud's save (a reinstall), so the session's save would otherwise go up over it. Any other case already stops as a conflict, and the sync stays as it was. A shortcut start has no window to ask in, so it stops with the reason, as before. * Translations for the question before playing without the cloud save * Move the unpacked AppImage library fix to a PR of its own This reverts 761aa91 ("A program named inside an unpacked AppImage gets the libraries it brings"), which goes in its own pull request with the rest of the unpacked AppImage work, so this one is only about cloud saves.
Builds on #303 (all-or-nothing game updates), which is merged; upstream main is merged in here (0c58e99 for U's final
swap.rs, taken whole; b71ee8f for Beta 65). Draft until reviewed.What
On Linux every game plays from a plain folder. The launcher never runs an AppImage again.
appimage::unpack). SquashFS images are read withbackhand, which was already a dependency for reading manifests. DwarFS images, which pkgforge's Anylinux/uruntime tooling and Tauri's portable AppImage branch write, are read with the newdwarfscrate (zstd only;dwarfs-encis test-only). Both go through the same writer. Nothing of the image runs, and no FUSE is needed. Its files become the game's folder, the AppImage goes, and the game starts from itsAppRunwithAPPDIRandARGV0set, as before. This used to happen only in the Flatpak build (--appimage-extract, which runs the image). Now every Linux build does it, inside U's staging, so it's part of the all-or-nothing step. A release with several AppImages unpacks each into a folder named after it.in_plain_folder). That covers an older non-Flatpak launcher's install, which unpacks in place.APPIMAGE_EXTRACT_AND_RUN, the Flatpak's first-Play unpack into its cache (that cache is deleted once at start), and the AppImage setup's extract-and-run.has_fuse2is now only used by the launcher's own AppImage update. Anything that still reaches an AppImage at Play or setup is refused with a message, never run./proc/self/mountinfo..tar.xzand.tar.zstreleases install (xz2added as a direct dependency, as approved). They rank like.tar.gz, so the tarball-vs-AppImage ranking doesn't change.updated_exefollows an old AppImage install to the new release'sAppRun.find_exeand the profile's….AppImage→AppRunmapping also handle<name>/AppRun.swap::put_in_placeinstead ofinstall::unpack+overlay(overlayis gone).old_release(U's review: a folder where the release has a file, or the other way round, is set aside only when all of it is the old release's):GTK_THEMEtoAdwaita:lightorAdwaita:darkfor the launcher, and itsAppRunsetsPYTHONDONTWRITEBYTECODE=1; both reached every game. They're now removed for games when they have exactly those values. A theme the player set themselves stays.swap::remove_anycalledremove_fileon a junction or folder symlink, which Windows refuses ("Access is denied", os error 5), andinstall::patientthen retried for about 10 s. It now usesremove_dir, which takes the link and leaves its target.Installed.unpacked), so uninstalling can delete it even for a game the player added. A game folder the player put in the Recomp Library themselves, unpacked in place, stays theirs: uninstall leaves it, as before, since it may hold other files of theirs. The unpack's files are still in the record, and a newer AppImage still updates it there.block_in_place, as Bring Your Recomps' does, so it doesn't hold one of the runtime's workers for the minutes a big game takes.Why
AppImages get deleted after they're extracted, they need FUSE to mount, and they can't mount in the Flatpak at all. Plain folders are the stable long-term form. AppImages and macOS
.appbundles that players run outside the launcher keep their OS default paths; this only changes what the launcher runs.Tests
cargo testpassed 827, failed 0.node --test tests/*.test.cjspassed 378, failed 0. Windows 11 VM:cargo test --lib -- swap::passed 19, including the new junction test, which fails on the old code with os error 5. Every commit's tree was tested on its own.tools/launcher-i18n.py --checkoutput is identical to main, and every new text is in all 21 languages..tar.xzand.tar.zst; an old AppImage exe followed toAppRun; mods going in whole and waiting for an unsettled update; bringing in from outside the library, in place inside it, into a folder of the player's own (which stays theirs, and updates there), an update of an earlier one, and a broken one; Play's unpack letting the runtime's other tasks run on a one-worker runtime; mountinfo parsing; the UI message,ownFolder, I Already Have It, and Bring Your Recomps.AppRun,usr/and the desktop file, with no AppImage left. Play started…/dusklight/AppRun.Recomp Library/Dusklight, the message showed, and the file stayed in Downloads.--appimage-extract, with the same files, contents, links and permissions (8,084, 2,314 and 18,282 entries). Each one starts from its unpacked folder. Debug-build unpack times are 31 s, 1.2 s and 6.9 s. Unit tests cover a DwarFS image (setuid can't be written by the encoder, so the SquashFS test covers that), its links, its manifest, a damaged image, and a release's DwarFS AppImage at install.com.recomplauncher.RecompLauncherand driven through tauri-driver inside its own sandbox (--devel, forWebKitWebDriver):release.ymlbuilds it (npm ci, thennpm run build -- --bundles appimage, with Tauri's linuxdeploy). It was built in the Fedora 43 box rather than Ubuntu 24.04, so it needs a newer glibc than a release. It ran on the Bazzite host, with HOME and all four XDG folders in a throwaway home:npm run build -- --bundles appimage -- --locked. Every case above passed the same way on the host, andGTK_THEMEandPYTHONDONTWRITEBYTECODEno longer reach a game.APPIMAGE,APPDIR,OWD,LD_LIBRARY_PATH,GTK_PATH,GTK_*_PREFIX,GST_*,GIO_MODULE_DIR,GDK_PIXBUF_*,GI_TYPELIB_PATHandPERLLIBnever reach a game, and nothing in its environment points into the launcher's mount. AnAppRungame getsAPPDIRset to its own folder.GTK_THEMEandPYTHONDONTWRITEBYTECODEdid reach games and are fixed (above).GTK_OVERLAY_SCROLLING=0comes from WebKitGTK in every build of the launcher, not the AppImage, so it's left as it is.cfg), except the swap fix tested on Windows above.Tarball vs AppImage trial
The 70 catalog projects that ship both were run on bazzite-kde; the full results are in the comment below. The unpacked AppImage starts on the host in 61 of 69. Of the 60 tarballs that are game builds, 44 start. Tarballs fail where they lean on the PC's libraries (FFmpeg 4, Debian's ICU, FLAC and libzip); no AppImage missed a library. None needed
APPIMAGEset. The ranking is unchanged.Of the 254 catalog Linux AppImages, 247 are SquashFS and 3 are DwarFS: OpenGOAL, Carpocalypse 2, and Bloodborne Linux (ayozetr). With the DwarFS reader in the last commit, all of them install.
Patch notes (players)
For the website (SDK guide)
AppRunwithAPPDIRset and noAPPIMAGE. If it won't unpack, your tarball is used, so find your files fromAPPDIRor/proc/self/exe, and you can ship a.tar.xzor.tar.zstas well as a.tar.gz.