Skip to content

Fail and notify when system lock cannot be secured (#14607) - #14621

Open
Sebo1411 wants to merge 1 commit into
omacom:quattrofrom
Sebo1411:fix/issue-14607-system-lock-refusal
Open

Sebo1411 wants to merge 1 commit into
omacom:quattrofrom
Sebo1411:fix/issue-14607-system-lock-refusal

Conversation

@Sebo1411

@Sebo1411 Sebo1411 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #14607

Summary

When /etc/pam.d/omarchy-lock-password is missing or the lock service refuses/fails to lock, omarchy-shell lock lock returns missing-pam or failed. Previously, bin/omarchy-system-lock piped this call to >/dev/null without inspecting the reply or exit status, silently proceeding and exiting 0 while leaving the desktop unlocked and unauthenticated.

This change:

  1. Inspects the reply and exit status of omarchy-shell lock lock in bin/omarchy-system-lock.
  2. On missing-pam, prints guidance pointing to omarchy-apply-lock on stderr, sends a desktop notification (Session Unsecured), and exits 1 without proceeding to post-lock routines.
  3. On failed, unexpected responses, or IPC failures, logs to stderr, sends a desktop notification, and exits non-zero.
  4. Adds regression tests to test/shell.d/system-lock-test.sh verifying error handling and notifications for missing-pam, failed, and IPC exit failures.

@greptile-apps

greptile-apps Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge; no new actionable issues remain.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues remain.

Summary

omarchy-system-lock now checks the lock service’s reply and exit status before continuing.

  • The system lock command stops when the lock service cannot confirm a lock.

All three earlier, unnumbered findings are addressed. No new actionable issues were found.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Request lock] --> B{Reply is ok?}
  B -->|Yes| C[Run post-lock commands]
  B -->|No or call fails| D[Print error and send translated warning]
  D --> E{Notification succeeds within timeout?}
  E -->|No| F[Show Hyprland warning]
  E -->|Yes| G[Exit 1]
  F --> G
Loading

Reviews (6) · Last reviewed commit: "Fail and notify when system lock cannot ..." · Reviewed by Greptile

Comment thread bin/omarchy-system-lock Resolved
Comment thread test/shell.d/system-lock-test.sh Resolved
@jandrusk

Copy link
Copy Markdown

This is the right fix for #14607 — discarding missing-pam / failed and exiting 0 was a real fail-open.

Heads-up on overlap: #14911 also rewrites bin/omarchy-system-lock + test/shell.d/system-lock-test.sh (waits for status.secure), and #14900 touches the same files for UID-scoped screensaver pkills. The three changes are complementary; whichever merges second/third will need a rebase so PAM-reply checks, secure confirmation, and UID scoping all land together.

@omarchybot omarchybot added bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge labels Oct 16, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed and verified on a disposable Omarchy worker running a real desktop. This fixes #14607: with /etc/pam.d/omarchy-lock-password removed, omarchy-system-lock from quattro exits 0 and leaves the session unlocked with no message, while this branch exits 1 and shows the "Session Unsecured" notification. Your new tests fail against quattro's script and pass here.

I pushed one fix on top, 2f2706f. The shell is also the notification server, so when the shell hangs, the lock IPC times out after 2s and then omarchy-notification-send waits about 25s on D-Bus before the hyprctl notify fallback runs. I stopped the shell on the worker and the warning took 27s to appear. The notification is now limited to 2s, so the same case warns in 4s. I also sent the fallback's ok reply to /dev/null so it no longer prints on stdout. A new test covers a notification that stalls. It fails without the fix.

The full ./test/cli suite passed on the worker, as did system-lock, lid-close and apply-lock from test/shell.d. A second opinion from Codex Medium reviewed the branch with the fix and found nothing further. It had my notes to work from, so its agreement is not guaranteed to be independent; the missing time limit on the notification was its finding.

#14911 fixes the same bug and also waits for the compositor to confirm the lock. This one came first and covers #14607 fully, so it is the one taken forward. The extra wait in #14911 is separate work, and it would need to treat a lock that is legitimately still pending as normal, for example a lid closed with no other screen. #14900 also touches these two files, so whichever lands second will need a merge.

This is now waiting on the maintainer.

@omarchybot omarchybot removed the ready Good to merge label Oct 29, 2026
@Sebo1411
Sebo1411 force-pushed the fix/issue-14607-system-lock-refusal branch from 2f2706f to bc54908 Compare October 30, 2026 17:42
Comment thread bin/omarchy-system-lock Resolved
@Sebo1411
Sebo1411 force-pushed the fix/issue-14607-system-lock-refusal branch from bc54908 to 63f8716 Compare October 30, 2026 17:53
@omarchybot omarchybot removed the verified Omarchy Triage has verified that this issue is ready for final review label Oct 31, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

I re-read this at 63f8716, your squash onto quattro, which keeps the 2s limit on the notification. Against current quattro it still does what my last comment said: missing-pam, failed, an empty or unexpected reply and a failed IPC call each print a reason, show the "Session Unsecured" warning and exit 1. I did not run it on a worker again this time, for the reason below. CI is green.

Five open pull requests now fix #14607: #9429, #13756, this one, #14911 and #16448. The project takes the oldest fix forward unless a newer one is clearly better. I compared all five from their diffs, and Codex Medium, asked separately and without my answer, made the same comparison. We both pick #9429, the oldest. Its independence from my reasoning is not guaranteed.

Two things keep this one from being clearly better than #9429:

This branch does better than #9429 on telling the user. Its warning is translated, tells the user to run omarchy-apply-lock for missing PAM, gives up on the notification after 2s and falls back to hyprctl notify. #9429's notification call has no time limit, and #13756 only writes to stderr, which a keybinding never shows. I've passed those parts on to #9429, to be added there with credit to you.

This is waiting on the maintainer, who decides which approach lands.

@Sebo1411
Sebo1411 force-pushed the fix/issue-14607-system-lock-refusal branch from 63f8716 to d51d122 Compare November 27, 2026 21:14
@omarchybot

Copy link
Copy Markdown
Collaborator

I reviewed the refresh at d51d122d2 against quattro and checked the passing GitHub CI. Codex and Opus 5.5 High still favor #9429 because it waits for the compositor to confirm that the specific lock request secured the session. Opus agreed with the source comparison, and the independence of the reviews is uncertain.

Your translated warning and bounded notification fallback are in #9429 at fbf8c4f4, with co-author credit. This branch also tests that the fallback appears when the notification fails or stalls. #9429 still has a merge conflict and needs to preserve the current 1Password lock-file safeguards from #19998. This PR stays open for the maintainer’s decision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lock command silently succeeds without locking when omarchy-lock-password PAM service is missing

3 participants