Skip to content

Cover the lid switch in the update sleep inhibitor - #10205

Open
Roriz wants to merge 1 commit into
omacom:quattrofrom
Roriz:fix-update-inhibitor-lid-switch
Open

Cover the lid switch in the update sleep inhibitor#10205
Roriz wants to merge 1 commit into
omacom:quattrofrom
Roriz:fix-update-inhibitor-lid-switch

Conversation

@Roriz

@Roriz Roriz commented Sep 4, 2026

Copy link
Copy Markdown

omarchy-update-stay-awake blocks sleep for the length of an update, but the inhibitor asks for --what=sleep:idle. Both of those are high-level inhibitor locks, and logind.conf(5) says the lid switch ignores high-level locks by default:

Controls whether actions that systemd-logind takes when the power, reboot and sleep keys and the lid switch are triggered are subject to high-level inhibitor locks ("shutdown", "reboot", "sleep", "idle"). Low level inhibitor locks ("handle-power-key", "handle-suspend-key", "handle-hibernate-key", "handle-lid-switch", "handle-reboot-key"), are always honored, irrespective of this setting.

[...] LidSwitchIgnoreInhibited= defaults to "yes". This means [...] the lid switch does not respect suspend blockers by default.

The two drop-ins in etc/systemd/logind.conf.d/ don't set LidSwitchIgnoreInhibited, so the default applies and closing the laptop during omarchy update suspends the machine regardless of the block inhibitor. In the worst case that happens in the middle of a pacman transaction.

Adding handle-lid-switch to the mask fixes it at the call site, since low-level locks are honored whatever LidSwitchIgnoreInhibited is set to. I preferred that over shipping a drop-in with LidSwitchIgnoreInhibited=no, which would change lid behavior for every application on the system instead of just this inhibitor.

Nothing pinned the mask, so I added an assertion to update-lock-test.sh. The sudo stub there already logs the whole systemd-inhibit argv, which is the only place the mask is visible from a test. Reverting the one-word change makes the assertion fail.

./test/all gives 3156 passing. The four failures are unrelated and reproduce on a clean checkout of quattro: three want an omarchy-pkgs checkout I don't have locally, and one is runtime-smoke-test.sh counting IPC handlers on a two-screen setup.

#9467 rewrites this file and edits these exact systemd-inhibit invocations, but carries --what=sleep:idle through unchanged, so the same fix applies on that branch.

Closes #10203

sleep and idle are high-level inhibitor locks, and logind ignores those
for the lid switch unless LidSwitchIgnoreInhibited=no. Omarchy ships no
such drop-in, so closing the lid during an update suspended the machine
despite the block inhibitor that exists to prevent exactly that.

handle-lid-switch is a low-level lock, which logind.conf(5) says is
always honored irrespective of that setting.

Closes omacom#10203

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

closing the lid can suspend the machine mid-update

1 participant