Bluethooth ramdomly fails

Hello everyone,

I have encountered an issue where the Bluetooth devices randomly stop working. When this happens, if I open the bluetooth’s setting in Gnome it shows that it is powered on, however nothing responds. When I try to reset it with the switch at the top, it stays gray and stops showing the devices.

This is the output for systemctl status bluetooth

● bluetooth.service - Bluetooth service
     Loaded: loaded (/usr/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2022-04-04 14:56:53 -05; 19min ago
       Docs: man:bluetoothd(8)
   Main PID: 1030 (bluetoothd)
     Status: "Running"
      Tasks: 1 (limit: 21345)
     Memory: 3.3M
        CPU: 327ms
     CGroup: /system.slice/bluetooth.service
             └─1030 /usr/libexec/bluetooth/bluetoothd

Apr 04 14:58:02 fedora bluetoothd[1030]: Endpoint registered: sender=:1.93 path=/MediaEndpoint/A2DPSource/ldac
Apr 04 14:58:02 fedora bluetoothd[1030]: Endpoint registered: sender=:1.93 path=/MediaEndpoint/A2DPSource/aac
Apr 04 14:58:02 fedora bluetoothd[1030]: Endpoint registered: sender=:1.93 path=/MediaEndpoint/A2DPSink/sbc
Apr 04 14:58:02 fedora bluetoothd[1030]: Endpoint registered: sender=:1.93 path=/MediaEndpoint/A2DPSource/sbc
Apr 04 14:58:02 fedora bluetoothd[1030]: Endpoint registered: sender=:1.93 path=/MediaEndpoint/A2DPSink/sbc_xq
Apr 04 14:58:02 fedora bluetoothd[1030]: Endpoint registered: sender=:1.93 path=/MediaEndpoint/A2DPSource/sbc_xq
Apr 04 14:58:02 fedora bluetoothd[1030]: Endpoint registered: sender=:1.93 path=/MediaEndpoint/A2DPSource/faststream
Apr 04 14:58:02 fedora bluetoothd[1030]: Endpoint registered: sender=:1.93 path=/MediaEndpoint/A2DPSource/faststream_duplex
Apr 04 15:15:17 fedora bluetoothd[1030]: src/adv_monitor.c:btd_adv_monitor_power_down() Unexpected NULL btd_adv_monitor_manager object upon power down
Apr 04 15:15:55 fedora bluetoothd[1030]: Failed to set mode: Failed (0x03)

lsusb

Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 003: ID 0bda:c123 Realtek Semiconductor Corp. Bluetooth Radio
Bus 003 Device 002: ID 04f3:0c4b Elan Microelectronics Corp. ELAN:Fingerprint
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 04f2:b725 Chicony Electronics Co., Ltd Integrated Camera
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

bluetoothctl

[Bluetooth Mouse M336/M337/M535]# power off
Changing power off succeeded
[CHG] Device XX:XX:XX:XX:XX:XX Connected: no
[CHG] Device XX:XX:XX:XX:XX:XX Connected: no
[CHG] Controller XX:XX:XX:XX:XX:XX Powered: no
[CHG] Controller XX:XX:XX:XX:XX:XX Discovering: no
[CHG] Controller XX:XX:XX:XX:XX:XX Class: 0x00000000
[bluetooth]# power on
Failed to set power on: org.bluez.Error.Failed
[bluetooth]# power on
Failed to set power on: org.bluez.Error.Busy

Also, running the following command does not work: sudo rfkill block bluetooth;sudo rfkill unblock bluetooth;sudo systemctl restart bluetooth.service

Do you have any ideas?

I just google’d the error message and found this:

That thread appears to suggest that it is something to do with “suspend/resume” and that “bluez-5.62 works perfectly”.

On my Fedora Linux 35 system, I see that bluez-5.64 is currently installed.

[/home/gregory]$ rpm -q bluez
bluez-5.64-1.fc35.x86_64

I also see that it can be downgraded to version 5.61.

[/home/gregory]$ sudo dnf downgrade bluez
Last metadata expiration check: 3:54:39 ago on Mon 04 Apr 2022 04:42:26 PM CDT.
Dependencies resolved.
===============================================================================================
 Package                     Architecture      Version                 Repository         Size
===============================================================================================
Downgrading:
 bluez                       x86_64            5.61-1.fc35             fedora            966 k
 bluez-cups                  x86_64            5.61-1.fc35             fedora             29 k
 bluez-libs                  i686              5.61-1.fc35             fedora             88 k
 bluez-libs                  x86_64            5.61-1.fc35             fedora             84 k
 bluez-libs-devel            x86_64            5.61-1.fc35             fedora            144 k
 bluez-obexd                 x86_64            5.61-1.fc35             fedora            217 k

Transaction Summary
===============================================================================================
Downgrade  6 Packages

Total download size: 1.5 M
Is this ok [y/N]: 

Does the problem persist for you if you downgrade the bluez package to version 5.61?

My issue occurs some minutes after reboot. Actually, if suspend for a few hours, bluetooth starts working again. Which is the opposite of the reported issue you mentioned.

However, I have downgraded from bluez-5.64-1.fc35.x86_64 to bluez-5.61-1.fc35.x86_64, and I will test if it solves it.

Would you please post the output of the command:

cat /sys/module/usbcore/parameters/autosuspend

In /sys/module/usbcore/parameters/autosuspend I have a 2

1 Like

I’m not sure (I don’t have enough technical expertise), but I’m afraid that in kernels > 5.4 some problem has been introduced in dynamic suspend. As I wrote in another conversation, in my case I solved the problem by preventing any autosuspend by setting the value of usbcore.autosuspend to -1.

You should edit the

/etc/default/grub

file by adding:

usbcore.autosuspend=-1

to the GRUB_CMDLINE_LINUX entry.

Then, in order to create a new grub2 configuration file:

# grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

After rebooting the system the “autosuspend” parameter should have value -1.

2 Likes

The thing is that my issue happens even if I haven’t suspended my machine while I’m working. Sometimes it even occurs a minute after I have power on the machine. So, I don’t think it is related to suspension mechanism.

As I have mentioned earlier, suspending the machine for a few hours actually solves the issue, rather than causing it.

I have been testing @glb proposal and the issue hasn’t repeated, while before it happened like 10 times a day. I will keep testing it for a week before marking it as the solution.

I wouldn’t really consider downgrading a package as a “solution”. You may well find that you need to upgrade it at some point in order to get some other needed feature or security patch. Proving that the functionality changes when the package is downgraded just helps to narrow down where the problem lies. The next step would be to search the issues in the git repo to see if there is an existing/known match for your problem and report a new issue if you don’t find one. The problem would be solved when a new package is released that no longer exhibits the broken behavior.

Just my 2¢.

1 Like

Actually, “dynamic suspend” refers to suspending individual devices while the system remains running. Also in my case the bluetooth devices would disconnect frequently, without having suspended the entire system, with the identical behavior you described in the first post. That’s why I assumed your problem was similar to mine.

1 Like

Sorry for my lack of experience. I will then test the suspend flag with the newer version. And see if there is an issue in GitHub. Thank you all!

1 Like

Solved my problem! Thanks.

1 Like