Probe sudo non-interactively so unattended updates cannot hang - #9875
Open
konsorsiumai wants to merge 1 commit into
Open
Probe sudo non-interactively so unattended updates cannot hang#9875konsorsiumai wants to merge 1 commit into
konsorsiumai wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
omarchy updaterun non-interactively (scripts, cron, AI agents — a workflow the manual explicitly supports) hangs for exactly 5 minutes and then aborts with "Something went wrong during the update!". By that point the pre-update snapshot has already been created, so the user is left with a confusing failure and no update.Root cause
Three pieces conspire:
omarchy-updatere-executes itself underscript -qefc ... /tmp/omarchy-update.logfor logging, so every step runs with a PTY on stdin.omarchy-update-stay-awake start()picks its privilege runner with[[ -t 0 ]]— which is therefore always true under the logging PTY — and runssudo -v.sudo -vcannot complete without typed input: on current Arch sudo it prompts even whenNOPASSWD: ALLis granted, waitspasswd_timeout(default 300 s), then fails.set -eplus the ERR trap abort the whole update.Journal evidence from a real machine: three failed update attempts at 00:27–00:28, and one that hung from 01:01:58 to exactly 01:07:01 (≈
passwd_timeout) before aborting right after the snapshot step.Reproducer on an affected system (returns nothing until killed, 300 s unattended):
timeout 12 script -qefc 'omarchy-update-stay-awake start' /dev/nullFix
Replace the tty guess with a capability probe:
[[ -t 0 ]]check.Tests
test/shell.d/update-lock-test.shupdated: the sudo stub handles the-n trueprobe, and the terminal-section assertion now verifies the non-interactive probe instead ofsudo -v. All 7 assertions pass.Related (not in this PR)
omarchy-sudo-keepalive(sourced byomarchy-pkg-install/omarchy-pkg-aur-install) opens with a baresudo -vand can hang menu-driven package installs the same way while passwordless sudo is enabled. Happy to file or fix that separately.