Skip to content

fix(updater): don't fail AppImage installs when the temp dir is another mount of the same file system - #3688

Merged
lucasfernog merged 2 commits into
tauri-apps:v2from
followdarko:fix/updater-appimage-cross-mount
Oct 10, 2026
Merged

lucasfernog merged 2 commits into
tauri-apps:v2from
followdarko:fix/updater-appimage-cross-mount

Conversation

@followdarko

Copy link
Copy Markdown
Contributor

On Linux, an AppImage update can fail on every attempt with Invalid cross-device link (os error 18).

install_appimage picks the first of temp dir / cache dir / the AppImage's own directory whose st_dev matches the AppImage, and renames the running AppImage into it as a backup. Matching st_dev doesn't mean the rename can work, though: two mounts of the same file system (a bind-mounted /tmp, systemd's PrivateTmp) report the same st_dev, and rename(2) still refuses to cross them with EXDEV. The function returns that error straight away, so it never gets to the AppImage's own directory, which is the one location that is always on the same mount. Retrying picks the same temp dir and fails the same way.

We hit this with a user on NixOS: five failed installs in a row, all Io(CrossesDevices).

The fix: when the backup rename fails with ErrorKind::CrossesDevices, try the next location instead of returning. Nothing has been touched yet at that point (the rename failed, the TempDir is dropped), and the last location is the AppImage's own directory, so the loop now always ends on a mount the rename can use. ErrorKind::CrossesDevices is stable since 1.85, MSRV is 1.90.

Testing: I didn't find a way to make EXDEV happen in a unit test without mounting something, so I checked it in a privileged Docker container (Debian, rust 1.90). /data/tmpsrc is bind-mounted at /tmp2, the AppImage is /data/apps/Any.AppImage, run with TMPDIR=/tmp2 and a cache dir that is another bind mount:

  • both paths report st_dev 64
  • install_appimage from v2 copied into a small binary: Io(Os { code: 18, kind: CrossesDevices, message: "Invalid cross-device link" }), AppImage left as it was
  • the same code with this change: Ok(()), the AppImage has the new contents, nothing is left behind in the directory

cargo fmt --check is clean. I could not run clippy for the crate on Linux locally (the gtk build runs out of memory in my container), so CI gets the first word there.

Two mounts of one file system share st_dev, so install_appimage could
pick a bind-mounted or private temp dir and then fail every install with
EXDEV. Move on to the next location instead; the last one is the
AppImage's own directory.
@followdarko
followdarko force-pushed the fix/updater-appimage-cross-mount branch from 90a1daa to 7e77005 Compare October 10, 2026 16:23
lucasfernog
lucasfernog previously approved these changes Oct 10, 2026

@lucasfernog lucasfernog left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch

@lucasfernog
lucasfernog merged commit b6f39cc into tauri-apps:v2 Oct 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants