[stable 4.0.4] Interrupted update leaves root-owned inhibitor blocking suspend
System details
- Omarchy: 4.0.4-1 (stable)
- Kernel: 7.2.5-3-omarchy
- systemd: 261 (261.2-1-arch)
- Architecture: x86_64
What's wrong?
An interrupted omarchy update can leave its privileged systemd-inhibit process running indefinitely. The inhibitor blocks both sleep and idle, so the system-menu Suspend action (systemctl suspend) silently fails even though no update or package operation remains active.
The leftover inhibitor was visible with systemd-inhibit --list:
WHO WHAT WHY MODE
omarchy-update sleep:idle Omarchy update in progress block
The updater itself was gone, but this process chain had survived for about eight hours:
sudo systemd-inhibit --what=sleep:idle --who=omarchy-update \
--why="Omarchy update in progress" --mode=block sleep infinity
└─ sudo systemd-inhibit ...
└─ systemd-inhibit ...
└─ sleep infinity
The state file recorded the first sudo wrapper PID:
$ cat "$XDG_RUNTIME_DIR/omarchy-update-stay-awake/inhibit-pid"
139215 295390
That PID was root-owned. omarchy-update-stay-awake stop runs as the desktop user and executes:
kill "$inhibit_pid" >/dev/null 2>&1 || true
The signal therefore fails with EPERM. The subsequent start-time check sees the process still alive and reports:
Failed to stop the Omarchy update sleep inhibitor.
Because start() begins by calling stop, later update attempts do not recover the stale inhibitor either.
Steps to reproduce
- Start
omarchy updateand let it reachomarchy-update-stay-awake start. - Interrupt or kill the updater before its normal cleanup completes.
- Confirm there is no remaining
omarchy-update,pacman,yay, orparuoperation. - Run
systemd-inhibit --list; the root-ownedomarchy-updateblocker remains. - Run
omarchy update stay awake stopas the desktop user; it cannot kill the recorded root-owned PID. - Select Suspend from the system menu or run
systemctl suspend; logind refuses the operation because the block inhibitor remains.
Expected behavior
Update cleanup should reliably terminate its own privileged sleep inhibitor. A later start or stop invocation should also recover a stale inhibitor after an interrupted update.
Actual behavior
The root-owned inhibitor survives after the update is gone and blocks suspend indefinitely, until the process is terminated with privilege or the machine is rebooted.
Likely cause
omarchy-update-stay-awake start launches sudo systemd-inhibit ... & and stores $!. That PID belongs to the privileged sudo process by the time cleanup runs. stop later attempts an ordinary unprivileged kill, suppresses its failure, and cannot release the inhibitor.
This appears hardware-independent. The symptom initially looked like a Dell/NVIDIA suspend problem, but the journal showed no new suspend attempt; after terminating only the stale inhibitor, suspend was unblocked.
Possible direction
Keep an unprivileged supervisor PID that can be signaled by the user and have it own/reap the privileged child, or make stop use the update's established privileged-command boundary to terminate the validated PID. The existing PID start-time check should remain to avoid PID-reuse mistakes.
Related but distinct: #8077 concerns children inheriting the update lock fd. This report concerns the update-owned sleep inhibitor itself surviving cleanup and blocking suspend.
After checking current quattro, I found that the underlying lifecycle/privilege problem has already been fixed by merged PR #9467 (6af052fc, “Bind update inhibitor cleanup to owned process identity”), with termination behavior refined in #13361. Current quattro launches a token-identified holder that drops back to the invoking user, validates PID/start-time/owner/token before signaling, handles legacy state, and has regression coverage in update-lock-test.sh and update-stay-awake-security-test.sh.
This report was reproduced on the current stable package, Omarchy 4.0.4-1, whose installed helper still uses the older sudo systemd-inhibit ... & plus unprivileged kill "$inhibit_pid" implementation. I have updated the title to clarify the affected channel/version.
I am not opening a duplicate PR against quattro. Please treat this issue as tracking whether the existing fix should be included in the next stable release or backported, if the project still ships 4.0.4 for a meaningful interval.
Additional data point on 4.0.4-1 stable: this also happens on a normal, uninterrupted omarchy update. All steps completed (pacman, AUR, mise), then the EXIT trap's omarchy-update-stay-awake stop hit the same EPERM on the root-owned sudo PID and printed "Failed to stop the Omarchy update sleep inhibitor." followed by "Something went wrong during the update!". In my case the inhibitor was gone afterwards (presumably torn down with the terminal), so suspend was not blocked, but every update on stable seems to end in a false failure. That may strengthen the case for shipping #9467 to stable.
Filed by Claude Opus 5.5 via Claude Code.
Checked the released helper, the fix on quattro, and both on a worker built from the Omarchy ISO.
Released code. v4.0.4 and v4.0.5 ship the same bin/omarchy-update-stay-awake: start records $! of a backgrounded sudo systemd-inhibit … sleep infinity, and stop sends that PID a TERM, discards any error, and reports "Failed to stop the Omarchy update sleep inhibitor." if it is still alive after about a second. omarchy update calls stop at the end and again from its EXIT trap, so that failure is also what produces "Something went wrong during the update!".
The EPERM explanation did not hold up. On the worker (sudo 1.9.17p2), running v4.0.5's start then stop from one shell on a tty produced exactly the chain in the report (sudo → sudo → systemd-inhibit → sleep), but the outer sudo's real UID is the invoking user (Uid: 1000 0 0 0), so an unprivileged kill is allowed, and stop released the inhibitor and exited 0. Without a tty the result was the same. Two cases fit both reports better, and neither is established yet: sudo declining to forward a TERM depending on the sender's process group, or a configuration where sudo execs the command directly so the recorded PID really is root's. Either way, the stale inhibitor and the false failure at the end of an update are real symptoms from two separate reports.
Fixed on quattro, not released. 6af052fc (#9467) replaces the mechanism: the privileged systemd-inhibit holds a shell that drops back to the invoking user with setpriv and records its own PID, start time, owner and a launch token, and stop signals that shell after checking all four. It no longer signals sudo at all, so it does not matter which of the causes above was at work. 8cd727df (#13361) makes that shell exit cleanly on TERM. On the worker, quattro's helper held and released its inhibitor cleanly. Neither commit is in any release tag; v4.0.5 (cut after both landed) is not on quattro's line and still has the old helper.
One thing for whoever ships it: on the first update off 4.0.x, the new stop meets the old two-field record. It signals the outer sudo only when that process's real UID matches the caller, and otherwise keeps the state and reports failure. It has no privileged fallback, so a stale 4.0.x inhibitor that resists TERM still needs a reboot, once.
The second opinion was Codex at medium effort. It agreed on the fix and the release status, independently ruled out EPERM from the kill(2) rule, and pointed to sudo's process-group forwarding rule in its source. Its agreement is not guaranteed to be independent.
Whether to backport the fix to stable or wait for the next release is the maintainer's call, so this waits on them. No pull request was opened, since the fix already exists on quattro.
Another way to reach the same root-owned leftover inhibitor, with no interruption: running omarchy update -y with stdin that is not a TTY (for example, from an agent or a script).
omarchy-update-stay-awake start takes the pkexec branch when [[ -t 0 ]] is false, so systemd-inhibit runs as root. stop then calls a plain kill "$inhibit_pid" as the user. This fails with EPERM, which || true hides. The wait loop times out, and the script prints:
Failed to stop the Omarchy update sleep inhibitor.
Something went wrong during the update!
So the update reports failure after every package installed successfully, and the inhibitor stays:
$ ps -o pid,user,args -p 71840
71840 root /usr/bin/systemd-inhibit --what=sleep:idle --who=omarchy-update --why=Omarchy update in progress --mode=block sleep infinity
$ systemd-inhibit --list | grep omarchy-update
omarchy-update 0 root 71840 systemd-inhibit sleep:idle Omarchy update in progress block
sudo kill 71840 removed it. A fix would be for stop to use the same privilege runner as start (or have the inhibitor run as the user, since sleep:idle blocking does not need root under polkit defaults for an active session).
Seen on Omarchy 4.0.5, systemd 262.1-1, 2026-10-22.
Checked the new report of the pkexec path against v4.0.6 and quattro, and reproduced both on a worker built from the Omarchy ISO.
The pkexec path is confirmed. In the released helper (bin/omarchy-update-stay-awake:92-121, the same file in v4.0.4, v4.0.5 and v4.0.6), when stdin is not a terminal start launches pkexec systemd-inhibit … &. pkexec runs the command in the same process as root, so the PID it records is root's, with real, effective and saved UID all 0. On the worker, run without a terminal from a user service (with a polkit rule standing in for authenticating at the prompt), the recorded PID was /usr/bin/systemd-inhibit … sleep infinity owned by root (Uid: 0 0 0 0). stop printed "Failed to stop the Omarchy update sleep inhibitor." and exited 1, a plain kill of that PID was refused with "Operation not permitted", and the inhibitor stayed in systemd-inhibit --list. A second start failed the same way, because it calls stop first. Unlike the sudo chain checked earlier, this is a real EPERM.
How it is reached. omarchy update re-runs itself under script -qefc (bin/omarchy-update:10-13), and that gives the helper a terminal even when the update's own stdin is not one (checked on the worker), so the update itself takes the sudo branch. The pkexec branch is taken when the helper starts without a terminal some other way, for example run on its own, or with OMARCHY_UPDATE_LOGGED already set in the environment so the script step is skipped. I could not establish which of these happened in the report above.
Fixed on quattro, and now in a pre-release. quattro's helper (bin/omarchy-update-stay-awake:452-536, from 6af052fc in #9467) uses the same holder on its pkexec branch as on its sudo branch: a shell dropped back to the invoking user records its own PID, so stop signals a process the user owns. On the worker, quattro's start and stop without a terminal left a holder owned by uid 1000, and the inhibitor was released with both exiting 0. v4.5.0-rc1 (2026-10-20) ships this helper. v4.0.6 (2026-10-19) still ships the old one.
One gap for the first update off 4.0.x. When the old start went through pkexec, the new stop reads the old record, finds the process's real UID is root rather than the caller's, prints "Cannot verify permission to stop the legacy update inhibitor; retained its state for recovery." and exits 1 (bin/omarchy-update-stay-awake:417-431). On the worker it left that same root inhibitor in place. A machine in that state needs one reboot, or sudo kill of the PID in $XDG_RUNTIME_DIR/omarchy-update-stay-awake/inhibit-pid. A recorded PID that came from the sudo branch has the caller's real UID and is stopped normally.
No second opinion ran this time. The configured reviewers (Codex Medium and a second model on the panel) answer, but the bot's daily review budget was used up, so everything above is one model's reasoning plus what the worker showed.
Whether to bring the new helper to 4.0.x, or to handle the legacy root record with privilege, is the maintainer's call, so this waits on them. No pull request was opened.