Skip to content

Fix lock screen black screen and fingerprint sensor lockout - #10653

Open
neilisdale wants to merge 1 commit into
omacom:quattrofrom
neilisdale:fix/lock-fingerprint-blackscreen
Open

neilisdale wants to merge 1 commit into
omacom:quattrofrom
neilisdale:fix/lock-fingerprint-blackscreen

Conversation

@neilisdale

Copy link
Copy Markdown

Problem

Two related bugs in the lock screen's fingerprint flow (shell/plugins/lock/Service.qml):

  1. Fingerprint retry has no backoff. fingerprintRetryTimer fires at a fixed 250ms on every failure, with no cap. On sensors with firmware thermal-protection (Goodix in my case), sustained rapid retries trip a Device disabled to prevent overheating cutoff. Once tripped, every retry fails instantly but the loop keeps firing every 250ms anyway — a busy-loop with no way out short of falling back to password auth. Reproduced consistently: ~90 seconds of continuous retries, dozens of PAM subprocess spawns, until manual password fallback.

  2. startFingerprint() never wakes the display. idleBlankTimer deliberately excludes fingerprint auth from resetting its countdown (see its own comment — the fingerprint PAM session stays "armed" for the whole lock, so gating on it would keep the panel lit indefinitely). But that means the display physically blanks (omarchy-brightness-display off) after 5s of no keyboard/mouse activity even while a fingerprint verify is actively in flight. Any multi-attempt fingerprint unlock over 5s runs mostly with the screen off — which reads as a black/frozen screen.

Fix

  • Add fingerprintFailureCount, reset on lock/unlock. scheduleFingerprintRetry() backs off exponentially after the first 3 consecutive failures (250ms → 500ms → 1s → ... capped at 15s), so the sensor can never be hammered into thermal lockout.
  • Call runWake() at the start of each fresh startFingerprint() attempt, so the display lights up (and the idle-blank countdown re-arms) every time a new verify attempt begins, instead of staying dark through retries.

First three failures keep the original fast 250ms retry (normal misread UX unchanged); backoff only kicks in on sustained failure.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BjKUq2LkanQxGMeLHSxAwv

The lock screen's fingerprint auth retried on a fixed 250ms timer with
no backoff or retry cap. On sensors with firmware thermal-protection
(e.g. Goodix), sustained rapid retries trip a "Device disabled to
prevent overheating" cutoff. Once tripped, every retry failed
instantly but the loop kept firing every 250ms anyway, spinning
indefinitely with no way to recover short of falling back to a
password.

Separately, startFingerprint() never called runWake(), so the
idleBlankTimer (deliberately excluded from tracking fingerprint auth,
since the PAM session stays armed for the whole lock) blanks the
display after 5 seconds of no keyboard/mouse activity regardless of
in-progress fingerprint attempts. A multi-attempt fingerprint unlock
taking longer than 5 seconds runs mostly with the display powered
off, which reads as a black/frozen screen.

This backs off the retry interval exponentially after the first few
consecutive failures (capped at 15s) so the sensor can't be hammered
into a thermal lockout, and wakes the display on every fresh verify
attempt so retries are visible instead of running in the dark.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BjKUq2LkanQxGMeLHSxAwv
@omarchybot

Copy link
Copy Markdown
Collaborator

Thanks for this, @neilisdale. The retry problem is real, but the change as it stands makes the lock screen wake itself all night, and #13819 handles the retry loop better, so this one is waiting on the maintainer to choose between them.

What was checked. Head 2d1cc3f, merged onto current quattro, linked into the shell on a disposable Omarchy worker. The worker has no fingerprint reader, so /etc/pam.d/omarchy-lock-fingerprint was pointed at a stub that fails either at once (like a reader in thermal lockout) or after a delay (like pam_fprintd hitting its default 30-second timeout with no finger on the reader). Each PAM attempt and each DPMS change was logged while the machine sat locked. The lock tests in test/shell.d/ and ./test/cli pass, and they pass the same way on quattro: vscode generated theme references current theme file fails on both.

The retry loop is real. On quattro, a fingerprint PAM that fails at once was started 153 times in 40 seconds. With this PR applied it was started 6 times in the same window.

The runWake() in startFingerprint() wakes an unattended machine. startFingerprint() is called by the retry timer, not by someone touching the sensor, and pam_fprintd gives up after 30 seconds with no finger. So on any machine with a print enrolled, the panel comes back on with every retry, whether anyone is there or not. With nobody touching anything, quattro blanked the display 6 seconds into the lock and kept it dark. With this PR it came back on at 32, 62 and 94 seconds, each time for 5 seconds. #6817 made the display blank while the reader waits on purpose, and the static check in lock-blank-fingerprint-test.sh does not catch this. The wake also does not keep the panel lit through a scan: it still blanks 5 seconds into each 30-second attempt.

The backoff counts the wrong thing (Service.qml:283). Each 30-second no-finger timeout counts as a failure, and the count only resets on lock and unlock. After a few minutes locked, the delay reaches 15 seconds and stays there. From then on the reader listens for 30 seconds, then ignores the sensor for 15. Someone coming back to the machine who touches the sensor during that gap gets no response. The count also goes up twice per failure, because Quickshell's PamContext emits error and then completed for the same conversation, and both handlers now call scheduleFingerprintRetry(). On the worker, the gaps between attempts were 0.25s, 0.5s, 2s, 8s and then 15s, so the backoff starts on the second failure, not after three. Finally, retries never stop: an instantly failing reader is still restarted about every 15 seconds for as long as the machine stays locked.

Competing fixes. #13819, #12461 and #12420 also fix the retry loop. Codex Medium compared all four. Its pick, and mine, is #13819: it caps the retries, counts each failed conversation once (only the timer firing counts), and leaves the display blank alone. Its own weakness is that ordinary timeouts use up the same budget, so a healthy reader stops after about nine minutes locked until the mouse or keyboard wakes the lock. #12461 adds more new state and stops even sooner. #12420 ties the reader to whether the display is lit and keeps the 250ms loop while it is awake. This PR is the only one of the four that wakes the display and the only one that never stops retrying.

Who checked it. The review and the worker runs above were done by Claude Opus 5.5. Codex Medium reviewed the diff separately and found the same three problems. It also pointed to Quickshell's source as the reason each failure is counted twice. It may have read this session's notes, so its agreement is not a guaranteed independent check.

Waiting on the maintainer, to choose between this PR and #13819. If this one goes ahead, it needs the runWake() removed, and backoff that applies only to failures that come back quickly, which is the case a thermal lockout produces.

@omarchybot

Copy link
Copy Markdown
Collaborator

The retry-backoff part is superseded by merged #7158. Waking the display on every fingerprint attempt is not included, so the display behavior proposed here remains distinct. Keeping this open for that remaining scope; the shared retry path needs a rebase.

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.

@omarchybot

Copy link
Copy Markdown
Collaborator

@neilisdale, an update since my last comment: #13819 has closed and #7158 has merged, so nothing in this PR is still worth landing. I'd recommend closing it. That's the maintainer's call.

The backoff is on quattro now. #7158 backs off any fingerprint attempt that fails fast, whether it never reaches the reader or hits a device error within 2 seconds of the prompt. The waits are 1, 2, 4, 8, 16 and 32 seconds, then 40 seconds from there on (FingerprintModel.js, retryDelayMs). Any attempt that does reach the reader resets the count. Ordinary mismatches and a full 30-second window with no finger keep the 250ms retry, so a reader nobody is touching is never slowed down. That covers the thermal lockout this PR describes, without the problems I found here on the 2nd: counting no-finger timeouts as failures, and counting each failure twice. The PR no longer merges with quattro, because both changes rewrite the same retry code.

The runWake() part would still wake an unattended machine. On quattro, startFingerprint() is called when the lock comes up, when enrollment is detected, and by the retry timer. It is never called by someone touching the sensor. With a print enrolled and nobody there, it runs about every 30 seconds, so a wake there would light the panel for 5 seconds every 30 seconds all night. That is the result the worker runs showed last time. Blanking the display while the reader waits is deliberate (#6817, and the comment on idleBlankTimer). Moving a key or the mouse wakes it, and a fingerprint match unlocks and wakes it.

One case quattro may still miss. If a reader in thermal lockout shows the prompt and then fails more than 2 seconds later, quattro treats that as a normal attempt and keeps retrying at 250ms. If that is how your Goodix behaves, a new issue with the lock log (the fingerprint- lines) from a lockout would show it. That would be a fix to the threshold in FingerprintModel.js, not to this PR.

Who checked it. Claude Opus 5.5 read this PR's diff against quattro at head 2d1cc3f, including #7158's retry code and the lock tests. Nothing was run this time, because the head hasn't moved since the worker runs described above. Codex Medium reviewed the same code separately. It reached the same conclusion on both parts and raised the slow-failure case above. It may have read this session's notes, so its agreement is not a guaranteed independent check.

Waiting on the maintainer to decide whether to close this.

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.

2 participants