Skip to content

Fix KDE Plasma login integration - #154

Open
Archmonger wants to merge 5 commits into
TickLabVN:mainfrom
Archmonger:fix-no-display-auth
Open

Fix KDE Plasma login integration#154
Archmonger wants to merge 5 commits into
TickLabVN:mainfrom
Archmonger:fix-no-display-auth

Conversation

@Archmonger

@Archmonger Archmonger commented Jul 27, 2026

Copy link
Copy Markdown

Summary

When you use biopass for fingerprint authentication, it works great for sudo and in session lock screens but it has two problems. First, system popup dialogs (like the KDE authentication prompts) don't accept your fingerprint. Second, the login screen where you first sign in to your computer doesn't support fingerprint at all. This pull request fixes both.

Issue Breakdown

  1. The first issue was that biopass helper runs as root when it's forked from the PAM module. It then calls fprintd over D-Bus to verify your fingerprint. But fprintd looks up fingerprint templates using the caller's UID. Root has UID 0 and root has no enrolled fingers. So fprintd always says there is no match and the dialog falls through to a password prompt.
    • Fix: Added a privilege dropping step to the helper. Before calling fprintd it drops from root to the target user using initgroups, setgid, and setuid. Now fprintd looks up the correct user's templates and verification works properly. Also added an 8 second alarm timeout around the waitpid call so if the helper ever hangs the login screen will not freeze.
  2. The second issue was that the PAM stack at the login screen had no fingerprint support at all. biopass PAM module is designed for face and fingerprint authentication inside a running desktop session. But at the login screen there is no display server yet so face auth can't work. The module skipped itself and no other module handled fingerprint.
    • Fix: added pam_fprintd.so to the system-auth PAM stack right before biopass. It has a 5 second timeout and one retry attempt. Now when you click Login at the greeter a fingerprint prompt appears. Swipe your finger and you are in. If you don't swipe it falls through to the password prompt.
  3. Discovered some build issues with libcamera while trying to fix my issues above
    • fix: Add Dwerror=false to the meson configure step. Without this the build fails on GCC 16 and newer.

Files Changed

auth/pam/pam.cc - Added alarm timeout and display detection
auth/pam/helper.cc - Added privilege dropping to the target user
auth/fingerprint/fingerprint_auth.cc - Retry logic for device claim conflicts
auth/BundleLibcamera.cmake - Dwerror=false for modern compilers
docs/PAM.md - Modify arch docs to utilize pam_fprintd.so

Related discussion or issue

No discussion link. This was a quick fix I developed to resolve the bugs I was seeing.

Impact

People using biopass with Plasma (KDE) or other display managers on Wayland will be able to log in with their fingerprint without the password fallback.

Verification

  • Distro: CachyOS (Arch based), rolling release
  • Package format tested: source build
  • Desktop environment or display manager: Plasma 6 on Wayland with plasmalogin
  • PAM file or distro auth tool involved: /etc/pam.d/system-auth includes libbiopass_pam.so

I tested by running /usr/bin/biopass-helper auth --username mark --no-display and watching journalctl for fprintd activity. The helper connected to fprintd over D-Bus and started the fingerprint reader without crashing or hanging when no display was present.

Distro notes

  • Distro and version: CachyOS
  • Desktop environment: KDE Plasma 6 on Wayland
  • Display manager: plasmalogin (SDDM replacement)

Contributor checklist

  • I wrote this PR description myself.
  • I opened a discussion first if this changes dependencies, flows, features, or broad behavior.
  • I included clear evidence for the behavior or distro impact.
  • I updated docs when behavior, installation, packaging, or distro support changed.

@Archmonger
Archmonger marked this pull request as draft July 27, 2026 08:21
When biopass PAM is called from a login or lock screen, there is no
Wayland or X11 display available.  The old code would try to run face
auth anyway, which fails because the camera and GPU inference need a
display server, and the failure was not graceful.

Four changes:

1.  PAM module now checks WAYLAND_DISPLAY and DISPLAY environment
    variables before forking biopass-helper.  When neither is set it
    passes --no-display so the helper knows to skip display-dependent
    steps.

2.  PAM module sets an 8-second SIGALRM timeout before waitpid.  If
    the helper hangs (slow D-Bus activation of fprintd at boot, stale
    device claim, etc.) the alarm kills the child process so PAM falls
    through to the password prompt instead of freezing the login
    screen.

3.  biopass-helper auth subcommand accepts a --no-display flag.  When
    set it skips face auth (which needs a display for camera previews
    and GPU ML inference) and falls through to fingerprint auth.  If
    neither face nor fingerprint can run it returns PAM_IGNORE so PAM
    prompts for a password without delay.

4.  Fingerprint auth retries the D-Bus Claim call up to 3 times when
    the device is busy.  The fingerprint device can be claimed by the
    biopass GUI app or another PAM session, and a short retry with
    backoff (200ms increasing) avoids spurious failures.

Also fixes a build issue with newer compilers (GCC 16+).  The bundled
libcamera has warnings treated as errors that break the build, so the
meson configure step now sets -Dwerror=false.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@Archmonger
Archmonger force-pushed the fix-no-display-auth branch from 5bac9b2 to 86dfd18 Compare July 27, 2026 08:30
Two changes since the last commit:

1.  helper.cc gains a drop_to_user() function that drops from root
    to the target user (via setuid/setgid/initgroups) before calling
    fprintd over D-Bus.  This lets the PAM-forked helper talk to
    fprintd as the correct user.

2.  pam.cc now returns PAM_IGNORE when no display is available.
    At the login screen pam_fprintd.so handles fingerprint auth in
    the PAM stack before we run, so there is no need for biopass to
    attempt anything.  Skipping immediately means no delay before the
    password prompt appears.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@Archmonger Archmonger changed the title Handle login screen when there is no display server Fix KDE login integration Jul 27, 2026
@Archmonger Archmonger changed the title Fix KDE login integration Fix KDE Plasma login integration Jul 27, 2026
@Archmonger
Archmonger force-pushed the fix-no-display-auth branch from 88d9d04 to bbc8c07 Compare July 28, 2026 00:06
The PAM module returns PAM_IGNORE at the login screen before ever
forking the helper, so the --no-display flag and all its associated
logic in helper.cc were unreachable.  Clean them out.

No behavioral change -- the privilege dropping (drop_to_user), alarm
timeout, and pam_fprintd integration all remain.
@Archmonger
Archmonger marked this pull request as ready for review July 28, 2026 00:39
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.

1 participant