Flatpak: include the bundle in update info, and add an opt-in FlatpakUpdater

Author: oalfroukhCreated Sep 30, 2026Updated Sep 30, 2026
  • Electron-Builder Version: 26.15.7
  • Electron Updater (as-needed): 6.8.9
  • Node Version: 22.22.3
  • Electron Version: 43.7.6
  • Platform & Target: Linux, flatpak target (Ubuntu 26.04 LTS, GNOME, Flatpak 1.16.6)
  • Debug Logs: n/a (feature request)

Summary

Apps that distribute their Flatpak build as a standalone .flatpak bundle through a generic or GitHub provider, rather than through Flathub or another Flatpak remote, have no auto-update path with electron-updater today. I'd like to propose two changes and am happy to open a PR:

  1. The flatpak target writes the bundle into the update info file, like deb, rpm and AppImage.
  2. An opt-in FlatpakUpdater in electron-updater.

Both are opt-in, so nothing changes for existing Flatpak apps, including those on Flathub.

Current behavior

  • FlatpakTarget calls emitArtifactBuildCompleted({ ..., isWriteUpdateInfo: false }), so the .flatpak bundle never appears in latest-linux.yml.
  • Inside a Flatpak sandbox, doLoadAutoUpdater() falls back to AppImageUpdater, which disables itself because APPIMAGE is unset. That's the right outcome by default, and Flathub apps rely on it: a Flatpak app shouldn't start updating itself without opting in.

Proposal

1. FlatpakTarget: include the bundle in the update info

Set isWriteUpdateInfo: true and pass updateInfo: { sha512, size }, as FpmTarget does. The sha512 key is needed: createUpdateInfo() only merges updateInfo into files[0] when it contains sha512. A size-only object ends up in the legacy top-level fields instead.

2. Opt-in marker

When the app has a publish configuration, write package-type = flatpak into the bundle's resources directory (/app/lib/<appId>/resources/), the same way FpmTarget writes it for deb/rpm/pacman. It would be added through the flatpak stage files, so the shared linux-unpacked directory isn't touched.

3. electron-updater: FlatpakUpdater

doLoadAutoUpdater() picks it only when FLATPAK_ID is set and package-type is flatpak. Flatpaks built any other way (for example from Flathub manifests) never have the marker and keep today's behavior.

What it does. All of this was verified live; see "Tested" below.

  • Download: the .flatpak file from the feed, like the other Linux updaters.
  • Install: flatpak-spawn --host flatpak install --<scope> --bundle -y <file>. A sandboxed process can't run flatpak itself. flatpak-spawn --host needs --talk-name=org.freedesktop.Flatpak in the app's finishArgs. Installing a newer bundle over an existing install is a normal update: flatpak history logs it as deploy update.
  • Scope (--user / --system): read from [Instance] app-path in /.flatpak-info (/var/lib/flatpak/... means system). Not from flatpak info <id>: when the app is installed in both scopes, that reports one of them regardless of which instance is running.
  • System scope: the command is wrapped with pkexec, as in DebUpdater/RpmUpdater. Without it the call is rejected outright with Flatpak system operation InstallBundle not allowed for user, even though org.freedesktop.Flatpak.install-bundle is auth_admin_keep: polkit doesn't prompt for a caller reached through flatpak-spawn --host. With pkexec, the normal polkit password dialog appears and the update succeeds.
  • Relaunch: flatpak-spawn --host flatpak run --<scope> <FLATPAK_ID> rather than app.relaunch(). app.relaunch() re-executes inside the current sandbox, whose /app is still mounted from the old commit; a fresh flatpak run starts on the new one. The scope is passed explicitly because flatpak run defaults to --system when both scopes are installed.
  • Failure: if the install command fails, doInstall() returns false, so quitAndInstall() doesn't quit the app and the error is emitted. For example, reinstalling the same commit fails with This version of <id> is already installed.

Security note for the docs: --talk-name=org.freedesktop.Flatpak lets the app run commands on the host, which effectively removes the Flatpak sandbox. It should be documented as a deliberate trade-off for self-distributed bundles, and not used for apps on Flathub, which updates its apps itself.

Why not a Flatpak remote

For apps on Flathub or another Flatpak remote, flatpak update (or the UpdateMonitor in org.freedesktop.portal.Flatpak) is the right mechanism, and this proposal doesn't change that. It targets apps that ship a standalone bundle through the same providers they already use for deb/rpm/AppImage, where there's no remote to update from.

Tested

Ubuntu 26.04 LTS (GNOME), Flatpak 1.16.6, Electron 43.x, electron-updater 6.8.9, app-builder-lib 26.15.7, generic provider:

  • User-scope install: updated from an older build to a newer one in-app and relaunched on the new version, with no prompt.
  • System-scope install: the same, with the polkit password prompt.
  • Update info: the flatpak entry appears in the yml with sha512 and size inside files[0].

Questions

  1. Is the package-type marker acceptable as the opt-in, or would you prefer something else, such as a config option?
  2. Is one PR covering both app-builder-lib and electron-updater OK?

Source: electron-userland/electron-builder