Skip to content

fix: fingerprint lid open - #3448

Merged
bbedward merged 2 commits into
duxlabs-dev:masterfrom
ismd:fix/fingerprint-lid-open
Sep 25, 2026
Merged

bbedward merged 2 commits into
duxlabs-dev:masterfrom
ismd:fix/fingerprint-lid-open

Conversation

@ismd

@ismd ismd commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Description

The fingerprint reader on the lock screen stops responding: after the lid is
closed and opened, after a long idle period, and after suspend.

The shell held a PAM session and a claimed fingerprint device for as long as the
screen was locked, so a suspend always landed on a running verify. That is what
breaks fprintd: it suspends the device under the verify, ReleaseDevice then
fails with "device is still busy", and the claim is never released. Every later
attempt fails until fprintd restarts, which it only does after 30 seconds with no
client attached.

The main fix is to release the reader when the monitors blank and arm it again
when they come back. A suspend then has nothing to wedge, and a locked laptop no
longer holds a subprocess and the reader open all night.

Why the reader has to be released before the suspend, not during it

Traced on a Goodix 27c6:6594 with fprintd 1.94.5, G_MESSAGES_DEBUG=all on the
daemon and debug on pam_fprintd, locked with the monitors on:

19:07:42.004  pam:     VerifyStart completed / "Waiting for 89 seconds"
19:07:58.656  fprintd: Preparing devices for sleep
19:07:58.656  fprintd: suspend completion (error: FP_DEVICE_ERROR_NOT_SUPPORTED)
19:07:58.659  fprintd: Device reported an error during verify: Cannot run while suspended.
19:07:58.661  pam:     ReleaseDevice failed: The device is still busy with another operation
19:08:02.812  kernel:  PM: suspend entry (s2idle)

fprintd holds its own delay inhibitor and suspends the device about a millisecond
after PrepareForSleep, while the kernel only suspends 4.1 seconds later. The
shell cannot get in front of that: both sides start from the same signal,
fprintd's handler is in-process, and the shell's path is dbus to core to socket
to QML to killing the PAM child. So SessionService.preparingForSleep is not a
guard against the wedge, only a way to stop re-arming across the sleep. Not
having a verify running when the suspend starts is the only thing that works.

The underlying fault is a driver one: goodixmoc answers a suspend during a verify
with FP_DEVICE_ERROR_NOT_SUPPORTED, libfprint cancels the operation, and fprintd
is left with the device open, so Release from PAM can no longer succeed. A reader
whose driver supports suspend would not wedge.

Behavior change

A scan on a blanked lock screen no longer wakes or unlocks the machine. The reader
is a USB device, not an input device, so a scan produces no seat activity and
cannot clear monitorsOff on its own - the screen has to be woken with a key or
the pointer first, and the reader is armed again as soon as it is.

This is visible for anyone with a monitor timeout configured, and more so with
lockScreenPowerOffMonitorsOnLock enabled: the monitors blank at lock time, so
the reader is not claimed after locking until the screen is woken once.

The trade in the other direction: with the reader still claimed when the machine
suspends, the wedge costs about 39 seconds after resume before it answers again,
measured on the same run:

19:08:11.762  PM: suspend exit
19:08:12.324  attempt 1 -> failed to claim: The device has already been opened!
19:08:14.764  attempt 2 (1.5s backoff) -> same
19:08:44.848  fprintd exits, 30s after the last client detached
19:08:49.977  attempt 3 (35s backoff) -> fresh daemon, claim ok
19:08:52.810  verify-match

Alongside that:

  • A wrong finger is reported again. The profile went from max-tries=5 to
    max-tries=1. pam_fprintd counts only a wrong finger, and nothing in the UI
    shows its messages, so under max-tries=5 the first four wrong scans produced
    no feedback at all and the fifth read "Fingerprint not recognized (1/15)". Each
    wrong scan now ends the session, so each one is reported and the counter is
    right. It also means maxFprintTries is a number of scans rather than of
    groups of five: with the default of 15 the lockout arrives after 15 wrong
    scans instead of 75. Anyone who lowered the setting will reach it sooner. On
    fprintd 1.90.x the minimum for max-tries is 3, so there it keeps the old
    grouping.
  • An explicit timeout=90 in the profile. fprintd defaults to 30 seconds,
    which is short enough that a lock screen spends a good part of its time between
    sessions rather than scanning. 90 leaves room without letting a stuck session
    hold the reader indefinitely.
  • A timeout is no longer shown as an error. pam_fprintd reports an expired
    timeout exactly like a device fault, so waiting without a finger used to spend
    the retry budget and paint "Fingerprint error". The shell now tells them apart
    by how long the verify ran.
  • SessionService.lidOpened, from UPower, because logind can ignore the lid
    on AC and resume alone is not enough.
  • Retry backoff is 1.5s, then 35s, then 60s. The middle step has to outlast
    fprintd's idle timeout, since only its restart clears a wedged device. The old
    exponential steps kept re-attaching and resetting that timer.
  • Lock PAM state machine fixes: PamResult.Failed was dropped, a pending
    retry outlived the contexts that owned it, an availability check reset the
    wrong-scan counter, parallel attempts were possible, and a pending retry was
    drawn as an active scanner.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that changes existing behavior)
  • Refactor / internal cleanup
  • Documentation
  • Other

Related issues

Fixes #3403

Screenshots / video

image

Checklist

Generative AI

Significant parts of this change were written with LLM assistance (Codex and
Claude Code). I have read, tested and can explain every line.

@ismd
ismd marked this pull request as draft September 16, 2026 09:57
@ismd
ismd marked this pull request as ready for review September 16, 2026 10:24
@bbedward

Copy link
Copy Markdown
Member

/claude review

readonly property int verifyStartSlackMs: 10000
readonly property bool retrying: errorRetry.running
readonly property int retryInterval: errorRetry.interval
readonly property bool allowed: available && SettingsData.enableFprint && root.lockSecured && !root.fprintSuppressedByPrimaryPam && !root.unlockInProgress && !root.u2fPending && !SessionService.preparingForSleep && !IdleService.monitorsOff && tries < SettingsData.maxFprintTries

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!IdleService.monitorsOff in allowed makes touching the sensor a no-op on a blanked lock screen.

Fingerprint readers are libfprint USB devices, not evdev input devices, so a scan produces no seat activity. The only paths that clear monitorsOff are input-driven (lockWakeMonitor in IdleService.qml:154, lockWakeDebounce behind the MouseArea in Lock.qml:463-489). So on a locked laptop with the screen off, the user now has to press a key or move the mouse before the reader is re-claimed — previously the scan alone woke and unlocked it.

The suspend wedge you're fixing is covered by !SessionService.preparingForSleep, which is already in this binding. Gating on monitorsOff too also releases the reader during plain DPMS blanking, where nothing is going to wedge it. Dropping !IdleService.monitorsOff keeps the suspend fix and the scan-to-wake behavior; if you want to keep it, it's worth calling out in the PR description and the docs since it's a visible change for laptop users.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Measured this instead of arguing it. Goodix 27c6:6594, fprintd 1.94.5, G_MESSAGES_DEBUG=all on the daemon and debug on pam_fprintd. Locked screen with the monitors on, so monitorsOff was false and !SessionService.preparingForSleep was the only guard in play - the arrangement you are proposing.

19:07:42.004  pam:     VerifyStart completed / "Waiting for 89 seconds"
19:07:58.656  fprintd: Preparing devices for sleep
19:07:58.656  fprintd: suspend completion (error: FP_DEVICE_ERROR_NOT_SUPPORTED)
19:07:58.659  fprintd: Device reported an error during verify: Cannot run while suspended.
19:07:58.661  pam:     ReleaseDevice failed: The device is still busy with another operation
19:08:02.812  kernel:  PM: suspend entry (s2idle)

fprintd holds its own delay inhibitor and suspends the device about a millisecond after PrepareForSleep. The kernel only suspended 4.1 seconds later, so this is not a race the shell lost by being slow - both sides start from the same signal, fprintd's handler is in-process, and our path is dbus -> core -> socket -> QML -> killing the PAM child. We cannot get in front of it, and an inhibitor of our own would not order us ahead either.

So !SessionService.preparingForSleep does not prevent the wedge at all. It only stops us re-arming across the sleep. The one thing that does prevent it is not having a verify running when the suspend starts, which is what !IdleService.monitorsOff buys on the idle path, where the blank always comes before the idle suspend.

What dropping the gate costs, from the same run:

19:08:11.762  PM: suspend exit
19:08:12.324  attempt 1 -> failed to claim: The device has already been opened!
19:08:14.764  attempt 2 (1.5s backoff) -> same
19:08:44.848  fprintd exits, 30s after the last client detached
19:08:49.977  attempt 3 (35s backoff) -> fresh daemon, claim ok
19:08:52.810  verify-match

39 seconds of dead reader after every idle suspend, for the same users who would get the scan-to-wake back.

Root cause behind all of it, for the record: goodixmoc answers a suspend during a verify with FP_DEVICE_ERROR_NOT_SUPPORTED, libfprint cancels the operation, and fprintd keeps the device open, so PAM's Release can no longer succeed. A reader whose driver supports suspend would not wedge at all.

The behavior change you flagged is real and was not documented - that part is fixed. It is also worse than the comment says for lockScreenPowerOffMonitorsOnLock users: applyMonitorsOff() runs at lock time (Lock.qml:51), so the reader is never claimed after locking until the screen is woken once. Both are now in the PR description, along with the trace above.

@claude

claude Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Claude review

Solid, well-tested rework of the fingerprint lifecycle — one behavior consequence worth deciding on deliberately.

  • Blanked lock screen no longer re-claims the reader, so a scan alone can't wake/unlock, quickshell/Modules/Lock/Pam.qml:273

Checked: fprint state machine (allowed/status/startAttempt/scheduleErrorRetry recursion and backoff bounds), the Failed/MaxTries and attemptSettled paths, timer lifetimes on stop/reset/unlock, the new UPower lid subscription against the core dbus signal payload shape and match-rule filtering, LockSurface handler grabs, and the PAM profile/Go-test/Makefile changes. Model: claude-opus-5.

ismd and others added 2 commits September 22, 2026 23:05
The reader stopped responding after the lid was closed and opened, after a long
idle period, and after suspend.

The shell held a PAM session for as long as the screen was locked, so a suspend
always landed on a running verify. fprintd then suspends the device under the
verify, pam_fprintd's ReleaseDevice fails with "device is still busy", and the
claim is never released, so every later Claim fails until fprintd restarts. The
reader is now released when the monitors blank and armed again when they come
back, so a suspend has nothing left to wedge.

The PAM profile drops to max-tries=1 and sets an explicit timeout. pam_fprintd
only counts a wrong finger, so one finished session is now one wrong scan and
maxFprintTries means the number of scans it names rather than five times that.
A timeout expiry arrives as PamResult.Error, exactly like a device fault, so a
session that ran at least as long as the configured timeout is treated as a
planned renewal instead of spending the error budget and painting an error.

A suspend that still lands while the screen is on wedges as before. Recovery now
waits out fprintd's idle timeout instead of climbing to it, which brings the
reader back about 37 seconds after resume instead of about 98.

SessionService gains lidOpened from UPower, because logind can ignore the lid on
AC and resume alone is not enough. The lock PAM state machine is fixed alongside:
PamResult.Failed was dropped, a pending retry outlived the contexts that owned
it, and an availability check reset the wrong-scan counter.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q5LQHivuucTLXwLkvZMfcn
pam_fprintd's timeout runs from the verify, but the session age was measured
from start(), which folds the claim into it. A slow claim plus a verify that
failed before its own timeout could add up past the timeout and be taken for a
planned renewal, skipping the backoff. A session that never reached a verify had
the same problem.

The age now starts at the message pam_fprintd sends when the verify begins, so a
session that never verified can never qualify as an expiry, and a slow claim no
longer ages a fault. The message is translated and quickshell clears it before
completed, so only its timing is used, never its text.

That message arrives after pam_fprintd has already armed its deadline, because
VerifyStart is asynchronous, so the age read here runs short of the real timeout
and a slack makes it up. The bias is deliberate. A fault misread as a timeout
costs one extra retry, while a timeout misread as a fault parks the reader behind
a backoff that grows to a minute, which on an idle lock screen would leave it
unusable most of the time.

Also corrects the comment that claimed a timeout is reported without a message.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q5LQHivuucTLXwLkvZMfcn
@ismd
ismd force-pushed the fix/fingerprint-lid-open branch from 81dc252 to 235d4fb Compare September 22, 2026 21:08
@bbedward

Copy link
Copy Markdown
Member

/claude review

@claude

claude Bot commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Claude review

No issues found. The earlier monitorsOff concern is now explained by the suspend trace and written up as a behavior change in the PR description.

Checked: fprint allowed/status state machine, startAttempt/scheduleErrorRetry/recover paths and the completedDuringStart guard, Failed/MaxTries counting against max-tries=1, attemptSettled timing via onPamMessage, errorRetry backoff and timer cleanup on stop/unlock/lock reset, the persistence of the max state, activity retry handlers in LockSurface/LockScreenContent, the UPower lid subscription and its teardown, the icon and feedback-text consumers, the profile-vs-QML Go check, and the run-qml.py suite split with the moved test imports. Model: claude-opus-5-5.

@bbedward
bbedward merged commit d7074a5 into duxlabs-dev:master Sep 25, 2026
4 checks passed
bbedward pushed a commit that referenced this pull request Oct 7, 2026
* lock: keep the fingerprint reader usable across suspend

The reader stopped responding after the lid was closed and opened, after a long
idle period, and after suspend.

The shell held a PAM session for as long as the screen was locked, so a suspend
always landed on a running verify. fprintd then suspends the device under the
verify, pam_fprintd's ReleaseDevice fails with "device is still busy", and the
claim is never released, so every later Claim fails until fprintd restarts. The
reader is now released when the monitors blank and armed again when they come
back, so a suspend has nothing left to wedge.

The PAM profile drops to max-tries=1 and sets an explicit timeout. pam_fprintd
only counts a wrong finger, so one finished session is now one wrong scan and
maxFprintTries means the number of scans it names rather than five times that.
A timeout expiry arrives as PamResult.Error, exactly like a device fault, so a
session that ran at least as long as the configured timeout is treated as a
planned renewal instead of spending the error budget and painting an error.

A suspend that still lands while the screen is on wedges as before. Recovery now
waits out fprintd's idle timeout instead of climbing to it, which brings the
reader back about 37 seconds after resume instead of about 98.

SessionService gains lidOpened from UPower, because logind can ignore the lid on
AC and resume alone is not enough. The lock PAM state machine is fixed alongside:
PamResult.Failed was dropped, a pending retry outlived the contexts that owned
it, and an availability check reset the wrong-scan counter.

* lock: time the fingerprint session from the verify, not the claim

pam_fprintd's timeout runs from the verify, but the session age was measured
from start(), which folds the claim into it. A slow claim plus a verify that
failed before its own timeout could add up past the timeout and be taken for a
planned renewal, skipping the backoff. A session that never reached a verify had
the same problem.

The age now starts at the message pam_fprintd sends when the verify begins, so a
session that never verified can never qualify as an expiry, and a slow claim no
longer ages a fault. The message is translated and quickshell clears it before
completed, so only its timing is used, never its text.

That message arrives after pam_fprintd has already armed its deadline, because
VerifyStart is asynchronous, so the age read here runs short of the real timeout
and a slack makes it up. The bias is deliberate. A fault misread as a timeout
costs one extra retry, while a timeout misread as a fault parks the reader behind
a backoff that grows to a minute, which on an idle lock screen would leave it
unusable most of the time.

Also corrects the comment that claimed a timeout is reported without a message.

---------

(cherry picked from commit d7074a5)
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.

Lock screen: fingerprint retry backoff is not reset when reopening the lid without suspend

2 participants