Skip to content

Restart after an update without app.relaunch() - #15

Merged
redacid merged 1 commit into
mainfrom
fix/update-relaunch
Dec 3, 2026
Merged

redacid merged 1 commit into
mainfrom
fix/update-relaunch

Conversation

@redacid

@redacid redacid commented Dec 3, 2026

Copy link
Copy Markdown
Owner

The second in-app update in a row failed with "administrator authentication was cancelled or failed"; after starting the app by hand it worked.

Cause. electron-updater restarts the app with app.relaunch(), and Chromium launches that process with no_new_privs. Every child inherits it, so setuid pkexec cannot gain root and exits before showing a password dialog. Seen on the installed app: the relaunched process had NoNewPrivs: 1 (parent pid 1), and polkit logged nothing for the failed attempt, while the earlier install logged authentication and dpkg -i.

Fix

  • deb/rpm: autoRunAppAfterInstall = false and quitAndInstall(false, false); after a successful install, relaunch.ts starts a detached waiter (the app binary with ELECTRON_RUN_AS_NODE, no shell) that waits for the old process to exit (single-instance lock), then starts the app with the same arguments, without no_new_privs.
  • A failed install does not relaunch; the update stays ready.
  • A process that already has no_new_privs does not try pkexec; it tells the user to quit from the tray and start the app again (needed once for processes relaunched by 0.2.11 and older).
  • AppImage unchanged (electron-updater spawns the new file directly).

Tested

  • make check: 203 tests (relaunch only after success, NNP refusal without pkexec, waiter starts the command after the old process exits with its arguments and without ELECTRON_RUN_AS_NODE).
  • ELECTRON_RUN_AS_NODE works with the installed binary.
  • Not yet tested: two real updates in a row (needs two releases).

Docs: docs/install.md, docs-dev/architecture.md (App updater).

After "Update and restart", electron-updater starts the app again with
app.relaunch(), and Chromium launches that process with no_new_privs.
The flag is inherited by every child and makes setuid pkexec fail at
once, so the next update failed with "administrator authentication was
cancelled or failed" until the user quit and started the app by hand.

For deb and rpm, turn off electron-updater's relaunch and start the app
ourselves: a detached waiter (the app binary with ELECTRON_RUN_AS_NODE,
no shell) waits for the old process to exit, since it holds the
single-instance lock, then starts the app with the same arguments. A
process that already has no_new_privs does not try pkexec and says to
restart the app instead. AppImage keeps electron-updater's own start.
@redacid
redacid merged commit 50afe47 into main Dec 3, 2026
8 checks passed
redacid pushed a commit that referenced this pull request Dec 3, 2026
Version bump and changelog for restarting after an update without app.relaunch() (#15).
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.

1 participant