Fix omarchy update and yay --sudoloop prompting for a password despite NOPASSWD sudo
Cause confirmed. omarchy-update-stay-awake line 95 is sudo -v under [[ -t 0 ]] on 4.0.4-1. Issue #9066 is open and shows the same cause, with verifypw=any as its verified workaround. #10352 was closed as a duplicate and offers editing the existing rule. PR #13323 switched to sudo /usr/bin/true for this reason. sudoers(5) gives verifypw all/any/always/never with default all, and omarchy-sudo-passwordless writes ${USER} ALL=(ALL) NOPASSWD: ALL to /etc/sudoers.d/99-omarchy-nopasswd-$USER. The danger is wrong. In sudo's plugins/sudoers/check.c, when authentication is disabled (NOPASSWD, or verifypw never/any satisfied), check_user jumps to success with no timestamp cookie, and timestamp_update returns early on a NULL cookie. So a passwordless sudo -v writes no timestamp and hands out no password-free sudo. The record also misses a real side effect. omarchy-settings 4.0.4-1 ships %wheel ALL=(root) NOPASSWD: rules (omarchy-dns, omarchy-theme-set-browser-policy, timedatectl set-timezone), which I read from the cached package. With verifypw=any, every wheel user's sudo -v therefore succeeds without a password even when they have no general NOPASSWD grant. The omarchy sudo passwordless grant expires and tmpfiles removes it at boot, but the verifypw drop-in stays. After expiry, sudo -v stops priming the timestamp and yay's sudoloop keeps nothing alive. The fix now says this and offers Defaults:<user> !authenticate for a permanent passwordless user. Not exercised: no sudoers file was changed, and /etc/sudoers is not readable unprivileged.
A sudoers file with a syntax error or wrong mode disables sudo for everyone: keep a root shell open and run sudo visudo -c before closing it. Defaults:<user> !authenticate makes every sudo command passwordless for that user, so use it only where that is already the intent. verifypw=any or never does not create a sudo timestamp, but it makes sudo -v report success without checking anything, so scripts that use sudo -v as a gate or a keepalive (yay's sudoloop) stop doing their job.
Symptom
You enabled passwordless sudo (with omarchy sudo passwordless, or your own NOPASSWD: ALL drop-in), and sudo pacman -S foo indeed runs without a password. But omarchy update still stops at:
[sudo] password for <user>:
and an unattended omarchy update -y hangs there for five minutes, then aborts after the pre-update snapshot was already taken. yay --sudoloop prompts at start for the same reason. Some setups end with sudo: a password is required instead.
Cause
Those prompts come from sudo -v, not from running a command. sudo -v is governed by the sudoers option verifypw, whose default is all: every sudoers entry matching the user on this host must carry NOPASSWD, or -v asks for a password. A stock install still has the password-requiring %wheel rule (or a per-user ALL=(ALL) ALL file) alongside the new NOPASSWD drop-in, so commands run passwordless while validation does not.
On Omarchy 4.0.4 the call is in omarchy-update-stay-awake (line 95, sudo -v), which omarchy update reaches because it runs under script, so [[ -t 0 ]] is true even unattended (issue #9066, open). yay's sudoloop is also sudo -v in a loop. PR #13323 on quattro (not yet released) switches the update's own authorization to sudo /usr/bin/true for this reason.
Fix
Confirm it is validation and not commands:
sudo -n true && echo 'commands: passwordless'
sudo -n -v && echo 'validate: passwordless' || echo 'validate: needs a password'
sudo -l | sed -n '/may run/,$p' # the matching entries, NOPASSWD or not
If your passwordless sudo is permanent (your own NOPASSWD: ALL drop-in), the cleanest fix is to put NOPASSWD: into the rule file that already matches you instead of keeping a second file, as issue #10352 suggests:
sudo grep -rn "$USER\|%wheel" /etc/sudoers /etc/sudoers.d/
Then edit the matching line with sudo visudo -f <file>. Omarchy's own %wheel ... NOPASSWD: /usr/bin/omarchy-dns ... style rules can stay, because they already carry NOPASSWD.
An equivalent for a user who is meant to be passwordless everywhere is to turn authentication off for that user, which also covers sudo -v:
echo "Defaults:$USER !authenticate" | sudo tee /etc/sudoers.d/90-noauth >/dev/null
sudo chmod 0440 /etc/sudoers.d/90-noauth
sudo visudo -c
The narrower workaround from issue #9066 lets validation succeed when at least one of your entries is NOPASSWD:
echo "Defaults:$USER verifypw=any" | sudo tee /etc/sudoers.d/90-verifypw >/dev/null
sudo chmod 0440 /etc/sudoers.d/90-verifypw
sudo visudo -c
Know its side effect on Omarchy 4 before using it. omarchy-settings ships several %wheel rules with NOPASSWD, so with verifypw=any your sudo -v never prompts, even after a temporary omarchy sudo passwordless grant has expired. A sudo -v that skips authentication writes no timestamp, so after that point sudo -v no longer primes the cache and yay --sudoloop keeps nothing alive. Remove /etc/sudoers.d/90-verifypw when you stop using passwordless sudo.
Re-run omarchy update afterwards. Omarchy after PR #13323 reaches a release authorizes with sudo /usr/bin/true instead of sudo -v, so none of this is needed there.
Verify
sudo -k; sudo -n -v && echo ok prints ok. omarchy update -y runs through the stay-awake step without a prompt.
Sources
- https://github.com/omacom/omarchy/issues/9066
- https://github.com/omacom/omarchy/issues/10352
- https://github.com/omacom/omarchy/pull/13323
- https://man.archlinux.org/man/sudoers.5
- https://github.com/Jguer/yay/blob/next/pkg/settings/exe/cmd_builder.go
- https://wiki.archlinux.org/title/Sudo
- https://raw.githubusercontent.com/sudo-project/sudo/main/plugins/sudoers/check.c
- https://raw.githubusercontent.com/sudo-project/sudo/main/plugins/sudoers/timestamp.c