Skip to content

omarchy-mac: report Touch ID ready only once a second opener gets the node - #131

Open
IronsideXXVI wants to merge 1 commit into
omacom:mainfrom
IronsideXXVI:touchid-ready-second-opener
Open

IronsideXXVI wants to merge 1 commit into
omacom:mainfrom
IronsideXXVI:touchid-ready-second-opener

Conversation

@IronsideXXVI

Copy link
Copy Markdown

What changes:

  • /dev/sep-bio takes one opener at a time. On some boots fprintd opened it while omarchy-mac-touchid-activate still held it, logged "cannot open /dev/sep-bio: Device or resource busy", and kept no reader until it exited idle about 30 s later.
  • The fprintd drop-in now wants the activation as well, so the order holds whichever is queued first.
  • The activation reports ready only when a second open would succeed: the node opens, a client already holds it, or the node is gone. A node still busy after 10 s with no process holding it records busy and says so in the journal.
  • omarchy-mac 0.2.7.

Verification:

  • On the 14-inch MacBook Pro M4 the race showed on 1 of 70 boots before the change (journal, fprintd's EBUSY line).
  • With the change, activation finished ready with 0 EBUSY lines and fprintd listed the sensor, right after install and on the first boot with it.
  • test/touchid-activate-test.sh covers both parts (a node that refuses the first opens, a held node, and systemd accepting the units). The omarchy-mac suite passes (123 ok, 0 not ok).

Other Macs: the same activation runs on every Mac where omarchy-mac sets up Touch ID, so they get the same ordering and readiness check. We have only seen the race on the M4.

  • A kernel change that makes such an open wait for the activation's own open, instead of failing, goes to the Aurora kernel separately.
  • Without it, this change still closes the race from user space. The readiness wait is simply longer when the kernel is still busy.

… node

/dev/sep-bio takes one opener at a time, and on a J604 boot fprintd
opened it while omarchy-mac-touchid-activate still held the session:
fprintd logged "cannot open /dev/sep-bio: Device or resource busy",
dropped the reader and answered "No devices" until it exited idle.

Two holes let that happen:

- fprintd.service only wanted the wait unit, and After= orders only
  jobs that exist. When D-Bus started fprintd before udev had queued
  the activation, fprintd ran alongside it. The drop-in now wants the
  activation as well, and the activation runs after the wait, so the
  order holds whichever is queued first.

- touchid-activate said "ready" once the driver attributes did, while
  the driver can still hold the session. It now reports ready only
  when a second open would succeed: the node opens, a client already
  holds it, or the node is gone (the attributes decide, as before).
  After 10 s of a busy node with no process holding it, it records
  "busy" and fails with a journal line that says so.

Signed-off-by: Dylan Ironside <dylan@dylanironside.io>
IronsideXXVI added a commit to IronsideXXVI/omarchy-j604 that referenced this pull request Nov 12, 2026
- Kernel 1.848 = 1.847 + 0337: a T8132 root port's DART stays gated
  until the host has set the port up again after a deep sleep, so the
  first DART register read no longer goes to an unclocked port. Used
  only with the T8132 sleep sequence, which is off by default. Quick
  boot gate PASS, 46 of 46 checks.
- The carried Hyprland / bar pair is not installed any more: the
  0.57.1-2.605 revision failed its vkmark check with blur on (median
  1108 against a minimum of 1619), so the J604 runs the official
  hyprland 0.57.1-2 again and omarchy-dev 1.1. hyprland/ is removed
  (last published in fd61512); omarchy-dev/ is back to its 1.1 content.
  STATUS, README and not-installed/ say so.
- UPSTREAM.md: the six pull requests opened on 2026-11-12
  (omacom/omarchy#18582, #18583; omacom/omarchy-mac-pkgs#131 to #134);
  asahi-alarm/asahi-scripts#1 closed by us, carried downstream;
  aurora-silicon/linux#1492, #1010 and #1497 merged, #1384 closed
  without merging; the audio destination (Wave 2 #19); apple_nvmem_spmi
  not needed with omacom's kernel config; the dwc3-apple drop-in row.

Signed-off-by: Dylan Ironside <dylan@dylanironside.io>

@scottjones scottjones left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The ordering fix and the second-opener check make sense, and the tests catch it when either is removed. Three things need changing first.

1. Drop the version bump (omarchy-mac/version:1, 0.2.6 to 0.2.7). Since #30, only a release/omarchy-mac-<ver> PR changes this file, and CI enforces that. .github/scripts/check-version-bump fails on this branch. Revert the file and the release PR will do the bump.

2. fprintd now reruns the activation every time it starts (omarchy-mac/vendor/systemd/system/fprintd.service.d/50-omarchy-mac-touchid.conf:8). The activation unit is Type=oneshot without RemainAfterExit (omarchy-mac-touchid-activate.service:19). So every start of fprintd queues a new run and waits for it. fprintd quits after about 30 s idle and D-Bus starts it again at the next sudo or lock screen, so this happens over and over in a session, not once per boot. On a Mac that reads ready, each run is short. On a Mac whose attach never settles, each run loops for 45 s (lib/touchid-activate:92) before fprintd comes up. One that reaches attached late but keeps the node busy adds the 10 s second-opener probe. pam_fprintd gives up before then, so every fingerprint prompt stalls and falls back to the password. I confirmed the systemd behaviour with two user units, a oneshot and a unit that Wants= and After= it: starting the second one three times ran the oneshot three times. The fix needs to keep the boot-time ordering without rerunning on every fprintd start. For example, fprintd could skip the activation once this boot has a result. Note that plain RemainAfterExit=yes would also turn the pacman hook's systemctl start into a no-op.

3. The new busy status isn't handled where the other failure reasons are.

  • omarchy-mac/lib/touchid-status:20 keeps failed | not-ready | unproven | blocked after a failed enable this boot, but not busy. I ran it with a busy status and touchid-loaded set: it wrote available, so Omarchy offers Touch ID again while the driver stays loaded until a restart. With not-ready it kept the reason.
  • omarchy-mac/entrypoints/enable-fingerprint:62 has the same list, so busy doesn't get "Restart this Mac".
  • The README's list of reasons needs busy too.

What I ran (merged onto main 1a865a9):

  • omarchy-mac/test/all: 123 ok, exit 0
  • test/touchid-activate-test.sh: 11/11 ok
  • check-version-bump (as a PR from this branch): fails, see 1. check-scope and check-architecture-gates pass.
  • Mutations: calling finish ready directly, removing the new Wants=, and removing the held-by-a-client check each fail a test.
  • I read the kernel's /dev/sep-bio open and release (drivers/soc/apple/sbio.rs, bio.rs). The probe's own open releases the node as soon as it closes, so the probe doesn't recreate the race it is checking for.
  • GitHub shows no CI run on this branch.

One question: in the sbio driver, activation runs inside open() and release is synchronous, so I don't see a window after close that the second-opener probe guards against. If the Wants= ordering is the real fix, the probe may only add a second open. Is there a case it catches?

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.

2 participants