bt-agent.service is permanently skipped when its ExecCondition races bluetooth.service, leaving the session with no Bluetooth pairing agent
Summary
bt-agent.service can be left permanently dead for the whole session, so Omarchy has no Bluetooth pairing agent. Every pairing attempt then fails, and the bar Bluetooth panel can never pair anything — its "paired" list stays permanently empty.
The radio is fine. bluetoothctl scan on still finds devices; they just can't be paired.
Root cause
/usr/lib/systemd/user/bt-agent.service guards itself with an ExecCondition:
ExecCondition=/usr/bin/systemctl is-active --quiet bluetooth.service
Restart=on-failure
and install/user/first-run/enable-user-units.sh starts it with no ordering against the system service:
systemctl --user enable --now \
bt-agent.service \
...
When ExecCondition fails, systemd skips the unit. A skip is a terminal state for that activation — Restart=on-failure does not re-activate it, so the agent is not retried once bluetooth.service finishes coming up a moment later.
bluetooth.service is a system unit started in parallel with the graphical session, so this is a startup race that wins whenever bluez is slow (or on a cold boot / spinning disk). Nothing re-checks the condition for the remainder of the session.
The same thing happens on any later systemctl restart bluetooth.service: bt-agent loses its agent registration and exits non-zero, systemd schedules a restart, and if bluez isn't active within that window the unit is skipped for good.
Evidence
From the journal on a machine that hit this (journalctl --user -u bt-agent):
18:01:17 bt-agent[800]: Agent released
18:01:17 bt-agent[800]: unregistering agent...
18:01:17 bt-agent[800]: org.freedesktop.DBus.Error.ServiceUnknown: The name is not activatable
18:01:18 systemd[758]: bt-agent.service: Main process exited, code=exited, status=1/FAILURE
18:01:18 systemd[758]: bt-agent.service: Failed with result 'exit-code'.
18:01:20 systemd[758]: bt-agent.service: Scheduled restart job, restart counter is at 1.
18:01:20 systemd[758]: bt-agent.service: Skipped due to 'exec-condition'.
18:02:00 systemd[758]: bt-agent.service: Skipped due to 'exec-condition'.
... bluetooth.service becomes active at 18:02:07, agent never returns
Net effect, confirmed at the time:
$ bluetoothctl devices Paired # empty — nothing ever paired
$ systemctl --user show bt-agent -p Result -p ConditionResult
Result=exec-condition
ConditionResult=no
Manually starting it once bluez is up fixes it immediately:
$ systemctl --user start bt-agent
Sep 25 18:10:17 bt-agent[65278]: Agent registered
Sep 25 18:10:17 bt-agent[65278]: Default agent requested
Reproduction
- Have
bluetooth.serviceenabled (Omarchy does this by default). - Start the graphical session such that
bluetooth.serviceis still activating — e.g.systemctl restart bluetooth.serviceshortly before login, or a boot where bluez is slow to come up. systemctl --user show bt-agent.service -p Result→Result=exec-condition.- Try to pair anything from the bar Bluetooth panel. Pairing never completes.
Reliable manual trigger on a running system:
sudo systemctl stop bluetooth.service
systemctl --user restart bt-agent.service # or let Restart=on-failure fire
sudo systemctl start bluetooth.service
systemctl --user show bt-agent.service -p Result # exec-condition
Suggested fix
Order the user unit behind the system service so bluez is active before the condition is evaluated, and let it recover if bluez goes away again later. A drop-in is enough:
# /etc/systemd/user/bt-agent.service.d/override.conf
[Unit]
After=bluetooth.service
Wants=bluetooth.service
[Service]
Restart=always
RestartSec=3
StartLimitIntervalSec=0
This keeps the original intent of the guard (skip cleanly on machines with no usable adapter) without letting the race turn into a permanent skip. Alternatively, dropping ExecCondition in favour of a bounded wait in ExecStartPre would be more robust, since any non-adaptor machine would otherwise restart-loop.
I verified the drop-in on the affected machine: after sudo systemctl restart bluetooth.service the agent re-registered on the first retry, which is precisely where it previously died for the session.
System details
- Omarchy: 4.0.4-1
- Kernel: 7.2.5-3-omarchy
- CPU: Intel Core i5-7360U @ 2.30GHz
- GPU: Intel Kaby Lake-U GT3 (Iris Plus Graphics 640)
- Adapter: USB (
usb:v1D6Bp0246d0557), BlueZ 5.87 - Desktop: Hyprland
A reproducible real-world trigger for the boot-time race, on a ThinkPad T14 Gen 2a (Omarchy 4.0.4-1). When Bluetooth was left off before a reboot, the restored platform-switch block powers the USB radio off at boot and it only returns ~4.4 s later (#13342). So bluetooth.service starts after the user session, and the agent is skipped:
19:34:38.103 systemd[1029]: bt-agent.service: Skipped due to 'exec-condition'.
19:34:40.198 systemd[1]: Starting Bluetooth service...
19:34:40.241 systemd[1]: Started Bluetooth service.
That happened on 2 of the 3 boots after turning Bluetooth off (the other: Skipped at 19:31:05.257, service started 19:31:07.174), with no agent for the rest of the session until systemctl --user start bt-agent.
The restart path in the description also showed up here: after bluetooth.service was stopped, the agent exited with Remote peer disconnected, its restart two seconds later was Skipped due to 'exec-condition', and a later pairing attempt failed with src/device.c:new_auth() No agent available for request type 2 / device_confirm_passkey: Operation not permitted. #13620's ExecStartPre plus retry would cover both.
Checked against quattro: the cause is as described. default/systemd/user/bt-agent.service still guards itself with ExecCondition=/usr/bin/systemctl is-active --quiet bluetooth.service. When that check fails, systemd skips the unit (Result=exec-condition) rather than failing it, so Restart=on-failure never fires. Once the agent loses that race, at login or on the automatic restart after a mid-session bluetooth.service restart, it stays gone until someone runs systemctl --user start bt-agent. Nothing was reproduced on a worker, because the fix is already up for review.
Two open pull requests against quattro fix this, and both have been verified:
- #13258 drops the
ExecConditionand waits forbluetooth.serviceinsideExecStartbefore exec'ingbt-agent. - #13620 swaps the
ExecConditionfor anExecStartPrecheck, so a start that comes too early fails andRestart=on-failureretries it. It also enables the unit from first-run with--no-block.
They compete, so only one will land. Which one is the maintainer's call, and this issue closes when it merges. The open pull request #13598 (restart back-off) and the bot's own #15097 (restart when org.bluez loses its owner) also change this unit, but neither fixes this race.
This was reviewed by Claude Opus 5.5 alone. The second-opinion reviewer (Codex Medium) answered a ping, but today's review budget was spent, so no second opinion ran.
Also hit this on 4.0.6-1, and the race was decided by one second. Up-to-date install, no local override of bt-agent.service.
- Omarchy / omarchy-settings: 4.0.6-1, kernel 7.2.8-9-omarchy, BlueZ 5.87-2, bluez-tools 0.2.0-6
- CPU: Intel i7-7700K, GPU: RTX 3060, x86_64
- Adapter: Realtek USB
2001:332a, controllerDC:EA:E7:A5:6B:59(hci0onusb1/1-5)
Boot at 13:13:41, battery-free desktop with an NVMe, and the shipped unit is enabled and loses:
Oct 24 13:13:57 systemd[982]: bt-agent.service: Skipped due to 'exec-condition'.
Oct 24 13:13:57 systemd[1]: Starting Bluetooth service...
Oct 24 13:13:58 systemd[1]: Started Bluetooth service.
Result=exec-condition, and nothing re-checked it afterwards: no agent for 26 hours (until I started it by hand). So even a sub-second-wide window is enough to break pairing for a whole session.
Symptom was a BLE keyboard (Royal Kludge R65): it showed up in the panel, never bonded, and flapped connect/disconnect forever with no keystrokes and no input device. Journal at the time:
bluetoothd: src/device.c:new_auth() No agent available for request type 2
bluetoothd: device_confirm_passkey: Operation not permitted
bluetoothd: profiles/input/hog-lib.c:info_read_cb() HID Information read failed: Attribute requires authentication before read/write
bluetoothd: profiles/battery/battery.c:batt_io_ccc_written_cb() Battery Level: notifications not enabled Request attribute has encountered an unlikely error
The failed attempts had also left the device in the Trusted: yes / Paired: no state described in #7879, so retries kept failing even after the agent was up; bluetoothctl remove was needed before a clean pair.
systemctl --user start bt-agent.service fixed it immediately (Agent registered / Default agent requested), and the same keyboard then bonded on the first attempt: Paired: yes, Bonded: yes, with real [LongTermKey], [PeripheralLongTermKey] and [SlaveLongTermKey] in /var/lib/bluetooth/DC:EA:E7:A5:6B:59/07:55:08:1C:4D:55/info, plus R65 Keyboard and R65 Mouse uhid devices. Radio and device were fine the whole time.
Two notes for whoever merges this:
- 4.0.6-1 still ships the racy guard unmodified —
ConditionPathIsDirectory=/sys/class/bluetoothon line 4 andExecCondition=/usr/bin/systemctl is-active --quiet bluetooth.serviceon line 13. As of today #9131, #13258 and #13620 (plus #15097 / #13598 for the restart path) are all still open, so the report is live on the current release, not just historical. - On this machine the skip was logged as
Skipped due to 'exec-condition', i.e. the sysfs guard passed and only theis-activecheck lost — which matches theConditionPathIsDirectorycase @zherun saw in #8962 being a second, independent way to reach the same permanent skip. Whatever lands should ideally cover both guards, since both fail as a skip rather than a failure and so neither can useRestart=on-failure.
Local workaround that has held here: a user unit with the guard removed entirely (ExecStart=/usr/bin/bt-agent --capability=NoInputNoOutput, Restart=always, RestartSec=3), which also survives a mid-session bluetooth.service restart.
Logs are from my machine; comment drafted with AI assistance.
Closing this as a duplicate of #8962, which was opened four weeks earlier and is still open. Both report the same bug with the same cause: bt-agent.service gates on ExecCondition=/usr/bin/systemctl is-active --quiet bluetooth.service from the user manager, which cannot order itself after the system's bluetooth.service, and a failed ExecCondition skips the unit rather than failing it, so Restart=on-failure never brings the agent back. The unit on quattro is unchanged today, so the bug is still live, as @1313hati's 4.0.6-1 journal shows.
Nothing from this thread is lost by closing it. #8962 already carries journals from several machines, the mid-session bluetooth.service restart path, and @zherun's report of the second permanent skip through ConditionPathIsDirectory=/sys/class/bluetooth, which @1313hati also raised here. That guard is still on line 4 of the unit in every open fix: #9131, #13258 and #13620 replace only the ExecCondition. Which of those lands is the maintainer's call. #13258 already names #8962 as the issue it closes; #13620 names only this one, so it should also name #8962 for that issue to close when it merges.
Claude Opus 5.5 compared the two reports and the unit on quattro. Codex Medium was asked separately, from the two reports alone, and also found them to be the same bug. If something here is not covered by #8962, this can be reopened.