omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

omarchy-channel-set asks for the sudo password on every step; the switch never establishes its own authorization

Open nightdevil00 opened this issue 2 months ago • 4 comments

What happened

Switching stable -> edge from the menu (omarchy-channel-set edge) asked for the sudo password 19 times in a single switch on 2026-09-27. Nineteen, for one channel switch.

The run is reproducible from a log of the full session. Mapping each prompt to the step that issued it:

# Step Source
1 sudo cp of /etc/pacman.conf ("Setting channel to edge") omarchy-channel-set:133 via omarchy-refresh-pacman:33
2 pacman -S --needed --noconfirm --ask 4 omarchy-dev omarchy-settings-dev omarchy-channel-set:137
3 paccache -rk2 ("Prune package cache") omarchy-update:66
4-8 snapper config query, create, and cleanup ("Create system snapshot") omarchy-update:71
9-10 pacman-key refresh ("Update Arch signing keys") omarchy-update:78
11 pacman -Syu ("Update system packages") omarchy-update:83
12-13 migration 1788129995, "Replace Satty and Tensaku with Omasnap" omarchy-update:90
14 migration 1788163635, "Remove legacy temporary passwordless sudo grants" omarchy-update:90
15 migration 1788596255, "Add vi as a standard terminal editor" omarchy-update:90
16 migration 1789294350, "Switch TCP congestion control to BBR with fq pacing" omarchy-update:90
17 migration 1789764927, "Enable OWE desktop video backgrounds and lock feed" omarchy-update:90
18 migration 1790042972, "Install Elsewhen" omarchy-update:90
19 pacman -Rns ("Removing orphan system packages") omarchy-update:91

Steps 3-19 are all the hand-off update, not the switch itself. 41 of the shipped migrations call sudo, so this count scales with how many of them your machine has pending.

#13323 already fixed most of this

This report is a follow-up, not a duplicate. #13319 was closed by #13323 ("Ask for the sudo password once per omarchy update"), merged 2026-09-26. My run is omarchy-dev 4.0.0.r2304.g7b336b1-1, which predates that merge and still has the old shape: omarchy_security_enable_no_update_sudo at omarchy-update:28 puts the no-update wrapper on PATH for the whole run, and per-phase sudo -k revokes mean no timestamp survives to the next helper. That is the r2304 behaviour and it accounts for steps 3-19.

So the remaining gap is the one #13323's own description names:

Channel switching still authorizes its own steps command by command. The update it hands off to then asks once for its own phases.

The remaining gap, on current master

omarchy-channel-set still has no authorization of its own. It revokes the timestamp on entry (omarchy-channel-set:21) and never establishes one, so each of its privileged steps starts cold:

  1. omarchy-refresh-pacman revokes on entry (:24), then sudo cp (:33-37) — prompt 1.
  2. It revokes again around the pre-refresh-pacman hook (:44, :47) and calls pacman -Syyuu (:50) — prompt 2. Its EXIT cleanup trap (:23) revokes once more.
  3. omarchy-update-pacman -S --needed for the omarchy <-> omarchy-dev swap (omarchy-channel-set:137) — prompt 3. The cleanup trap on omarchy-channel-set revokes again.
  4. The hand-off omarchy-update then establishes its own — prompt 4.

That is four password entries for a channel switch where omarchy update now costs one, and on r2304 it was nineteen. I verified bin/omarchy-refresh-pacman and bin/omarchy-channel-set on master are byte-identical to the r2304 copies I ran, so this gap is still live.

Expected

A channel switch is a single user-initiated operation against the same machine, in the same terminal, with the same trust level as omarchy update. It should cost the same one authorization, not four.

Suggested direction

omarchy-channel-set already brackets itself with omarchy_security_install_sudo_cleanup_traps / omarchy_security_revoke_sudo_timestamp. It could establish one authorization after its entry revoke, in the same shape #13323 gave omarchy-update — one sudo /usr/bin/true and a keepalive — and hand that timestamp to the steps it trusts, omarchy-refresh-pacman and omarchy-update-pacman.

The two revokes inside omarchy-refresh-pacman are the part that needs care: they exist because pre-refresh-pacman is a user hook, and the comment at :41-43 is explicit that authorization the hook obtained must not carry into the transaction. Revoking the parent's shared authorization there would be wrong. The split that #13323 used is the obvious one: trusted steps reuse the shared authorization, the user hook and the transaction after it run cold. That still costs a second prompt after the hook, unless the hook boundary is what gets relaxed.

Worth deciding explicitly rather than inheriting: the pre-refresh-pacman hook is the only genuinely untrusted code between the first and last channel-switch prompts. Everything else in the switch is Omarchy's own scripts.

System details

Omarchy        4.0.0.r2304.g7b336b1-1 (omarchy-dev / omarchy-settings-dev, edge)
OMARCHY_PATH   /usr/share/omarchy
channel        stable -> edge
kernel         7.2.5-3-omarchy running, 7.2.5-4 installed by this switch
CPU            Intel Core i7-10750H (CometLake-H)
GPU            Intel UHD (GT2) + NVIDIA GTX 1650 Ti (hybrid)
sudo           1.9.17p2
date           2026-09-27

I can attach the full 981-line log from this run if it is useful.

nightdevil00 avatar Sep 27 '26 15:09 nightdevil00

output.log

nightdevil00 avatar Sep 27 '26 15:09 nightdevil00

Confirmed on quattro at f5006bd, and the count is higher than four: a channel switch asks for the password nine times on a machine without passwordless sudo, for stable, rc, edge and dev alike.

omarchy-channel-set revokes the timestamp on entry and puts the no-update wrapper on PATH, so every bare sudo in the switch becomes sudo -N, which authenticates without caching anything. Each privileged command therefore prompts on its own:

  • four sudo cp calls in omarchy-refresh-pacman (:45, :46, :48, :49), the two backups and the two templates
  • the refresh's pacman -Syyuu (omarchy-refresh-pacman:62)
  • the package swap pacman -S --needed --ask 4 (omarchy-channel-set:165)
  • two in omarchy-dev-unlink (sudo tee /etc/omarchy.conf and sudo rm of the sudoers drop-in, :52, :57), which runs on every non-dev switch even when nothing is linked; a switch to dev makes two in omarchy-dev-link instead (:113, :115)
  • then one for the hand-off omarchy update, which authorizes once for its own phases, as #13323 made it

I ran the repository's own sudo-boundary fixture (test/shell.d/channel-sudo-boundary-test.sh) on a clean Omarchy worker and counted the sudo -N calls before the update's authorization: seven for each channel, with link and unlink stubbed to one call each. The real link and unlink make two, which gives nine. The pre-refresh hook and AUR packages can add more.

This is deliberate, not an oversight: the same test asserts that "the switch itself authorizes command by command", and requires the timestamp to be revoked right before and right after the pre-refresh-pacman hook. As you point out, a single authorization would have to either survive that user hook or be asked for again after it. Which of those to do, or whether to only group the trusted steps before the hook (the four copies and the unlink could share one prompt without touching the hook boundary), is a decision about the sudo boundary that the maintainer will make. So I have not opened a fix.

Codex at medium effort reviewed this as a second opinion. It worked out the same nine prompts from the source without being given that count, and also concluded that changing the tested policy is a design decision rather than a contained fix. Its independence from my reasoning is not guaranteed.

Related: #13417 covers the edge package still shipping the pre-#13323 updater, which is what made your run nineteen prompts. #13416 is your separate report on the hard-coded omarchy-update -y.

Waiting on the maintainer.

omarchybot avatar Oct 13 '26 03:10 omarchybot

i think this is the same bug

omarchy channel set dev times out and fails while waiting for password

so you cannot run it unattended

osde8info avatar Nov 28 '26 17:11 osde8info

I checked the channel switch and update hand-off on quattro. #17000 restored ordinary sudo caching and is in v4.6.0-rc1. #20403 (0ca92c3c46) then removed the extra prompt at the hand-off by running the switch and updater in the same terminal. Its QEMU test of a menu switch to edge went from two prompts to one. The second fix landed after v4.6.0-rc1 and is awaiting a release tag. A refresh that outlasts the default 10-minute sudo timeout can still prompt again.

For the November 28 report, omarchy channel set dev requires interactive confirmation and may prompt for sudo. If it times out while you’re running it in a terminal and responding to the prompts, please share your Omarchy version, how you launched it, and the exact output.

GPT-6 in Codex at high effort checked the source and release tags. Opus 5.5 High reviewed the same evidence and agreed on the hand-off and the need for terminal details. Independence is not guaranteed.

omarchybot avatar Nov 28 '26 18:11 omarchybot