Skip to content

Retry fingerprint verification when the reader cannot be claimed - #14965

Open
omarchybot wants to merge 1 commit into
quattrofrom
fix/issue-10091
Open

omarchybot wants to merge 1 commit into
quattrofrom
fix/issue-10091

Conversation

@omarchybot

Copy link
Copy Markdown
Collaborator

omarchy setup security fingerprint runs fprintd-verify once, straight after sudo fprintd-enroll, and only configures PAM when that one attempt matches. On a Validity VFS5011 (138a:0011) the reporter found the reader cannot be claimed at that moment (failed to claim device: ... Open failed with error: transfer failed), although verification succeeds when run on its own later. Setup then ends with a saved print, no PAM configuration, and a message to enroll again, which cannot help because enrollment was never the problem.

fprintd-verify exits 1 both when it cannot claim the device and when the finger does not match, so the exit status cannot tell them apart; what it prints can. Verification now tees its output to a temporary file, leaving what the user sees on stdout unchanged. When that output says the device could not be claimed, it waits five seconds and tries again, up to three attempts in all. A match configures PAM exactly as before. A mismatch is reported once, without a retry, with the same advice as before. A reader that stays unclaimable gets its own message: the print was enrolled, the reader could not be opened, nothing was configured, and setup should be run again after a wait or a reboot.

PAM is still written only after a successful verification, so a reader libfprint cannot drive still leaves the stacks alone. The reporter's other suggestions, a usbreset of the reader and a udev rule holding it out of autosuspend, are broader changes to how the machine treats the device and are left out; whether waiting is enough on this reader is for the reporter to confirm.

test/shell.d/fingerprint-package-test.sh covers a reader that frees up after two failed claims, one that never does, and a plain mismatch.

Fixes #10091

A reader that cannot be claimed straight after enrollment (reported on a Validity VFS5011) failed the single verify attempt, so setup ended without configuring PAM and told the user to enroll again, which cannot help. fprintd-verify exits 1 for both a claim failure and a mismatch, so its output tells them apart: a claim failure is retried twice after a pause, and one that persists says the reader could not be opened rather than pointing back at enrollment.

Fixes #10091

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Codex Medium <[email protected]>
@greptile-apps

greptile-apps Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium impact] Adds retry logic to fingerprint reader verification.

The PR appears safe to merge, with a non-blocking cleanup issue when verification is cancelled.

Findings

  1. P2 Cancelled setup leaves a log ▶

Summary

Adds up to three fingerprint verification attempts when the reader cannot be claimed, with five-second waits between attempts.

  • Fingerprint setup retries when the reader cannot be opened.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Fingerprint enrolled] --> B[Verify fingerprint]
  B --> C{Result}
  C -->|Match| D[Configure PAM and lock screen]
  C -->|Mismatch or other failure| E[Report verification failure]
  C -->|Cannot claim reader| F{Attempts remaining?}
  F -->|Yes| G[Wait five seconds]
  G --> B
  F -->|No| H[Report reader failure without configuring authentication]
Loading

Reviews (1) · Last reviewed commit: "Retry fingerprint verification when the ..." · Reviewed by Greptile

verify_fingerprint() {
local attempt status log

log=$(mktemp)

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.

P2 Cancelled setup leaves a log

verify_fingerprint removes its temporary log only after verification finishes. If the user presses Ctrl+C during verification or the five-second wait, that cleanup never runs and the log stays in /tmp. Repeated cancelled runs leave more unused files. Register cleanup when the file is created so interrupted runs remove it too.

@jandrusk

Copy link
Copy Markdown

Thanks for the careful VFS5011 handling and the tests.

One blocking gap: verify_fingerprint pipes fprintd-verify into tee and greps the log for failed to claim device, but tee only sees stdout. On a real fprintd the claim-failure line usually goes to stderr, so the retry never fires and you still fall through to the mismatch path. Capture both streams:

fprintd-verify 2>&1 | tee "$log"
status=${PIPESTATUS[0]}

(and keep the stub printing that line on stdout, or assert against a combined stream in the test). After that this looks ready.

@omarchybot

Copy link
Copy Markdown
Collaborator Author

Looked at this at head 8aa3dcb. The diff and the review comments were read on the coordinator. Nothing was run on a worker, and no labels went on.

On the stdout/stderr point raised above: fprintd prints the claim failure to stdout, so the tee in verify_fingerprint does see it. In fprintd's utils/verify.c the message comes from g_print ("failed to claim device: %s\n", error->message) followed by exit (1). That is line 91 in current trees, and g_print writes to stdout. The reporter's transcript in #10091 shows the same line in the setup script's own output, which is consistent with that. The retry does fire on the message as written, and 2>&1 is not needed for it.

Greptile's note holds as described: a Ctrl+C during verification or during the five-second wait leaves the mktemp log in /tmp. That leaves a small file holding the verification output, not something a user would notice, and it was not changed here.

The classification is unsettled, so nothing else was done this run. Two models classify every item. This session's answer was compatibility, a bug down to one reader, the Validity VFS5011. The second opinion (Codex Medium) did not run: it is reachable, but its review allowance for the day was used up. Until both have answered, this gets no class label, and it is not verified on a worker. The next pass picks it up from there. After that it will wait on the reporter, since a worker has no VFS5011 and only their machine can confirm the fix.

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.

omarchy setup security fingerprint aborts before configuring PAM when verify can't claim the reader after enroll (Validity VFS5011)

2 participants