Markpad icon indicating copy to clipboard operation
Markpad copied to clipboard

Linux: .deb, .rpm and snap installs are offered an update they cannot install

Open PathGao opened this issue 3 months ago • 0 comments

Summary

On Linux, a .deb, .rpm or snap install is offered an update it cannot install. Check for Updates… reports a newer version, and pressing install fails — the updater tries to overwrite the running binary in place, which needs root for /usr/bin and is impossible on the snap's read-only squashfs.

Only the AppImage can actually self-update. The other three are told they can.

Root cause: it is the same missing symbol build.yml already documents

tauri-plugin-updater picks its install strategy from tauri_utils::platform::bundle_type(), which reads a static patched into the binary after the build:

// tauri-utils-2.9.3/src/platform.rs
static mut __TAURI_BUNDLE_TYPE: &str = "__TAURI_BUNDLE_TYPE_VAR_UNK";

pub fn bundle_type() -> Option<BundleType> {
  match __TAURI_BUNDLE_TYPE {
    "__TAURI_BUNDLE_TYPE_VAR_DEB" => Some(BundleType::Deb),
    "__TAURI_BUNDLE_TYPE_VAR_RPM" => Some(BundleType::Rpm),
    "__TAURI_BUNDLE_TYPE_VAR_APP" => Some(BundleType::AppImage),
    …
    _ => if cfg!(target_os = "macos") { Some(BundleType::App) } else { None },
  }
}

That patch fails on Linux. From the v2.7.2 release build (Build Linux, three times — once per bundle):

Warn Failed to add bundler type to the binary: __TAURI_BUNDLE_TYPE variable not
found in binary. … Updater plugin may not be able to update this package.

build.yml already records this, in the comment explaining why latest.json uses plain {os}-{arch} keys — Windows and Linux clients cannot ask for an installer-suffixed key because they do not know their own bundle type. The consequence for latest.json was understood. The consequence for installing was not:

// tauri-plugin-updater-2.10.1/src/updater.rs
fn install_inner(&self, bytes: &[u8]) -> Result<()> {
    match installer_for_bundle_type(bundle_type()) {
        Some(Installer::Deb) => self.install_deb(bytes),
        Some(Installer::Rpm) => self.install_rpm(bytes),
        _ => self.install_appimage(bytes),      // ← None lands here
    }
}

bundle_type() is None for every Linux package, so install_deb and install_rpm are dead code in our builds and deb, rpm and snap all take install_appimage. That path takes extract_path (on Linux, current_exe() — the real running binary) and renames a downloaded file over it:

AppImage   $APPIMAGE, a file the user owns        →  works
.deb       /usr/bin/Markpad                        →  EACCES, needs root
.rpm       /usr/bin/Markpad                        →  EACCES, needs root
snap       /snap/markpad/<rev>/bin/markpad         →  EROFS, read-only squashfs

The check half succeeds for all four, because latest.json publishes linux-x86_64 and every Linux build asks for exactly that key — which is correct and must stay, for the reason build.yml gives.

Why it surfaces now

It has always been true. It is worth fixing now for two reasons: #566 documents .deb/.rpm as one-time installs, and that documentation is only honest if the app stops offering an install it cannot perform; and #562 is weighing whether to keep the snap, where this is one more thing that does not work.

Scale, for proportion — GitHub asset downloads for v2.7.2: AppImage 26, .deb 15, .rpm 3. So roughly 18 users per release can reach this, plus however many are on the snap.

Suggested fix

Do not offer what cannot be done. On Linux, self-update is possible only when the process is running from an AppImage, which is detectable at runtime — tauri_utils::Env already reads APPIMAGE/APPDIR and validates that current_exe() is under $TMPDIR/.mount_, precisely so the variable cannot be spoofed.

So a one-value command, and one branch in update.svelte.ts's runCheck(), which is the single entry point for the whole flow: when self-update is not available, say the install came from a package manager and point at the releases page, instead of running a check whose only possible outcomes are "up to date" or an install that fails.

Deliberately not proposed:

  • Making install_deb/install_rpm reachable. Both shell out to pkexec/sudo, so it would turn Check for Updates… into a password prompt, and it would still be wrong for the snap. It also depends on an upstream patch that does not currently work for us.
  • Removing linux-x86_64 from latest.json. That is the key AppImage clients ask for; dropping it strands the one Linux package that does work.

Happy to open the PR if the shape sounds right.

PathGao avatar Aug 10 '26 11:08 PathGao