omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

Quickshell Bluetooth panel cannot pair devices that require a displayed passkey

Open guisaliba opened this issue 3 months ago • 9 comments

System details

  • CPU: Intel Core i7-1255U
  • Omarchy: 4.0.0-1
  • Architecture: x86_64
  • Kernel: 7.1.8-arch1-3
  • Quickshell package: quickshell-git 0.3.0.r20.g28771c7-2
  • Qt runtime: 6.11.2
  • Qt base package: qt6-base 6.11.2-2
  • Qt QML package: qt6-declarative 6.11.2-1
  • Qt Wayland package: qt6-wayland 6.11.2-1
  • BlueZ (bluetoothctl): 5.87
  • bluez-tools: 0.2.0-6
  • Device: Logitech MX Mechanical Mini
  • BlueZ device name: MX MCHNCL M

What's wrong?

Note: Before upgrading to Quattro, this behavior did not use to occur. The bluetooth panel (opened from the Omarchy menu) managed to display passkeys properly.

The Omarchy Bluetooth panel cannot pair a device that requires the user to type a displayed passkey.

When I tried to pair my keyboard (Logitech MX Mechanical Mini) through the panel, the panel did not show the six-digit passkey. The device state repeatedly changed between paired and connected, but the keyboard did not become usable.

After I completed pairing manually with an interactive bluetoothctl KeyboardDisplay agent, the panel stopped changing states and the keyboard worked correctly.

Steps to reproduce

  1. Use an unpaired device that requires a displayed passkey, like the aforementioned keyboard model
  2. Put it into pairing mode.
  3. Click the bluetooth widget in the Quickshell-based status bar to open the Bluetooth panel.
  4. Select the device and start pairing.
  5. Observe that the panel does not show a passkey.
  6. Observe that pairing does not complete.

Expected result

The panel must show the numeric passkey.

The user types that passkey on the Bluetooth device and (optionally) presses Enter. Pairing then completes, and the device becomes paired, bonded, trusted, and connected.

Actual result

The panel does not show the passkey. The user cannot complete the keyboard authentication.

During the failed panel attempts, the user service journal contained this prompt:

Aug 26 09:24:42 <hostname> bt-agent[1184]: Authorize this device pairing (yes/no)? Device: MX MCHNCL M (XX:XX:XX:XX:XX:XX)

This prompt was only present in the journal. It was not shown in the panel, and the panel did not provide a way to answer it.

Successful control test

A normal scan found the keyboard. A forced LE scan was not necessary:

[bluetoothctl]> scan on
SetDiscoveryFilter success
Discovery started
[NEW] Device XX:XX:XX:XX:XX:XX MX MCHNCL M

Interactive pairing with a KeyboardDisplay agent showed the required passkey:

[bluetoothctl]> pair XX:XX:XX:XX:XX:XX
Attempting to pair with XX:XX:XX:XX:XX:XX
[CHG] Device XX:XX:XX:XX:XX:XX Connected: yes
[agent] Passkey: [123456]
[CHG] Device XX:XX:XX:XX:XX:XX Paired: yes
Pairing successful

After I typed the passkey on the MX keyboard and pressed Enter, pairing completed successfully.

The final device state was:

Name: MX MCHNCL M
Alias: MX MCHNCL M
Paired: yes
Bonded: yes
Trusted: yes
Connected: yes
WakeAllowed: yes

This result shows that the keyboard, Bluetooth controller, normal scanning, BlueZ, and authentication method work correctly.

Pairing-agent status

bt-agent is installed:

$ command -v bt-agent
/usr/bin/bt-agent

The user service is active:

bt-agent.service - Bluetooth pairing agent (auto-accept)
Loaded: loaded (/usr/lib/systemd/user/bt-agent.service; enabled; preset: enabled)
Active: active (running)
Main PID: 1184 (bt-agent)
└─1184 /usr/bin/bt-agent -c NoInputNoOutput

Therefore, this system does not have the missing /usr/bin/bt-agent failure reported in #6992.

Technical evidence

bin/omarchy-bluetooth-device runs the pairing operation as a detached bluetoothctl command. It redirects standard output and errors to /dev/null and ignores command failures.

shell/plugins/panels/bluetooth/Panel.qml starts this helper as a detached process. The panel does not receive the command output, exit status, passkey, or authorization request.

The active default agent uses NoInputNoOutput. It cannot provide the user-facing passkey interaction that the keyboard requires.

The current panel path therefore has no user-facing BlueZ authentication flow for devices that require a displayed passkey.

A fix must:

  • Start or register a suitable BlueZ pairing agent.
  • Transfer authentication requests to the Quickshell panel.
  • Show numeric passkeys.
  • Support confirmation and text-input requests where necessary.
  • Show pairing failures and timeouts.
  • Clear the pending state after success, failure, cancellation, or timeout.

Additional information

I could not produce a reliable screen recording after the manual fix. Once the valid bond existed, the panel worked correctly and no longer changed repeatedly between paired and connected.

I did not remove the working bond only to reproduce the visual loop again.

guisaliba avatar Aug 27 '26 00:08 guisaliba

Confirming this on different hardware and a newer Omarchy, with a variant worth recording: the same agent conflict also breaks the legacy PIN pairing path, not just the SSP displayed-passkey path in the original report.

Setup

  • Omarchy 4.0.1-1 (omarchy-settings 4.0.1-1), kernel 7.1.9-arch1-2
  • BlueZ 5.87-2, bluez-utils 5.87-2, bluez-tools 0.2.0-6
  • Apple Mac Mini (2012), Broadcom BCM20702 adapter
  • Device: Apple Wireless Keyboard, 05ac:023a, BR/EDR

Root cause, same as reported

/usr/share/omarchy/default/systemd/user/bt-agent.service runs:

ExecStart=/usr/bin/bt-agent -c NoInputNoOutput

That registers as bluez's default pairing agent, and bluez permits only one. NoInputNoOutput cannot satisfy any handshake that needs a passkey displayed or entered, so no keyboard can pair while it holds the slot.

Different signature on the legacy PIN path

On this keyboard the agent does not merely prompt in the journal - it actively rejects, and bluez then retries the connection until the device gives up:

bluetoothd: src/agent.c:display_pincode_reply() Agent replied with an error:
    org.bluez.Error.Rejected, Passkey does not match
bluetoothd: src/device.c:search_cb() XX:XX:XX:XX:XX:XX: error updating services:
    Software caused connection abort (103)
bluetoothd: src/device.c:search_cb() XX:XX:XX:XX:XX:XX: error updating services:
    Host is down (112)

bluetoothctl devices stayed completely empty throughout - no bond was ever created, which makes this look like failing hardware rather than an agent conflict.

Control test

With the service stopped and an interactive KeyboardDisplay agent, pairing succeeds on the first attempt and the PIN is displayed as it should be:

systemctl --user stop bt-agent.service
[bluetoothctl]> agent KeyboardDisplay
[bluetoothctl]> default-agent
[bluetoothctl]> pair XX:XX:XX:XX:XX:XX
Attempting to pair with XX:XX:XX:XX:XX:XX
[CHG] Device XX:XX:XX:XX:XX:XX Connected: yes
[agent] PIN code: 413263
[CHG] Device XX:XX:XX:XX:XX:XX Bonded: yes
[CHG] Device XX:XX:XX:XX:XX:XX Paired: yes
Pairing successful

Restarting bt-agent.service afterwards is fine - the bond persists, so the conflict only affects pairing, not reconnection.

One note on the unit's safety rationale

The unit comments justify NoInputNoOutput on the grounds that:

the adapter is only pairable: true when the user explicitly opens the omarchy bluetoothPanel and starts scanning; outside that window bluez refuses inbound pair attempts at a lower layer.

#7889 reports the adapter remaining pairable after the panel is closed, so that premise may not hold in practice. If so, the current agent both blocks legitimate keyboard pairing and leaves the auto-accept window open wider than intended.

cheekychops avatar Aug 29 '26 09:08 cheekychops

Additional data point: this same default-agent conflict also breaks reconnection of an already-bonded keyboard, not just first-time pairing.

Symptom is "my Bluetooth keyboard won't connect after a reboot". bluetoothctl info reports the bond as perfectly healthy the whole time:

Paired: yes
Bonded: yes
Trusted: yes
Connected: no

Every connect attempt fails with org.bluez.Error.Failed br-connection-create-socket, and journalctl -u bluetooth shows:

profiles/input/device.c:control_connect_cb() connect to XX:XX:XX:XX:XX:XX: Host is down (112)

Because bt-agent.service restarts at every boot and re-registers as bluez's default agent (bluez permits only one), a keyboard that has to re-establish its link after the host went away is refused the same way a fresh pairing is.

Measured A/B on an Apple Wireless Keyboard, everything else identical:

Agent capability Result
-c NoInputNoOutput (Omarchy default) ~20 bluetoothctl connect attempts, all failed
-c DisplayYesNo connected on the first attempt, reproducibly

Worth noting EHOSTDOWN (112) is also what a sleeping keyboard produces, since an Apple keyboard doesn't page-scan while asleep — so page timeouts alone don't distinguish "the agent is refusing" from "the keyboard is asleep". That made this quite hard to attribute; it reads as failing hardware or flat batteries.

Impact: on a machine whose only keyboard is Bluetooth, this means being locked out after every reboot.

Workaround, as a systemd user drop-in (~/.config/systemd/user/bt-agent.service.d/override.conf):

[Service]
ExecStart=
ExecStart=/usr/bin/bt-agent -c DisplayYesNo

DisplayYesNo is bluez's own default capability — it still auto-accepts Just Works devices (headphones/speakers), but can complete a keyboard handshake. That seems like a strictly better default than NoInputNoOutput here. (Note KeyboardDisplay is not valid for bt-agent; it only accepts DisplayOnly, DisplayYesNo, KeyboardOnly, NoInputNoOutput.)

Environment: Omarchy 4.0.1-1, bluez 5.87-2, bluez-tools 0.2.0-6, Broadcom BCM20702 adapter.

cheekychops avatar Aug 29 '26 14:08 cheekychops

Confirmed on a legacy Apple Wireless Keyboard. This is a second pairing flow affected by the same missing interactive-agent path, and it has one extra wrinkle that may be useful when testing #6877.

System and device

  • Omarchy: 4.0.2-1
  • Kernel: 7.1.9-arch1-2
  • BlueZ / bluez-utils: 5.87-2
  • bluez-tools: 0.2.0-6
  • CPU/GPU: AMD Ryzen AI 9 HX 470 / Radeon 890M
  • Device: Apple Wireless Keyboard, USB modalias v05ACp023Ad0050
  • BlueZ reports LegacyPairing: yes and HID UUID 00001124-0000-1000-8000-00805f9b34fb

Stock behavior

With the stock bt-agent.service running as:

/usr/bin/bt-agent -c NoInputNoOutput

the keyboard was discovered and repeatedly connected transiently, but never bonded:

Paired: no
Bonded: no
Trusted: yes
Connected: yes/no (looping)

The relevant journal evidence was:

bt-agent: Confirm pin code: <six digits> (yes/no)?
bluetoothd: Agent replied with an error: org.bluez.Error.Rejected, Passkey does not match
bluetoothd: profiles/input/device.c:hidp_add_connection() Rejected connection from !bonded device

The prompt existed only on the service's unavailable stdin, so there was no way to complete it from the Quickshell panel. systemctl --user stop bt-agent.service also remained stuck in deactivating (stop-sigterm) until the agent was killed, matching the behavior in #9676.

Successful control test

The keyboard paired successfully after:

  1. Stopping the stock bt-agent.service.
  2. Running bt-agent -c DisplayYesNo interactively.
  3. Putting the Apple keyboard into pairing mode and allowing the keyboard to initiate the legacy pairing request.
  4. Entering an arbitrary numeric passkey at the agent's Enter passkey: prompt.
  5. Immediately typing the same passkey on the Apple keyboard and pressing Enter.

It was important not to launch bluetoothctl pair at the same time as the keyboard-initiated request. Doing so produced:

bluetoothd: Authentication already requested
device_notify_pin: Operation not permitted

After the single interactive flow completed, BlueZ reported:

Paired: yes
Bonded: yes
Trusted: yes
Connected: yes
WakeAllowed: yes

The HID input interface appeared immediately and survives reconnection.

Why this is useful for the fix

The notification-based KeyboardDisplay work in #6877 should ideally be tested against both directions of passkey exchange:

  • a generated passkey that must be displayed and typed on the peripheral; and
  • legacy RequestPinCode / Enter passkey: devices, where the host chooses a code and the same code must then be typed on the keyboard.

This Apple keyboard exercises the second path. The panel should also avoid starting a second outgoing pair operation while an incoming legacy authentication request is already active.

alexbic avatar Sep 02 '26 04:09 alexbic

Reviewed against current quattro (c352b62) by reading the source; not reproduced, since the disposable test machines have no Bluetooth adapter.

The mechanism the report describes holds in the source. The only pairing agent the session registers is bt-agent -c NoInputNoOutput (default/systemd/user/bt-agent.service), running as a service with no terminal, so any passkey, PIN or yes/no prompt it raises goes to the journal and nowhere a person can answer it. The panel starts pairing as a detached omarchy-bluetooth-device pair, which sends bluetoothctl output to /dev/null, ignores failures, and trusts the device even when pairing failed. The panel then treats a trusted device as paired (Panel.qml connectDevice), so the next click only tries to connect, which matches the paired/connected flapping in the report.

The open fix is #9965, which already says it closes this issue. It replaces bt-agent with a KeyboardDisplay agent that hands displayed passkeys, displayed PINs, PIN or passkey entry, and confirmation requests to the panel, which covers both the displayed-passkey keyboards here and the legacy-PIN Apple keyboards in the comments. It leaves omarchy-bluetooth-device unchanged, so a failed pairing is still not reported and still leaves the device trusted; that part is #7879. #12897 also replaces the agent and overlaps with #9965. Each pull request gets its own review.

The second opinion, Codex Medium, reached the same reading of the source and pointed out the trusted-after-failure gap in #9965. It read the same repository this review did, so it was not fully independent. Waiting on the maintainer to choose the fix.

omarchybot avatar Oct 09 '26 03:10 omarchybot

Additional real-hardware control test and third-party-shell coordination: https://github.com/AyushKr2003/omacale/issues/33.

On a Dell Latitude 3550 with Intel AX211 Bluetooth (8087:0033), a Logitech Pebble Keys 2 K380s paired successfully through interactive bluetoothctl --agent KeyboardDisplay: it displayed a six-digit passkey, the user typed it on the Pebble and pressed Enter, and we verified Paired: yes, Bonded: yes, Trusted: yes, Connected: yes. Hyprland registered logitech-pebble-keys-2-k380s; the user confirmed typing works. The existing bt-agent.service remained active as /usr/bin/bt-agent -c NoInputNoOutput; stopping it was not required for this outgoing interactive flow.

Environment: Omarchy 4.0.4-1.1 (locally rebuilt), Quickshell 0.3.1-1.2, BlueZ / bluez-utils 5.87-2, kernel 7.2.5-3-omarchy. Active shell UI is Omacale, installed manifest 0.44.0 with local customizations, not the stock Omarchy Bluetooth panel. Initially rfkill had soft-blocked the Dell Bluetooth switch; unblocking restored the controller. After successful manual pairing, the user reported the connection was still not showing in the normal UI. That display symptom is separately reported to Omacale; no D-Bus trace proves its cause, and we are not claiming to have reproduced a new stock-panel regression or tested the proposed PR.

The source integration point matters for #9965: Omacale dispatches the same detached omarchy-bluetooth-device helper, but renders its own settings and popout instead of shell/plugins/panels/bluetooth/Panel.qml. Please make the shared agent's authentication requests available to third-party bars too (a shell-wide prompt/notification or a documented event/response interface), so replacing the agent does not leave those users unable to see the passkey.

No duplicate Omarchy issue or rival PR is being opened. This adds a BLE HID keyboard control case and links the affected UI maintainer to the existing work. Addresses and actual pairing codes are omitted; the working bond was preserved.

Battlelamb avatar Oct 17 '26 07:10 Battlelamb

Data point from a device that needs no passkey at all, which separates the two halves of this issue.

Setup: Omarchy 4.0.5-1, kernel 7.2.8-9-omarchy, BlueZ 5.87-2, bluez-tools 0.2.0-6, Logitech M720 Triathlon and Logitech MX Ergo. Both are Bluetooth LE HID devices that pair with Just Works, so there is no six-digit passkey and nothing for the panel to display.

What happened: pairing from the panel left each device Trusted: yes, Paired: no, Bonded: no, connecting and disconnecting about once a second. journalctl -u bluetooth filled with profiles/deviceinfo/deviceinfo.c:read_pnpid_cb() Error reading PNP_ID value: Request attribute has encountered an unlikely error (230 lines in one 8 minute boot), and the user journal filled with bt-agent: Authorize this device pairing (yes/no)? Device: MX Ergo (...) at the same rate. The loop restarted a few seconds after every boot, before the panel was opened, because the trust is stored on disk. Clicking the device in the panel again never paired it. bluetoothctl remove <addr> and then bluetoothctl pair <addr> from a terminal bonded both devices on the first try.

Two separate defects, both needed:

  1. bt-agent -c NoInputNoOutput rejects the yes/no authorization, not just passkeys. In bluez-tools' agent-helper.c, RequestAuthorization prints the prompt and reads the answer with scanf from stdin. Under the user service stdin is /dev/null (/proc/<pid>/fd/0 -> /dev/null), so the read hits EOF, the buffer stays empty, and the handler returns org.bluez.Error.Rejected. So an agent that only shows passkeys is not enough on its own: Just Works authorization has to be auto-accepted too. #9965 should be checked for that path.
  2. omarchy-bluetooth-device pair trusts and connects regardless of the pair result, and Panel.qml connectDevice takes trusted as paired. That is what turns one failed pair into a permanent per-second reconnect loop and makes it unrecoverable from the UI. This part does not depend on the agent, and it is the same script and panel fix #6877 carried. I have opened it on its own as #16014 so it can land independently of the agent rewrite.

kstaikov avatar Oct 19 '26 22:10 kstaikov

Re-read against current quattro (087f73d89) after the two new comments, by reading the source; still not reproduced, since the disposable test machines have no Bluetooth adapter. Nothing on quattro has changed the pairing path since the last review.

The Just Works rejection @kstaikov describes holds in the bluez-tools source. bt-agent runs its prompts interactively unless it is started with --daemon (src/bt-agent.c), and the unit starts it with only -c NoInputNoOutput. Its RequestAuthorization handler reads the answer with scanf and accepts only yes or y (src/lib/agent-helper.c). Under the user service stdin is /dev/null, so the answer is empty and the pairing is rejected. The comment in default/systemd/user/bt-agent.service saying NoInputNoOutput auto-accepts pair requests is therefore wrong for that path, and passkey devices are not the only ones affected: this also breaks Just Works devices.

What this means for the open fixes:

  • #9965 still covers the agent half, and says it closes this issue. It does not auto-accept Just Works authorization: it asks in the panel ("Allow pairing with …?"), and rejects the request if the user does not answer within 30 seconds or no client is connected to its socket. It accepts AuthorizeService without asking. #15044 has landed on quattro since #9965 was opened, and it builds the panel's content only when the panel first opens. #9965 still merges without conflicts and its socket stays outside that content, so it connects at startup. But handleAgentMessage now refers to authDialog, which is declared inside the lazily built content and so cannot be reached from there. The dialog has its own focus handling, so this probably costs a failed focus call rather than the prompt itself, but it was not run.
  • The socket in #9965 ($XDG_RUNTIME_DIR/omarchy/bluetooth-agent.sock, newline-delimited JSON, any number of clients, the first valid reply to a request wins) is already enough for a third-party bar to show and answer the prompts, as @Battlelamb asks. It is not documented as an interface.
  • #16014 is new and fixes the other half: after a failed pair, the device is no longer left trusted and the panel no longer treats it as paired. It does not close this issue, which is right, since the passkey half remains. The older #12897 changes the same lines of omarchy-bluetooth-device differently. #12897 waits for Bonded: yes after connect, so a device that only bonds while connecting still gets trusted. #16014 checks Paired: yes straight after pair and removes the trust if pairing failed. #16014's connect action also still trusts the device without checking for a bond, although the panel now reaches it only for bonded devices. They compete, and each pull request gets its own review.

The second opinion, Codex Medium, reached the same reading of the bluez-tools source, #9965's agent, the merged panel and the two pair changes, and pointed out the Paired/Bonded difference and the unconditional AuthorizeService. It could not reach GitHub to read the new comments itself, and it read the same repository this review did, so it was not fully independent. Waiting on the maintainer to choose the fixes.

omarchybot avatar Oct 21 '26 15:10 omarchybot

Third hardware confirmation — and the failing callback is DisplayPinCode (legacy PIN), not SSP passkey

Reproduced deterministically twice on current quattro, with the agent's own prompt visible in the user journal. Adding a data point because the log line names the exact BlueZ callback, and because the obvious fix (-d) does not work for this path.

Environment

  • Omarchy 4.0.6-1 / omarchy-settings 4.0.6-1, Arch Linux, kernel 7.2.8-9-omarchy
  • bluez 5.87-2, bluez-utils 5.87-2, bluez-tools 0.2.0-6
  • AMD Ryzen 7 5700G / B550, adapter: Realtek USB BT 5.3 (0bda:a729), adapter Powered: yes
  • Device: Keychron K2 Pro, HID 3434:0221, BR/EDR keyboard, Class: 0x00002540

Steps

  1. Stock bt-agent.service active (/usr/bin/bt-agent -c NoInputNoOutput, StandardInput=null).
  2. Put the keyboard in pairing mode; it is discovered normally ([NEW] Device ...).
  3. Pair through the stock path — the panel, or equivalently omarchy bluetooth device pair <MAC>.

Actual

bt-agent[...]: Confirm pin code: <pin> (yes/no)? Device: Keychron K2 Pro (XX:XX:XX:XX:XX:XX)
bluetoothd[...]: src/agent.c:display_pincode_reply() Agent replied with an error:
                 org.bluez.Error.Rejected, Passkey does not match
bluetoothd[...]: src/device.c:search_cb() XX:XX:XX:XX:XX:XX: error updating services:
                 Software caused connection abort (103)

No bond is created; the device directory under /var/lib/bluetooth/<adapter>/<device>/ stays empty:

Name: Keychron K2 Pro
Paired: no
Bonded: no
Trusted: yes
Connected: no
LegacyPairing: yes

The panel still shows the device as connected while the ACL link is up, which is the "shows Connected but keyboard does nothing" symptom.

Why this is the legacy path, not the SSP passkey path from the report

In BlueZ 5.87, src/agent.c:display_pincode_reply() is the reply handler for org.bluez.Agent1.DisplayPinCode (src/agent.c:815, called from :906); the SSP paths use request_confirmation_reply() / display_passkey_reply(). So the failing call is DisplayPinCode, which BlueZ uses because the device advertises LegacyPairing: yes. The PIN is meant to be read by the user and typed on the keyboard — it was never shown, because the agent rejected before that could happen.

Root cause in bluez-tools 0.2.0 (src/lib/agent-helper.c)

// :41
static gboolean _interactive = TRUE;

// DisplayPinCode handler, :123
const gchar *pin = _find_device_pin(...);   // no -p pin file is passed by the unit
...
if (pin != NULL) { ... }                     // not taken
else if (_interactive) {                     // taken
    g_print("Confirm pin code: %s (yes/no)? ", pincode);   // :156
    if (scanf("%3s", yn) == EOF && errno) ...              // reads StandardInput=null
    if (strcasecmp(yn, "yes") == 0) accept;                // never true (yn empty)
    else return Rejected, "Passkey does not match";         // :165
}

_interactive is TRUE because bt-agent.c:239-242 only calls register_agent_callbacks(FALSE, ...) when -d is given, and the unit runs bt-agent -c NoInputNoOutput without -d.

-d is not a fix for this callback. With -d the handler skips the scanf and falls through to agent-helper.c:169, which still returns org.bluez.Error.Rejected / "Pairing rejected". -c NoInputNoOutput only sets the capability passed to RegisterAgent; it is never consulted when deciding whether to accept a request. So no combination of the existing flags makes this agent auto-accept DisplayPinCode without a -p pin file.

Workaround (works, creates a usable bond)

systemctl --user stop bt-agent.service
bluetoothctl
  scan on
  pair XX:XX:XX:XX:XX:XX     # type the displayed PIN on the keyboard, then Enter
  trust XX:XX:XX:XX:XX:XX
  connect XX:XX:XX:XX:XX:XX

Suggested fix

The agent answer for DisplayPinCode/DisplayPasskey is just an acknowledgement — auto-accepting it is harmless — but the user still needs to see the PIN to type it on the keyboard. So a fix needs both halves:

  1. Return success for DisplayPinCode, DisplayPasskey, RequestConfirmation and RequestAuthorization instead of prompting on stdin (or drop bt-agent and keep a bluetoothctl --agent NoInputNoOutput instance alive).
  2. Surface the PIN to the user, e.g. via notify-send or in the Bluetooth panel itself, since that is the only component that can show it in time.

Related: #8485, #9676, #10771.


AI disclosure: this report was produced by an AI assistant (DeepSeek V4.1 Flash Free, running in OpenCode) by inspecting live logs, installed unit files and the bluez/bluez-tools sources on the reporter's machine. A human put the device into pairing mode, reviewed the text and posted it from their own account. No device addresses, hostnames or usernames are included.

colutti avatar Oct 25 '26 20:10 colutti

Re-read against current quattro (e2c7007c1) after #9965 closed and the new comment from @colutti, by reading the source. It is still not reproduced, because the disposable test machines have no Bluetooth adapter. Nothing on quattro has changed the pairing path: bt-agent.service still runs bt-agent -c NoInputNoOutput, and omarchy-bluetooth-device pair still discards bluetoothctl's output and trusts the device whatever the result.

#9965 has been closed by its author without being merged. It was the only open pull request that sent passkeys and PINs to the panel. So nothing open now fixes the half of this issue where the code is never shown.

@colutti's reading of the legacy PIN path holds in the bluez-tools source. With no -p PIN file, DisplayPinCode in src/lib/agent-helper.c asks Confirm pin code ... (yes/no)? on stdin. Under the service, stdin is /dev/null, so the request is rejected with "Passkey does not match". With -d it skips the prompt and is rejected with "Pairing rejected" instead. So -d does not fix this.

The open pull requests that still touch the agent don't make a code visible:

  • #9997 looks for a Passkey: line in the output of bluetoothctl pair <address>. Run with a command on its argument list, bluetoothctl is non-interactive. BlueZ 5.87 then skips registering its own agent (src/shared/shell.c sets NON_INTERACTIVE; client/main.c checks it before agent_register). The request therefore goes to bt-agent, and that line is never printed. Legacy devices also print PIN code:, not Passkey:.
  • #8929 feeds yes into bt-agent, which answers its yes/no prompts. The PIN or passkey still reaches only the journal, though, and the agent stays NoInputNoOutput.
  • #10111 registers bluetoothctl's own agent through stdin. It sends that output to /dev/null, so the code is never shown. It also sends quit right after pair, so the client can exit before pairing finishes.
  • #12897 replaces bt-agent with its own agent. That agent acknowledges DisplayPinCode and DisplayPasskey without showing anything, and answers RequestPinCode with 0000. It covers Just Works authorization but not devices that need a code.

The trust-after-failure half is unchanged since the last review: #16014 and #12897 still compete there.

The second opinion came from two reviewers, Codex Medium and muse-wonder via pi at high thinking. Both confirmed the BlueZ and bluez-tools readings above. They added the early quit in #10111, the PIN code: prefix, and the fixed 0000 answer in #12897, which I checked against that diff. They read the same sources this review did, so they are not fully independent. Waiting on the maintainer: a fix needs an agent that can display codes, wired to the panel or to notifications, and choosing that design is the maintainer's call.

omarchybot avatar Nov 01 '26 22:11 omarchybot