omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

Lock screen retries fingerprint PAM authentication every ~400 ms indefinitely when fprintd fails

Open danielrod36 opened this issue 2 months ago • 3 comments

Lock screen retries fingerprint PAM authentication every ~400 ms indefinitely when fprintd fails

What happened

While locked, the shell spawns a new PAM session (omarchy-lock-fingerprint) roughly every 400 ms, without backoff, indefinitely, as long as pam_fprintd fails. On this machine a leaked fprintd device Claim (fprintd denying every attempt with Device was already claimed) produced:

  • 63,875 PAM auth sessions over ~47 h (Fri 2026-09-18 19:57 → Sun 2026-09-19 19:03, while the machine was locked)
  • 148 sessions/minute during episodes (measured), intervals 0.39–0.41 s
  • Each iteration runs wm2-lock-fprint-gate via pam_exec and a pam_fprintd D-Bus round-trip, flooding the journal (~15k lines/hour) and the session bus, and spawning a new quickshell PAM subprocess each time

The flood only ends when the screen is unlocked (password) — the retry loop never gives up or slows down.

Expected

Retry debounce/backoff and a cap: e.g. at most ~1 attempt/s, backing off to seconds/minutes after repeated failures, or stop auto-retrying until there is user input.

Reproduce

Lock the screen while fprintd cannot verify (e.g. the device Claim is held by another client):

journalctl --user | grep "pam.subprocess"   # observe the ~400 ms respawn loop

In the journal each attempt logs:

quickshell[PID]: pam_exec(omarchy-lock-fingerprint:auth): /usr/local/bin/wm2-lock-fprint-gate failed: exit code 1
fprintd[PID]: Authorization denied to :1.NNN to call method 'Claim' for device '...': Device was already claimed
quickshell[PID]: quickshell.service.pam.subprocess: Error while authenticating: "Authentication service cannot retrieve authentication info" (code 9)

Environment

  • Omarchy 4.0.4-1, Arch, kernel 7.2.5-3-omarchy, GPD Win Max 2 2025
  • fprintd with Chipsailing CS9711 reader (libfprint-cs9711-rebase-git)
  • The fprintd-side trigger (leaked Claim) was cleared by restarting fprintd; the retry loop described here is the amplifier that turns any persistent fprintd fault into a flood.

Filed by GLM 5.3 via Oh My Pi.

danielrod36 avatar Sep 19 '26 11:09 danielrod36

A second, distinct fprintd-side trigger: polkit verify denial when the session goes inactive

Same amplifier as described here (omarchy 4.0.4-1, kernel 7.2.5-3-omarchy, quickshell 0.3.1, fprintd 1.94.5-2), but the underlying fprintd failure is not a leaked Claim.

Trigger: resume from suspend (11h, lid-open) on a Framework laptop with a Goodix MOC sensor (27c6:609c). pam_fprintd fails with code 9 from the first attempt at resume. If the user then switches VT to another TTY to investigate, the Hyprland session becomes Active=no, and fprintd starts denying every call:

fprintd[]: Authorization denied to :1.1383 to call method 'ListEnrolledFingers'
  for device 'Goodix MOC Fingerprint Sensor':
  Not Authorized: net.reactivated.fprint.device.verify

net.reactivated.fprint.device.verify is only granted to the active seat session, so any VT switch converts a possibly-transient failure into a guaranteed permanent one — while the 250 ms loop keeps retrying. Returning to the original VT (loginctl activate 1) stops the polkit denials, but the loop continues, because the post-resume sensor failure itself persists.

Measured: 13,828 PAM sessions at ~3.5/s over ~66 minutes, no journal rate-limiting.

This supports fixing the amplifier independently of the fprintd-side cause: the retry loop turns any persistent fprintd fault — leaked Claim, polkit denial, post-resume sensor loss — into an unbounded flood.

Filed by Claude Opus 5 via Claude Code.

wim07101993 avatar Sep 20 '26 08:09 wim07101993

Root cause for the post-resume trigger in @wim07101993's comment: filed as #12705

Same hardware as that comment (Framework, Goodix MOC 27c6:609c), same "code 9 from the first attempt at resume". It notes that "the post-resume sensor failure itself persists" — here is why it starts.

The lock screen arms pam_fprintd inside logind's PrepareForSleep(true) window, which D-Bus-activates fprintd at the one moment logind refuses new delay inhibitors:

01:07:48  systemd-logind:  Suspending...
01:07:49  systemd:         Starting Fingerprint Authentication Daemon...
01:07:49  fprintd[215029]: Failed to install a sleep delay inhibitor:
                           org.freedesktop.login1.OperationInProgress

That instance can end up holding the reader flagged suspended (Device reported an error during verify: Cannot run while suspended.). Crucially it then outlives the sleep: fprintd's ~30s idle-exit timer runs on CLOCK_MONOTONIC, which does not advance across s2idle. In my case PID 215029, started before a 54-minute suspend, was still the process answering at resume — and exited 31s later, at which point fingerprint silently started working again. fprintd-list confirms the hardware and enrollment are fine throughout.

So that's a fourth upstream fault feeding this loop, alongside the leaked Claim and the polkit/VT denial.

Two things from my logs that support fixing the amplifier independently, which is what this issue argues:

  1. The first failure at resume is immediate and has nothing to do with the loop — the loop just makes it a wall instead of one error.
  2. The loop then manufactures its own faults. A few minutes after the stale daemon had exited, a fresh fprintd logged Authorization denied ... Device was already claimed — the ~400ms respawn racing itself, attempt N+1 claiming while N still holds. Same code 9, but self-inflicted.

Workaround while the shell-side fix is pending — a resume hook that drops any daemon carried over from before the suspend:

# /usr/lib/systemd/system-sleep/restart-fprintd
if [[ $1 == "post" ]]; then
  if systemctl is-active --quiet fprintd.service; then
    timeout --kill-after=1s 5s systemctl stop fprintd.service 2>/dev/null ||
      systemctl kill --signal=KILL fprintd.service 2>/dev/null || true
  fi
fi

post, not pre: at pre the lock screen is still retrying, so a stopped daemon is re-activated within the same sleep window and lands in the same inhibitor-less state. Also note that on systemd 261 only /usr/lib/systemd/system-sleep/ is scanned — a hook in /etc/systemd/system-sleep/ silently never runs.

Full trace and environment in #12705.

Investigated by Claude Opus 5 via Claude Code.

ilajosmanov avatar Sep 20 '26 23:09 ilajosmanov

Fixed by merged #7158; closing as completed. Persistent device and claim failures now use capped exponential backoff instead of spawning PAM sessions every 250 ms.

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 avatar Oct 04 '26 17:10 omarchybot