Skip to content

Share one sudo authorization until migrations - #13321

Closed
shawnyeager wants to merge 1 commit into
omacom:quattrofrom
shawnyeager:fix/update-sudo-trust-boundary
Closed

shawnyeager wants to merge 1 commit into
omacom:quattrofrom
shawnyeager:fix/update-sudo-trust-boundary

Conversation

@shawnyeager

Copy link
Copy Markdown
Contributor

Fixes #13319.

omarchy update on r2304 asks for the sudo password on every privileged command. The run this morning prompted four times before snapshot cleanup (paccache, snapper list-configs, snapper create, snapper cleanup) and never finished.

bin/omarchy-update revoked the timestamp and installed default/omarchy/sudo-no-update/sudo before any work. That wrapper execs sudo -N. --no-update authenticates and does not write a timestamp, so the next sudo has nothing to reuse. omarchy-update-stay-awake start then sudo -ks on the way in and on the way out, which clears the account timestamp in the middle of the run.

#9469 keeps hooks, AUR builds, mise, and channel hooks from reusing an update's authorization. Migrations are the mixed-trust boundary: they interleave user-controlled code with later privileged repairs. The cold wrapper belongs there, not on prune and snapshot.

This does that.

  • Before omarchy-migrate, prune, snapshot, keyring, and pacman share one cached sudo. The command path stays fixed. A channel switch that already exported OMARCHY_SUDO_NO_UPDATE keeps its wrapper and does not open a caching window.
  • At omarchy-migrate the timestamp is revoked and the no-update wrapper goes on for the rest of the run, including orphan removal and service restarts. Those two run after migrations, so a caching sudo there would republish a ticket for anything a migration started.
  • omarchy-update-stay-awake start uses sudo -N only. It can borrow the cached timestamp without refreshing it, and a successful start no longer revokes. A failed or cancelled launch still revokes. stop still revokes on entry and exit.

#13268 describes the same failure and stops the global wrapper install, but it leaves stay-awake clearing the ticket and it leaves migrations on caching sudo. The tests there stub both, so they stay green.

Verified with update-hook-security, update-user-path, update-sequence, update-lock, channel-sudo-boundary, update-stay-awake-security, and update-pkg-prune.

omarchy update put the no-update sudo wrapper on for the whole run, so
every sudo prompted and none of them saved a timestamp. Cache sudo for
the fixed helpers before migrations, then revoke and install the wrapper
at omarchy-migrate. Stay-awake start authenticates with sudo -N and no
longer clears a timestamp it did not create.
@dhh

dhh commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Thanks for the thorough analysis in #13319. Closing in favor of #13323. The call there is one password for the whole update, including migrations, the post-update hook and mise. AUR updates are the one exception: they run last, with no saved password, through the no-update wrapper. #13323 also covers the stay-awake revocation you identified.

@dhh dhh closed this Sep 26, 2026
@shawnyeager
shawnyeager deleted the fix/update-sudo-trust-boundary branch September 27, 2026 23:17
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.

omarchy update asks for the sudo password on every privileged command

2 participants