omarchy-setup-security-fingerprint doesn't add the clamshell gate to the lock screen's fingerprint PAM config
What happened
omarchy-setup-security-fingerprint configures fingerprint auth in three
places: /etc/pam.d/sudo, /etc/pam.d/polkit-1, and
/etc/pam.d/omarchy-lock-fingerprint (used by the Quickshell lock screen,
shell/plugins/lock/Service.qml).
For sudo and polkit, it inserts a "clamshell gate" ahead of pam_fprintd.so:
auth [success=1 default=ignore] pam_exec.so quiet /usr/bin/omarchy-hw-laptop-closed
auth sufficient pam_fprintd.so
...which skips fingerprint auth when the lid is closed, since the reader is physically unreachable, and falls through to the password stack instead.
setup_lock_fingerprint_pam() never adds this gate — it writes:
#%PAM-1.0
auth required pam_fprintd.so
account include system-local-login
So the lock screen always calls into pam_fprintd.so regardless of lid
state.
On my machine this isn't just a missed optimization: with the lid closed
right after resuming from suspend, the fingerprint sensor was contended
(fprintd logged repeated "Device was already claimed" errors on the
Synaptics reader), and quickshell's 250ms fingerprint retry timer kept
hammering pam_authenticate() during that window. One of those calls
crashed the whole shell — pam_sm_authenticate() in pam_fprintd.so
triggered a jemalloc heap-corruption abort (quickshell links jemalloc
process-wide, so a bad malloc/free anywhere in a PAM module loaded into it
takes the shell down). Confirmed via coredumpctl and quickshell's own
crash report in ~/.cache/quickshell/crashes/<id>/report.txt.
Expected
The same clamshell gate used for sudo/polkit should also apply to the lock screen's fingerprint PAM service, so fingerprint auth is skipped (not attempted) while the lid is closed.
Fix
Verified this PAM stanza avoids invoking pam_fprintd.so at all when the
lid is closed, without weakening the lock screen (this file has no
password fallback of its own — that runs as a separate, parallel PAM
context, omarchy-lock-password — so I checked with a standalone libpam
test harness that skipping the only auth line here degrades to a clean
PAM_PERM_DENIED, not an accidental PAM_SUCCESS):
#%PAM-1.0
auth [success=1 default=ignore] pam_exec.so quiet /usr/bin/omarchy-hw-laptop-closed
auth required pam_fprintd.so
account include system-local-login
Steps to reproduce
- Enroll a fingerprint (
omarchy setup security fingerprint) on a laptop. - Dock/clamshell it (lid closed, external monitor) and suspend/resume, or
just lock (
omarchy system lock) with the lid closed. /etc/pam.d/omarchy-lock-fingerprintstill has no clamshell check, so the lock screen callspam_fprintd.sounconditionally.
System
- Omarchy 4.0.2-1
- fprintd 1.94.5-2, quickshell 0.3.1-1
- Fingerprint reader: Synaptics Sensors (libfprint)
Filed by Claude Sonnet 5 via Claude Code.
Confirming this on another machine, plus a trap for anyone patching it by copying the sudo/polkit line verbatim — in this stack the gate's control flags decide between two bad outcomes, not just "skip fingerprint".
The lock file here (Omarchy 4.0.3-1, kernel 7.2.3-arch1-3) is exactly the two lines you quote:
#%PAM-1.0
auth required pam_fprintd.so
account include system-local-login
auth [success=1 default=ignore] pam_exec.so quiet /usr/bin/omarchy-hw-laptop-closedahead of it makes the lid-closed case skippam_fprintd.so— and there is no password module after it to fall through to. A stack whose auth modules are all skipped returns success, soPamContext.onCompleted(PamResult.Success)→handleFingerprintFinished()→finishUnlock()would unlock the session on a closed lid with no credential at all. For sudo/polkit this is harmless becausepam_unix.sofollows the gate; in the lock stack nothing does.- Making the gate fail instead (
default=die, or apam_denyline) hands the failure tohandleFingerprintFinished(Service.qml:226) andonError(:352), which both restart the 250 msfingerprintRetryTimer. "Lid closed" then turns a ~30 s futile cycle into ~4 PAM sessions per second — the failure mode tracked in #9905.
What works instead: don't let a closed lid be an answer. A gate that blocks while the lid reports closed and returns only once it opens, wired optional so it can never skip pam_fprintd.so and never decide the result, parks the fingerprint session harmlessly — no reader traffic and no USB resets while the lid is shut — and pam_fprintd gets its normal verify window the moment the lid opens.
Two details that are easy to miss:
- Bail out when the PAM parent goes away (password unlock, plugin reload), or a parked gate outlives the lock. Reparenting is the reliable signal —
$PPIDcaptured at start vs the live parent — because a parent that exited but has not been reaped keeps its/procentry. - Fail open when there is no lid switch at all (no
/proc/acpi/button/lid/*/state), so docks and desktops keep fingerprint unlock.
Measured here: lid shut → parked; lid opened → released in ~1.0 s; PAM parent gone → exits in ~2.3 s.
The bug is still there on quattro (c1096aa). bin/omarchy-apply-lock:62 writes /etc/pam.d/omarchy-lock-fingerprint with pam_fprintd.so as its only auth line, and startFingerprint() in shell/plugins/lock/Service.qml:358 never checks the lid. So a lock with the lid closed still starts a fingerprint verify on a reader nobody can reach.
The fix is already open as #14280. It keeps the PAM file as it is and makes the lock screen itself check omarchy-hw-laptop-closed: no fingerprint attempt starts until the lid state is known, an attempt in progress is aborted when the lid closes, and fingerprint starts again when the lid opens. It re-reads the lid state on every lock and works on existing installs without a migration. It checks the lid every 2 seconds, so a verify can still begin in the moment between the lid closing and the next check. #14280 names #14251 as the issue it fixes, which reports the same bug later. I tried to link #14280 here too, but omabot refused because that pull request hasn't been reviewed yet. It will be reviewed separately.
#10393 also skips fingerprint on a closed lid, but only when lock.fingerprintLidClosed is "skip". That value is only in the packaged defaults, and shell/shell.qml:93 uses a valid ~/.config/omarchy/shell.json instead of those defaults, not merged with them. On a machine that already has that file, the key is missing and falls back to "try", which is today's behaviour. None of its migrations adds the key. It also keeps the lid state from the previous lock, so a lock started after the lid closes can trust a stale "open" until the next 1-second check.
On the PAM question: the stanza you proposed does not unlock with the lid closed. The comment above and both pull requests say it would, but I tested it on a disposable Omarchy VM through pam_authenticate. With auth [success=1 default=ignore] pam_exec.so quiet /usr/bin/true (a closed lid) in front of the only auth required line, the result was PAM_PERM_DENIED, even when the skipped module was pam_permit.so. With the gate returning false, the next module ran and its result counted. Linux-PAM only records a jump's success for cached chains like setcred, not for pam_authenticate (libpam/pam_dispatch.c). The four-sessions-per-second loop doesn't happen on current quattro either: a failure that never reaches the reader backs off 1s, 2s, 4s and up to 40s (FingerprintModel.js:19). The lock-screen check in #14280 is still the better fix, because it never opens the PAM session at all.
I reviewed this (Claude Opus 5.5), and Codex at medium effort reviewed it separately. Codex reached the same conclusions from the source and added the point about #10393 keeping the previous lock's lid state. Its independence is not guaranteed, because it can read this session's notes. Choosing between #14280 and #10393 is up to the maintainer.
Another data point, from a Goodix MOC 27c6:609c on Omarchy 4.0.6-1 (fprintd 1.94.5, libfprint-git 1.94.100.r10). On this reader, a verify started or still running at lid close doesn't just waste effort. It can wedge fprintd across suspend, and at the next wake the lock screen ends up in an instant-fail retry loop with no message on screen.
I went through the journal from Sept 17 to Oct 27. Out of about 75 real wakes, fingerprint failed and I needed the password 11 times. Sleep length doesn't matter (fine after 68h, failed after 0.3h). Each failure was the lock retrying every 250ms, 17–215 attempts in a row, each failing immediately. I sorted them by trigger:
| Trigger | Count |
|---|---|
| Lid closed on an already-locked, scanning screen (idle lock, or a short wake that re-suspends) | 6 |
| Lid closed while unlocked: the lock and a freshly activated fprintd start mid-suspend | 3 |
Goodix firmware error (Template storage appears to have been corrupted…) |
2 |
The first case is the most common, with sub-second timing (Oct 17):
09:50:49.401 systemd-logind: Lid closed.
09:50:49.409 fprintd[91987]: Device reported an error during verify: Cannot run while suspended.
09:50:49.411 pam_fprintd(omarchy-lock-fingerprint:auth): ReleaseDevice failed: Release failed with error: The device is still busy with another operation, please try again later.
09:50:49.674 quickshell.service.pam.subprocess: Starting pam session ... "omarchy-lock-fingerprint" <- retry armed during suspend
09:50:49.766 kernel: PM: suspend entry (s2idle)
At the next wake (11:22) the lock opened 22 omarchy-lock-fingerprint sessions in a few seconds, all failing instantly, until I typed the password. The same thing happened on Oct 25 → Oct 27: a short wake re-suspended mid-verify, and the wake two days later needed the password after 47 instant failures.
In the second case, the lock calls fprintd at lid close, so it starts fresh during the suspend and logs Failed to install a sleep delay inhibitor: ... OperationInProgress (56 times in this period). It then fails instantly at wake.
Two things already on quattro help: the fprintd-resume hook (fprintd#173) and the capped backoff from #7158. A lid or sleep gate in the lock service would stop the stuck claim from being created in the first place. Some notes on #14280 are posted there.
Re-read against quattro (e2c7007c) after @bronxct1's report above. That report points to a case neither open pull request covers, and it corrects two things in my earlier comment.
The case: the lid closes on a lock screen that is already locked and scanning. Before every suspend, omarchy-system-sleep-lock calls lock. On a screen that is already locked, that call lands in noteSleepRequested() (shell/plugins/lock/Service.qml:293), which returns at once unless fingerprint is already paused. So nothing aborts the verify in progress, and nothing stops the retry. When fprintd fails that verify because the machine is suspending, the attempt counts as usable if it reached the reader more than 2 seconds earlier, which a scan already in progress usually has. The lock then re-arms the next attempt after the normal 250ms (settleFingerprintAttempt(), Service.qml:425; FingerprintModel.js:3). That matches the session in your log that starts 265ms after the error, 90ms before suspend. #14280 checks the lid every 2 seconds and #10393 every second, so neither can catch a suspend that begins a few hundred milliseconds after the lid closes. Neither touches this path. This is confirmed in the source. The fprintd wedge itself has not been reproduced here, because it needs the reader and a real suspend.
Closing that gap is not a pure defect fix, so I have not opened a pull request for it. The idle lock, the lid-close lock and the pre-suspend lock all send the same lock call, and the lock service cannot tell them apart. Treating every repeated lock as "suspend imminent" would also cancel a scan on an awake lock screen. Giving omarchy-system-sleep-lock its own call is cleaner, but that is a choice about the lock's interface. It also needs a path that restores fingerprint when a suspend is cancelled. Both are the maintainer's to decide.
Corrections to my comment of October 11:
- 250ms retries do happen on
quattro. The 1s, 2s, 4s… backoff up to 40s applies only to attempts that never reach the reader or fail within 2 seconds of the prompt. An attempt that reached the reader and then fails retries after 250ms, and that is the path in your log. - Calling #14280 the better fix went too far. It does cover existing installs. #10393 does not: a valid
~/.config/omarchy/shell.jsonwithoutlock.fingerprintLidClosedstays on"try", which is today's behaviour. But #14280 also turns off lock-screen fingerprint for a docked or USB reader whenever the lid is closed, with no setting to turn it back on. On #14280, triage has since named the older #10393 as the default choice for that reason. Which trade-off to take is the maintainer's call.
#14280 now carries a Fixes #10096 line, because it does stop closed-lid attempts on the built-in reader for existing installs. #10393 does not, because it leaves existing configs on "try".
This was reviewed by Claude Opus 5.5 and, as a second opinion, by Codex Medium and muse-wonder (via pi, thinking high). Each was given the code, both diffs and the new report, but not my conclusions. Both traced the same pre-suspend path, and both found that a fix means choosing between the two approaches above. muse-wonder pointed out that a scan already in progress settles as usable and so retries after 250ms. Codex Medium noted that the lid-close error can arrive within milliseconds, possibly before any pre-suspend call, so even that fix may not stop every wedge. Their independence is not guaranteed.
This is waiting on the maintainer: the choice between #14280 and #10393, and whether the lock should treat the pre-suspend call as its own event.