omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

BLE HID never reconnects after resume: le-connection-abort-by-local, adapter healthy, not the autosuspend path in #12095

Open safajirafa opened this issue 1 month ago • 6 comments

What happened

After the machine resumes from standby, the paired Bluetooth mouse (Logitech MX Master 3S, D0:CC:5B:64:79:63) stops reconnecting. BlueZ still has it as Paired: yes / Bonded: yes / Trusted: yes / Connected: no, and bluetoothctl connect fails.

omarchy restart bluetooth does not fix it. Neither does an adapter power cycle:

$ bluetoothctl power off && bluetoothctl power on
$ bluetoothctl connect D0:CC:5B:64:79:63
Attempting to connect to D0:CC:5B:64:79:63
Failed to connect: org.bluez.Error.Failed le-connection-abort-by-local

le-connection-abort-by-local is the local host aborting the LE connection attempt, so the retry loop never has anything to succeed against. A 20s bluetoothctl --timeout 20 scan on finds no advertisements from the mouse, so BlueZ is not simply missing a reconnect window.

Related: omarchy #12095 describes the same user-visible symptom (BLE HID never reconnects after wake) but is specific to Intel controllers autosuspended via the Chromium OS hwdb allowlist. This machine has a Realtek combo adapter, so that analysis does not apply.

Steps to reproduce

  1. Pair a BLE HID mouse (MX Master 3S).
  2. Suspend and resume the machine.
  3. Try to reconnect the mouse, either by moving it or from the Bluetooth panel.

Also observed on this machine with no standby involved: the mouse stopped advertising altogether and stayed le-connection-abort-by-local across repeated omarchy restart bluetooth and an adapter power cycle, until the mouse was woken by a button press.

Suspected area

Not confirmed. The pieces I ruled out on this machine:

  • Not the shipped USB autosuspend fix. /etc/modprobe.d/omarchy-usb-autosuspend.conf contains options usbcore autosuspend=-1, and usbcore is builtin (modinfo usbcore -> (builtin)), so the parameter never applies: /sys/module/usbcore/parameters/autosuspend still reads 2. This confirms the inert-file half of #12095 generally, though the controller here is not one the hwdb matches.
  • Not runtime PM on the controller. /sys/bus/usb/devices/1-2/power/runtime_status stayed active for the whole time I watched it, despite power/control=auto and power/autosuspend_delay_ms=2000. So the controller is not asleep while the connect fails.
  • Not a leaked discovery session. Adapter1 Discovering is false while idle, and no third-party Bluetooth client is running. (The mechanism reported in #11380, for the record.)
  • Not a blocked radio. rfkill shows hci0 unblocked in both soft and hard, and bluetoothctl show reports Powered: yes.

What I did not do

I did not add any hook, udev rule, or modprobe drop-in. ~/.config/omarchy/hooks/bt-reconnect-mouse.sh is a leftover from an earlier attempt and is currently installed nowhere (omarchy hook install copies into a <type>.d/ directory, and there is no .d/ entry for it), so it never runs.

System details

Omarchy:    4.0.4-1
Kernel:     7.2.5-3-omarchy (linux-omarchy)
BlueZ:      5.87-2
CPU:        Intel(R) Core(TM) i5-7500 @ 3.40GHz (Kaby Lake desktop)
GPU:        Intel HD Graphics 630
Bluetooth:  Realtek 0bda:c820 combo adapter, mounted at
            /sys/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.0
            MAC 3C:64:CF:8A:59:5B, HCI class 0x006c0104
Mouse:      Logitech MX Master 3S, D0:CC:5B:64:79:63, modalias usb:v046DpB034d0003
CONFIG_BT_HCIBTUSB=m, CONFIG_BT_HCIBTUSB_AUTOSUSPEND=y
No TLP, no powertop installed. rfkill: hci0 unblocked, phy0 (wlan) soft-blocked.

omarchy debug --no-sudo --print from the contributing guide does not exist on 4.0.4 (omarchy commands --all has no debug subcommand), so the raw outputs above stand in for it.

Question

Is a Bluetooth-reconnect attempt after resume supposed to be Omarchy's job at all, or is this expected to be handled by BlueZ's passive auto-connect for bonded devices? If it is Omarchy's job, the missing piece seems to be a resume hook that retries connect for bonded devices, since the adapter is healthy and the retry currently has nothing to work with.

safajirafa avatar Oct 10 '26 01:10 safajirafa

Separate defect: omarchy restart bluetooth never restarts the service

While collecting diagnostics for the above I found that the documented recovery command does not do the second half of what it claims. This is independent of the resume/reconnect failure but makes that failure much harder to diagnose, since omarchy restart bluetooth looks like it worked.

omarchy-restart-bluetooth in full:

#!/bin/bash

# omarchy:summary=Unblock and restart the bluetooth service.

echo -e "Unblocking bluetooth...\n"
rfkill unblock bluetooth
rfkill list bluetooth

The summary is "Unblock and restart the bluetooth service." The script contains no systemctl restart (or any other service operation) — it only clears the rfkill soft block and prints the result.

The block is usually already clear, so the command is frequently a complete no-op. Evidence on 4.0.4-1:

$ omarchy restart bluetooth
Unblocking bluetooth...

0: hci0: Bluetooth
	Soft blocked: no
	Hard blocked: no

$ systemctl show bluetooth -p ActiveEnterTimestamp -p NRestarts
ActiveEnterTimestamp=Fri 2026-10-09 10:51:22 -05
NRestarts=0

Identical timestamp and NRestarts=0 before and after, across several runs. journalctl -u bluetooth shows no new Starting Bluetooth service... entries for those invocations. Over a session where I ran it four times, bluetoothd had only actually restarted three times since boot, and only at points unrelated to my invocations.

By contrast, the real restart reconnects the mouse immediately:

$ pkexec systemctl restart bluetooth
$ bluetoothctl info D0:CC:5B:64:79:63 | grep Connected
	Connected: yes
$ ls /dev/hidraw3
/dev/hidraw3

The kernel log lines the mouse coming back up are unambiguous, and correlate 1:1 with genuine service starts rather than with omarchy restart bluetooth:

Oct 07 10:33:34 kernel: logitech-hidpp-device 0005:046D:B034.0004: HID++ 4.5 device connected.
Oct 08 17:22:54 kernel: logitech-hidpp-device 0005:046D:B034.000E: HID++ 4.5 device connected.
Oct 09 10:51:23 kernel: logitech-hidpp-device 0005:046D:B034.000F: HID++ 4.5 device connected.

Expected behavior

omarchy restart bluetooth should restart the service, matching its summary and its position in the omarchy restart group, rather than only clearing the rfkill block. Users following the recovery advice in the existing Bluetooth issue reports will conclude the service was reset when it was not.

Not proposing a patch; noting it so the resume/reconnect investigation is not confounded by a command that reports success without doing anything.

safajirafa avatar Oct 10 '26 12:10 safajirafa

Thanks for the detailed diagnostics. The second defect you found is real: on quattro, bin/omarchy-restart-bluetooth only runs rfkill unblock and never restarts bluetooth.service, despite its summary. That's a small, separate fix (sudo systemctl restart bluetooth after the unblock), so it might be worth its own issue or PR so it doesn't get lost behind the reconnect investigation.

For the reconnect itself, could you attach journalctl -b -u bluetooth and btmon output covering a failed bluetoothctl connect after resume, plus your Omarchy version and the adapter's lsusb ID? That would help tell a controller/firmware issue apart from a BlueZ one.

jandrusk avatar Oct 12 '26 18:10 jandrusk

Same mouse (MX Master 3S), same post-resume failure, but a different host-side signature on Intel hardware — and a clean answer to the closing question of this report.

System: Omarchy 4.0.5-1, kernel 7.2.11-arch1-1, BlueZ 5.87, Intel Bluetooth 8087:0033.

1. On this machine the failure is silent, not le-connection-abort-by-local. After resume, powering the mouse on produced no reconnection and no log lines anywhere: bluetoothd produced nothing for its address across its entire lifetime (it logs nothing for this device even on successful connects), and manual connect attempts just hung past ~25s with no D-Bus reply. I believe a good part of these failed manual attempts (mine included) are the peripheral, not the host: the MX Master 3S advertises only briefly after power-on, then drops into deep sleep until physically moved. When I kept the mouse physically moving during a live scan, its advertisements appeared immediately and the kernel auto-connected ~2s later — before my queued connect command even ran. Your "20s scan finds no advertisements" and the "stops advertising until a button press" observation both fit that window; worth ruling out in any repro, because it makes healthy stacks look broken.

2. BlueZ's passive auto-connect is sufficient — the daemon just needs un-wedging after resume. With runtime PM untouched (power/control=auto, delay 2000ms):

  • Passive test on a fresh daemon: bluetoothctl disconnect the mouse, no discovery session, no retries — it reconnected on its own within ~20s.
  • Full systemctl restart bluetooth.service: both the BLE mouse and a BR/EDR keyboard reconnected on their own ~20s later.

This matches what your own diagnostics showed: omarchy restart bluetooth didn't fix it for you because it never restarts the service, while your pkexec systemctl restart bluetooth reconnected the mouse immediately.

So, answering the question at the end of the report: Omarchy shouldn't need to retry connect for bonded devices — restoring bluetoothd after resume is enough for BlueZ's passive auto-connect to do its job. I'm running this locally as a resume hook:

[Unit]
Description=Restart Bluetooth after resume to restore LE auto-connect
After=suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target

[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl restart bluetooth.service

[Install]
WantedBy=suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target

If maintainers want it upstream, this maps to a small default/systemd/system-sleep/bluetooth-reconnect script in the fprintd-resume pattern. Your Realtek le-connection-abort-by-local may still be a second, deeper defect — but on both our machines the daemon restart is the common recovery path, and shipping it as a resume hook would cover the class.

pedrosatin avatar Oct 19 '26 17:10 pedrosatin

Reviewed against quattro at be54892f3. Two findings, one confirmed and one not.

omarchy restart bluetooth never restarts the service: confirmed in source. bin/omarchy-restart-bluetooth runs only rfkill unblock bluetooth and rfkill list bluetooth; nothing in it touches bluetooth.service, though its summary says "Unblock and restart the bluetooth service". The script was created to unblock a stuck radio (91c8ad36f), and the "and restart" wording was added later without a change in behaviour (9741b29a7). bin/omarchy-restart-wifi has the same shape. So the menu's Bluetooth recovery entry does nothing for an adapter that is already unblocked, which is the state this report is in. Whether to fix this by making the command restart the service (a sudo prompt from the menu, and every connected Bluetooth device drops) or by correcting the summary to what the command does is a choice about behaviour, so no pull request has been opened; it is waiting on the maintainer. One small correction to the evidence: NRestarts counts only automatic restarts, so it stays 0 across a manual restart too. The unchanged ActiveEnterTimestamp and the journal are what show the service was not restarted.

The reconnect after resume: plausible causes, none established. This needs Bluetooth hardware, which the VM workers do not have, so nothing was reproduced. Nothing in this repository runs on resume and touches Bluetooth: the four hooks in default/systemd/system-sleep/ handle fprintd, the keyboard backlight, the GPU mode and FUSE, and Omarchy ships no BlueZ configuration that would affect LE auto-connect. The candidates still standing are the mouse not advertising (the MX Master 3S deep-sleeps until moved, which fits the empty 20-second scan, the no-standby occurrence cleared by a button press, and @pedrosatin's observation), stale reconnect state in bluetoothd or the kernel after resume (which fits a service restart recovering it), and a controller or firmware fault on this adapter. An empty scan on cannot tell a silent mouse from a host that is not scanning, and le-connection-abort-by-local says the connect was aborted locally, not why. What separates them is the capture @jandrusk asked for: btmon together with journalctl -b -u bluetooth and journalctl -k, covering suspend, a failed bluetoothctl connect after resume, waking the mouse by moving it, and the recovery, with the Bluetooth panel closed.

On the question in the report: restarting bluetooth.service after every resume, as proposed in the thread, would drop every connected device on every machine, audio included, to work around a failure whose cause is not yet known. That is a decision for the maintainer, so it has not been filed.

Checked by Claude Opus 5.5, with a second opinion from Codex Medium and muse-spark-1.3-contributor (pi, thinking high), which agreed on both findings and added the NRestarts and error-code corrections above; their independence is not guaranteed. Waiting on the maintainer for the restart command, and on a btmon capture for the reconnect.

omarchybot avatar Oct 22 '26 08:10 omarchybot

Same symptom on different hardware, with one difference: here a manual connect succeeds, so this looks like a resume-specific auto-connect gap rather than a dead link.

System: Framework Laptop 13 Pro (Intel Core Ultra Series 3), Omarchy 4.0.6-1, kernel 7.2.8-9-omarchy, BlueZ 5.87-2. Bluetooth: Intel PCIe 8086:E476, driver btintel_pcie (not USB, so the #12095 autosuspend path doesn't apply), firmware intel/ibt-00a0-01a1-pci.sfi 214-29.26, controller settings include ll-privacy. Devices: Air75 V3 keyboard and Logitech MX Anywhere 3 (both HOG, random address; Paired/Bonded/Trusted/WakeAllowed yes).

  • While awake, power-cycling the keyboard → it auto-reconnects within seconds. Passive auto-connect works.
  • After boot or resume (Controller resume with wake event 0x0) → neither device reconnects on its own. A bluetoothctl connect / panel click works immediately.
  • Adapter1.Discovering was not stuck across suspend (so not #10818, though I do hit that panel stop-discovery failure separately).

Workaround I'm testing: a oneshot service that retries bluetoothctl connect for trusted keyboard/mouse devices for 90s, started after bluetooth.service and from a system-sleep post hook. A user-level post-resume hook (like post-boot.d) would make this possible without root.

xybrw avatar Oct 31 '26 17:10 xybrw

Re-checked against quattro at 175e63b62 after @xybrw's report. Two corrections to my earlier comment, and what the new report adds.

The restart command already has fixes waiting. I said no pull request had been opened for omarchy restart bluetooth never restarting the service. That was wrong. The same defect is #13078, and two open pull requests fix it: #13101 restarts bluetooth.service, and #13085 restarts it and reloads btusb if no controller comes back. Both close #13078, not this issue, which is right because neither touches reconnecting after resume. Choosing between them is up to the maintainer. bin/omarchy-restart-bluetooth on quattro is unchanged.

What @xybrw's report adds. It's a third hardware signature: Intel PCIe (btintel_pcie, so not the USB autosuspend path in #12095), with two trusted HOG devices. They reconnect on their own while the machine is awake, don't reconnect on their own after boot or resume, and connect at once when asked explicitly. On that machine the link works and the host just isn't initiating the connection after the controller comes up, which doesn't fit a wedged daemon. It doesn't explain the original report, where explicit connects failed with le-connection-abort-by-local. It also doesn't place the fault in Omarchy rather than BlueZ, the kernel or firmware, and the retry service is still being tested. So the two reports may be different failures with the same symptom.

Related open work. #7694 reconnects trusted keyboards and mice once, at login, which is the after-boot half of @xybrw's report. It doesn't run after resume. As written it would also skip every device in this thread: it selects devices by the classic HID UUID 00001124-…, but BLE keyboards and mice like the MX Master 3S, MX Anywhere 3 and Air75 advertise HID over GATT, 00001812-…. No open pull request handles reconnecting after resume.

Still open: nothing here can be reproduced on the VM workers, which have no Bluetooth hardware. For the original report, a btmon capture alongside journalctl -b -u bluetooth and journalctl -k would separate the causes. It should cover suspend, a failed connect after resume, moving the mouse, and the recovery. For @xybrw's, the same capture over a resume where the devices don't come back would show whether the host ever starts passive scanning for them. Whether Omarchy should ship a reconnect after resume at all is a decision for the maintainer.

Checked by Claude Opus 5.5, with a second opinion from Codex Medium. It agreed on the corrections and found the HOG UUID gap in #7694 itself. Its independence is not guaranteed.

omarchybot avatar Nov 02 '26 00:11 omarchybot