Repository navigation
Keep fingerprint unlock working across suspend - #8531
mrlarsendk wants to merge 3 commits into
Conversation
The lock's own "is fingerprint configured" probe (fprintd-list) can start in the same window the sleep inhibitor releases, straddle the actual suspend, and land on resume before fprintd has recovered. On the affected hardware this reads as "unsupported firmware version": the probe reports "no" rather than hanging, fingerprintConfigured gets stuck false, and the lock never offers fingerprint for that unlock. The only recovery is fprintd-resume.service, on its own schedule, well after this lock screen already decided. Watch login1's PrepareForSleep signal directly and pause fingerprint checks across the sleep boundary: refuse to start a fresh probe once paused, drop the result of one already running, and re-probe on a budget after resume instead of trusting the first answer. Also add a timeout to the fprintd-list probe itself and retry once if starting the fingerprint PAM context fails, since a wedged reader can hang the check instead of failing it outright. Tested on a ThinkPad X1 Carbon Gen 9 with a Synaptics Prometheus USB reader (06cb:00fc) under s2idle -- the race is generic to the sleep lifecycle, not specific to this reader. See the PR description for bake numbers and for what's directly confirmed versus defensive. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Improves fingerprint unlock reliability across s2idle suspend by pausing probes during sleep and retrying after resume.
Changes:
- Monitors login1 sleep signals.
- Aborts stale fingerprint probes and authentication.
- Adds post-resume retries and probe timeouts.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Suppressed comments (1)
shell/plugins/lock/Service.qml:429
- This does not enforce the PR's 20-second resume budget: the timer waits one second before each probe, and each probe can then consume the new 8-second timeout. Twenty hung probes therefore take about 180 seconds before
fingerprintConfiguredis finally updated to false. Use a wall-clock deadline (and cap each probe to its remaining time), or reduce the attempt count/timeout so the advertised budget is actually bounded.
Timer {
id: fingerprintResumeTimer
interval: 1000
repeat: false
onTriggered: {
if (root.fingerprintResumeAttempts > 0) root.fingerprintResumeAttempts -= 1
root.refreshFingerprintStatus()
}
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if (!fingerprintPam.start()) { | ||
| fingerprintAuthenticating = false | ||
| fingerprintRetryTimer.restart() |
There was a problem hiding this comment.
Removed the retry entirely rather than bounding it — it matched pre-PR baseline behavior and wasn't needed to fix the reported bug. Fixed in 18f4b02.
| onExited: fingerprintSleepMonitorRestart.restart() | ||
| } | ||
|
|
||
| Timer { | ||
| id: fingerprintSleepMonitorRestart | ||
| interval: 2000 | ||
| repeat: false | ||
| onTriggered: if (!fingerprintSleepMonitor.running) fingerprintSleepMonitor.running = true |
There was a problem hiding this comment.
Confirmed and fixed in 18f4b02 — on an unexpected monitor restart, if still paused, it's now treated as a resume. Erring that way is safe: a genuinely-too-early probe just falls into the existing resume re-probe budget, whereas staying paused on a wrong guess disables fingerprint for the rest of the session.
| function handleSleepMonitorLine(data) { | ||
| var line = String(data || "") | ||
| if (line.indexOf("member=PrepareForSleep") !== -1) { | ||
| awaitingSleepSignalValue = true | ||
| return |
There was a problem hiding this comment.
Extracted the parsing and budget arithmetic into SleepFingerprintModel.js and added test/shell.d/lock-sleep-fingerprint-model-test.sh (11 assertions) covering both, in 18f4b02. The Process/dbus-monitor wiring itself isn't unit-tested, consistent with how the rest of this file's Process-driven behavior is tested elsewhere in the repo.
Reconciles two independent passes over this file: a simplification pass that removed the unused defensive paths (in-flight abort, the 20-attempt resume budget, PAM start() retry), and this session's fixes for three bugs Copilot's review found on PR omacom#8531. Net result: the PAM start() retry stays removed -- it matched pre-PR baseline behavior and the added version was itself buggy and never exercised. The in-flight abort is restored: it's the backstop for the literal reported bug's mechanism (a check already running when sleep lands), not incidental. The resume budget is restored but shrunk -- 20 attempts/20s down to 3 attempts/5s, and now wall-clock bounded rather than attempt-count-only, so a run of hung probes can't stretch it past its advertised budget. A restart of the sleep-signal monitor after an unexpected exit now treats a still-paused state as a resume, instead of risking fingerprint staying disabled for the rest of the session if a PrepareForSleep(false) was missed while the monitor was down. Signal-parsing and resume-budget arithmetic move into SleepFingerprintModel.js (matching FingerprintModel.js's pattern from omacom#7158), with a node-driven shell test covering both -- none of this state machine had automated coverage before. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Thanks for the review — addressed all four points in 18f4b02 (replies on each inline thread). The resume budget (flagged in a suppressed comment on the timer) is now wall-clock bounded via a deadline checked alongside the attempt count, not just attempt-counted, so hung probes can't stretch it past its advertised budget. Also shrunk the budget itself from 20 attempts/20s to 3 attempts/5s — the larger number was never exercised in the bake and wasn't earning its complexity. |
|
Confirming this on a second Synaptics Prometheus machine, with two details that may be worth folding into the PR: it is not limited to s2idle, and the recovery your description relies on does not exist on Arch. System
The last point matters for the title: the trigger is the logind inhibitor race inside the sleep-delay window, so it reproduces on S3 as well. Nothing about it is specific to s2idle. The activationSame shape as #7229: the lock appears inside the delay window and D-Bus-activates fprintd while the sleep operation is already in flight, so fprintd is refused its own inhibitor and never sees What is different on ArchYour problem statement says:
That unit is not part of Arch's fprintd. The package ships exactly one: $ pacman -Ql fprintd | grep '\.service'
fprintd /usr/lib/systemd/system/fprintd.service
fprintd /usr/share/dbus-1/system-services/net.reactivated.Fprint.service
The consequence is a change in kind, not degree. Where your reproducer loses one unlock and then recovers, here the daemon activated at $ ps -o lstart= -p 24160
Tue Aug 25 19:07:29 2026
$ journalctl --no-pager | grep -c 'already claimed'
65It never idle-exited either — the idle timer barely advances across suspend, and each new lock-screen retry re-arms it. None of this argues against the fix; pausing the probe across the sleep boundary is the right place to stop the bad activation. It does mean that on the target platform there is no second line of defence behind it, so any path that still manages to activate fprintd inside the window stays broken until the user notices and restarts the daemon by hand. If that is a concern, |
|
Following up on the Drop-in on the same box (Synaptics [Service]
ExecStart=
ExecStart=/usr/lib/fprintd --no-timeout
[Install]
WantedBy=multi-user.targetAcross a real suspend cycle:
Before the drop-in, the instance activated by the lock died after ~33 s of idle and the next one was activated inside the sleep window again; keeping it resident means the inhibitor is installed at boot and simply never has to be negotiated mid-transition. One wrinkle worth knowing for anyone applying this as a stopgap: the instance that happens to be running when This is complementary to your change rather than an alternative — yours stops the lock from activating fprintd inside the window, this stops the window from mattering if some other path ever does. |
|
@MaxMad75 — thank you for this. A second machine, a different reader, and a different sleep mode is exactly what this change needed, and you found two things I had wrong. Yes please to testing the branch; details at the bottom. You're right about $ pacman -Qo /etc/systemd/system/fprintd-resume.service
error: No package owns /etc/systemd/system/fprintd-resume.service
$ stat -c '%y' /etc/systemd/system/fprintd-resume.service
2025-09-02 06:02:14It is a unit I hand-wrote a year ago and forgot about. It is not in Arch's Also right about s2idle. My machine reports On On testing the branch: yes, please. It would fill a gap I flagged in the PR. Two of the defensive paths have never once fired here, because the "refuse to start a new probe while paused" guard always wins the race first — 33 out of 33 closes, by a consistent ~100-130ms. Your box differs in the two ways that could move that margin: a different reader, and One thing before you pull. The branch moved after a review pass and the PR body above still describes the original version. As of
I am refreshing the body to match, along with the two corrections above. What would be most useful from a run on your hardware:
journalctl -o short-iso | rg 'omarchy lock .*fingerprint-|Authenticated successfully|already claimed'Either outcome is worth having — the guard simply holding on unfamiliar hardware is evidence too. And thank you for the #7229 pointer; same shape, and worth linking these together. |
|
Thanks for digging into the Before the branch test, a correction to my own suggestion from yesterday. What happenedThe fingerprint stopped working again overnight. The daemon was healthy by every measure I had proposed as the test: $ systemctl show fprintd -p MainPID -p ActiveEnterTimestamp --value
115096
Fri 2026-08-28 17:19:26 CEST # ~16 hours old, never exited
$ ps -o cmdline= -p 115096
/usr/lib/fprintd --no-timeout
$ systemd-inhibit --list | grep -i fprint
net.reactivated.Fprint 0 root 115096 fprintd sleep Suspend fingerprint readers delayResident, correct flags, inhibitor installed and held across every suspend. And yet: $ fprintd-list "$USER"
No devices availableThe reader itself was fine — but re-addressed: $ lsusb | grep 06cb
Bus 001 Device 010: ID 06cb:00bd Synaptics, Inc. Prometheus MIS Touch Fingerprint Reader
# 008 yesterday, 010 todayA $ ps -o cmdline= -p 215976
/usr/lib/fprintd --no-timeout
$ fprintd-list "$USER"
Fingerprints for user maxmad on Synaptics Sensors (press):
- #0: right-index-fingerTwo daemons, identical flags, identical inhibitor state. The only difference is age. Why this matters for the framingKeeping the daemon resident closes the inhibitor race, and it did: zero That is a different layer from what your PR addresses, and it does not argue against either change. It does mean On the branch testYes, and now with a wrinkle worth flagging for anyone else you ask: the drop-in masks exactly what you want tested. With fprintd resident, the lock screen never D-Bus-activates it inside the delay window, so the race your defensive paths guard against cannot arise. I will disable the drop-in first so the test measures your change rather than my workaround, then pull |
|
Tested Cycle 1 — workedUnlocked on the first swipe, ~2s after resume. Zero Cycle 2 — pause and resume fired correctly, then it fell apart downstreamThen, between
No unlock. The screen went black after about ten seconds with the finger held on the reader; the machine had to be unlocked by password. That is roughly seven PAM sessions per second against a device that was never going to answer. This is not your change failing. Both of your signals fired, in order, on time. The reader was simply still claimed after resume, and what turned an unavailable reader into a black screen was the retry loop — #7176 / #7172, amplified exactly as the second commenter on #7229 described. If anything this is more evidence that the retry cap belongs with this work. The three questions, and a problem with two of them
Neither string exists in $ grep -oE '"fingerprint[^"]*"' Service.qml | sort -u
"fingerprint-configured=false"
"fingerprint-configured=true"
"fingerprint-paused-for-sleep"
"fingerprint-resume-pending"
Once out of twice. One more thing, about my own suggestionMy Happy to run more cycles, or to test again once there is something logged at the two points above — that would make a repeat run actually answer your questions rather than mine. |
The bake evidence in the PR description (guard fires, resume attempt counts, zero in-flight aborts) comes from logEvent markers that were trimmed out of this branch as diagnostic noise when the PR was prepared — so nobody running the branch could reproduce or extend it, as MaxMad75 found while testing. Restore the five markers with the exact wording the evidence was gathered under: - fingerprint-check-skipped: sleep-paused - fingerprint-check-aborted - fingerprint-check-ignored: sleep-paused - fingerprint-resume-check attempts=N - fingerprint-not-ready attempts=N No behavior change. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PYLaEtN71fd5LUFzadhKam
|
@MaxMad75 — you're right, and thank you for burning a test cycle to find it. The markers were in the plugin that produced the bake numbers (my daily-driver copy of this code) and I trimmed them out of the branch as diagnostic noise when preparing the PR. The fix logic was identical; the evidence was not reproducible. Restored in 9cade54 — all five markers, exact wording: One clarification on "zero occurrences may mean neither of us can see it": the daily driver does log On cycle 2: your analysis matches mine exactly. Both signals firing correctly while the user still ends at a black screen means this fix is necessary, not sufficient — the unbounded 250ms retry (#7176, #7172) turns any still-claimed reader into your 178-sessions-in-26s. I hit the same loop the day before you did, with no suspend involved (a polkit Noted on If you're still willing after two cycles of my homework: same three questions as before, but they're answerable now. Description and title updated to match (suspend generally, not s2idle; no phantom resume unit; current budget). |
|
Opened #8935 for the stale-device half we discussed — the resident-daemon side, so it does not land in your diff. It restarts fprintd after the sleep targets rather than shipping a |
|
Ultimately i dont care wether it is me or someone else who figures out the perfect solution. What matters is that we make the collective experience better:-) thanks for you envolvement. |
|
@mrlarsendk — agreed, and thanks for taking the corrections in the spirit they were meant. A short status from this end, since the picture got clearer over the last day. What I called one bug turns out to be three, and yours is the first of them:
So the collective experience you are after probably needs (1) and (3) together — the wedge removed and the aftermath made survivable. Good luck with this one. |
|
@xe-nvdk — same laptop model and same reader here (X1 Carbon Gen 9, Synaptics No re-enumeration here. Ever. Across the full journal: The original failure this PR was written from: Reset, not disconnect — and the probe lands inside that window, in the same second as On So the same error string is reachable two ways: a USB reset the probe races (here) and a full re-enumeration leaving a stale handle (yours). #8531 targets the first. Worth knowing before the fix for (2) is scoped as applying to all |
|
Reviewed at The diagnosis holds, and it traces through the source: #9919 fixes the same trigger the same way: a lifetime
There is one thing this pull request does that #9919 does not. On resume it always re-runs the availability check. #9919 re-runs it only if one was held back, so a check that already answered "no" before The rest of the evidence you and @MaxMad75 collected is valuable in its own right, especially the split into three failures: the inhibitor race, the stale device handle, and the retry storm in #7172/#7176. That split is the clearest map of this area in any thread. Waiting on the maintainer to choose between this and #9919. Only one of them should land. |
|
Thank you for this, @mrlarsendk. #9919 fixes the same problem in a way the review judged better, so this is closed in favour of it. If it does not cover your case, please say so there. Closed at the maintainer's request. The review comment above has the details; it was done by Claude Opus 5.5 with Codex Medium as a second opinion, whose agreement is not independent. |
|
The post-resume recovery and transient-probe failure are now addressed by merged #7158. #9919 remains open for its separate pre-suspend deferral mechanism; this alternative remains closed. GPT-6 in Codex and Claude Opus 5.5 Medium checked the coverage against the landed source; Claude's agreement does not guarantee independence. This closure review was read-only and did not rerun runtime tests. |
Problem
Stock lock can drop fingerprint PAM across suspend. The lock's "is
fingerprint configured" probe (
fprintd-list, infingerprintCheckProc)starts in the same window the sleep inhibitor releases and real suspend
begins — it D-Bus-activates fprintd if it isn't already running. fprintd
is then refused its own sleep-delay inhibitor, because the sleep
operation it would be inhibiting is already in flight
(
org.freedesktop.login1.OperationInProgress), and so never seesPrepareForSleep(false). On resume it answers before the reader hasactually recovered. On the reproducer hardware that's
unsupported firmware version; the probe reports "no" instead of hanging,fingerprintConfiguredgets stuckfalse, and the lock never offersfingerprint for that unlock. Same shape as #7229.
Nothing recovers from this on Arch. The
fprintdpackage ships oneunit,
fprintd.service;fprintd-resume.serviceis a Debian/Ubuntuaddition. An earlier version of this description claimed the daemon is
restarted at resume and the device recovers "too late" — that was wrong,
and my own fault: the unit I was seeing is one I hand-wrote on this
machine a year ago and had forgotten, owned by no package and not
shipped by Omarchy. Thanks to @MaxMad75 for catching it. On a stock box
a poisoned instance is never cleaned up: they observed the same PID
still refusing every request three days after activation, 65
already claimedrefusals, never idle-exiting because each lock-screen retryre-arms the idle timer. In the field the failure is not "one lost
unlock" — it persists until the user restarts fprintd by hand.
Not specific to s2idle. @MaxMad75 reproduced it with
mem_sleep=deep. The trigger is the logind inhibitor race inside thesleep-delay window, which does not care which sleep mode follows.
Fix
Watch login1's
PrepareForSleepsignal directly (adbus-monitorprocess) and pause fingerprint checks across the sleep boundary:
refreshFingerprintStatus).landed, rather than trust an answer that may straddle suspend
(
abortFingerprintCheck).instead of trusting the first answer, since the reader can take a few
seconds to recover.
fprintd-listprobe itself — a wedged readercan hang rather than fail outright.
PrepareForSleep(true)but not(false), reconcile the still-paused state to "resumed" when itrestarts, instead of leaving fingerprint disabled for the rest of the
session.
Signal parsing and the resume-budget arithmetic live in
SleepFingerprintModel.js, covered bytest/shell.d/lock-sleep-fingerprint-model-test.sh. Every statetransition logs a
fingerprint-*journal marker (restored in thelatest commit after I over-trimmed them from the original push — the
testing evidence below is stated in terms of those markers, and they
need to exist for anyone else to check it).
What this fix does not do
It stops the lock from being the thing that poisons fprintd inside the
sleep window. It does not make unlock succeed when the reader is
unavailable for any other reason, and the pre-existing failure path in
that case is bad:
onError→ 250msfingerprintRetryTimer→startFingerprint(), unbounded (#7176, #7172). @MaxMad75 hit exactlythat while testing this branch — see Testing — and I hit the same loop
via a polkit
ReleaseDevicetimeout with no suspend involved (94failed PAM sessions, ~45 min degraded). A retry cap/backoff is
deliberately not in this PR: #7158's reachability-streak model is the
right shape for it, and widening this diff would collide with that
work. But it means this fix is necessary, not sufficient, on hardware
where the reader can stay claimed across resume.
Scope and relation to existing sleep/suspend handling
Two things worth a maintainer's eyes on merge order:
omarchy-system-sleep-monitor/omarchy-system-sleep-lockalreadywatch this signal. That systemd service holds a
systemd-inhibit --what=sleep --mode=delaylock, runs its owndbus-monitoronPrepareForSleep, and ontruecallsomarchy-shell lock lockover IPC (what actually triggersbeginLock()), delaying real suspend until the session is secure. Thisfix adds a second, independent
dbus-monitorreacting to the samesignal rather than hooking into that pipeline. It's the simpler change,
and the bake evidence below shows it winning the race every time — but
it is a second consumer of a signal this codebase already has one
consumer for, and a maintainer may want it done through that pipeline
instead.
Open PR #7158 fixes a related but distinct bug — a fingerprint
verify (not this PR's configuration check) caught mid-flight by
suspend — and edits the same functions this PR does:
startFingerprint(),handleFingerprintFinished(),fingerprintPam.onError,fingerprintRetryTimer, via areachability-streak/backoff model. Two interactions: (a) this PR's
pauseFingerprintForSleep()callsfingerprintPam.abort()when averify is active at sleep time; if
PamContext.abort()firesonErrorthe way a real failure does, every ordinary suspend could advance
#7158's unreached-attempt streak and eventually trip its "reader
unavailable" notice from routine sleep. I haven't verified whether
abort()firesonErrorin Quickshell's PAM context — flagged, notconfirmed. (b) The retry-storm evidence above is a point in favor of
#7158's backoff, not just a collision risk. The two PRs should be
reconciled by whoever merges second.
Testing
52 sleep/resume cycles on a ThinkPad X1 Carbon Gen 9, Synaptics
Prometheus
06cb:00fc, s2idle, 2026-08-22 → 2026-08-29, including sixovernight lid-close → morning-wake cycles:
fingerprintConfigured=trueon its first attempt, ~1s after resume.unsupported firmware, zerofingerprint-configured=false,zero fingerprint-related password fallback on any resume.
resumes ran on the original 20-attempt/20s budget and 10 on the
current 3-attempt/5s wall-clock-bounded one. Identical outcomes.
The "don't start a fresh probe while paused" guard
(
fingerprint-check-skipped: sleep-paused) fired 42 times, and inevery instance the journal shows the same sequence:
PrepareForSleep(true)→lock-requested(the screen lock that wouldhave started the probe) → the probe blocked. The signal-to-lock margin
is 85–208ms, median 112ms, across all 42 — structural rather than a
hairline race, consistent with this watcher reading the D-Bus signal
directly while the existing pipeline pays for a script spawn and an IPC
round trip first. That makes it a direct interception of the bug's
trigger, not a correlation.
Independently, @MaxMad75 ran this branch on a Synaptics
06cb:00bdunder
mem_sleep=deep(with their fprintd-resident workaround disabledso it couldn't mask the race): two cycles, both with
fingerprint-paused-for-sleep→fingerprint-resume-pending→fingerprint-configured=truefiring correctly and on time. Oneunlocked first-swipe ~2s after resume; the other still failed to
unlock because the reader stayed claimed after resume and the unbounded
retry loop described above took over (178 PAM sessions in 26s) — the
out-of-scope failure mode, with this PR's own state machine behaving
correctly through it.
What's not directly exercised: the in-flight-probe abort
(
fingerprint-check-aborted: zero occurrences in the entire bake — theguard above has always won the race first) and the resume re-probe
budget past its first attempt. Both are defensive for cases outside
what this machine's timing produces — slower D-Bus delivery, a reader
slower to recover, or hardware where the lock command wins the race
instead of the signal. Kept in rather than trimmed for that reason, and
noted here rather than presented as proven.
🤖 Prepared by Claude in Claude Code.