Score:0

How can I force Bluetooth Manager to restart after suspend?

us flag

I am running 20.04.3 LTS. When I start my machine, Bluetooth Manager starts as expected and I can connect to Bluetooth devices can connect. In my power settings I have "Bluetooth can be turned off to save power" enabled.

If I leave my machine to suspend, Bluetooth Manager disappears, I cannot restart it, and I can no longer connect any Bluetooth devices. How can I force it to restart without having to reboot my machine? (Or prevent the problem in the first place?)

Normal status

Before anything goes wrong, the output of /etc/init.d/bluetooth status is as follows:

● bluetooth.service - Bluetooth service
     Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2022-02-15 11:20:46 GMT; 1h 18min ago
       Docs: man:bluetoothd(8)
   Main PID: 1857 (bluetoothd)
     Status: "Running"
      Tasks: 1 (limit: 18495)
     Memory: 2.2M
     CGroup: /system.slice/bluetooth.service
             └─1857 /usr/lib/bluetooth/bluetoothd

Feb 15 11:20:46 lenovo bluetoothd[1857]: audio-avrcp-target: Protocol not supported (93)
Feb 15 11:20:47 lenovo bluetoothd[1857]: Endpoint registered: sender=:1.42 path=/MediaEndpoint/A2DPSink/sbc
Feb 15 11:20:47 lenovo bluetoothd[1857]: Endpoint registered: sender=:1.42 path=/MediaEndpoint/A2DPSource/sbc
Feb 15 11:20:50 lenovo bluetoothd[1857]: L2CAP server failed for Message Notification: setsockopt(L2CAP_OPTIONS): Invalid argument (22)
Feb 15 11:20:50 lenovo bluetoothd[1857]: L2CAP server failed for Message Access: setsockopt(L2CAP_OPTIONS): Invalid argument (22)
Feb 15 11:20:50 lenovo bluetoothd[1857]: L2CAP server failed for Phone Book Access: setsockopt(L2CAP_OPTIONS): Invalid argument (22)
Feb 15 11:20:50 lenovo bluetoothd[1857]: L2CAP server failed for File Transfer: setsockopt(L2CAP_OPTIONS): Invalid argument (22)
Feb 15 11:20:50 lenovo bluetoothd[1857]: L2CAP server failed for Object Push: setsockopt(L2CAP_OPTIONS): Invalid argument (22)
Feb 15 11:21:22 lenovo bluetoothd[1857]: avrcp-controller profile connect failed for 00:08:8A:FF:53:3D: Input/output error
Feb 15 11:21:22 lenovo bluetoothd[1857]: /org/bluez/hci0/dev_00_08_8A_FF_53_3D/sep1/fd0: fd(38) ready

Normal status II

$ systemctl list-unit-files | grep blue
blueman-mechanism.service                      disabled        enabled      
bluetooth.service                              enabled         enabled      
dbus-org.bluez.service                         enabled         enabled      
bluetooth.target                               static          enabled

What I have tried

Restarting service

From Bluetooth doesn't work after resuming from sleep, Ubuntu 18.04 LTS

modprobe -r btusb
sleep 1
service bluetooth restart
sleep 1
modprobe btusb

Result: No change.

Check device status

Still active and running (!?)

$ /etc/init.d/bluetooth status
● bluetooth.service - Bluetooth service
     Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2022-02-17 09:30:24 GMT; 7h ago
       Docs: man:bluetoothd(8)
   Main PID: 1859 (bluetoothd)
     Status: "Running"
      Tasks: 1 (limit: 18495)
     Memory: 2.9M
     CGroup: /system.slice/bluetooth.service
             └─1859 /usr/lib/bluetooth/bluetoothd

Feb 17 14:12:48 lenovo bluetoothd[1859]: Unable to get io data for Headset Voice gateway: getpeername: Transport endpoint is not connected (107)
Feb 17 14:13:33 lenovo bluetoothd[1859]: avrcp-controller profile connect failed for 00:08:8A:FF:53:3D: Input/output error
Feb 17 14:13:33 lenovo bluetoothd[1859]: /org/bluez/hci0/dev_00_08_8A_FF_53_3D/sep1/fd2: fd(37) ready
Feb 17 15:46:05 lenovo bluetoothd[1859]: No reply to Start request
Feb 17 15:46:05 lenovo bluetoothd[1859]: Unable to get io data for Headset Voice gateway: getpeername: Transport endpoint is not connected (107)
Feb 17 15:46:05 lenovo bluetoothd[1859]: avrcp-controller profile connect failed for 00:08:8A:FF:53:3D: Input/output error
Feb 17 15:46:05 lenovo bluetoothd[1859]: /org/bluez/hci0/dev_00_08_8A_FF_53_3D/sep1/fd3: fd(37) ready
Feb 17 16:16:46 lenovo bluetoothd[1859]: Unable to get io data for Headset Voice gateway: getpeername: Transport endpoint is not connected (107)
Feb 17 16:16:46 lenovo bluetoothd[1859]: Endpoint unregistered: sender=:1.41 path=/MediaEndpoint/A2DPSink/sbc
Feb 17 16:16:46 lenovo bluetoothd[1859]: Endpoint unregistered: sender=:1.41 path=/MediaEndpoint/A2DPSource/sbc

Check device status II

$ lsusb; dmesg | egrep -i 'blue|firm'
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 002: ID 04ca:7070 Lite-On Technology Corp. Integrated Camera
Bus 003 Device 004: ID 27c6:55a4 Shenzhen Goodix Technology Co.,Ltd. Goodix FingerPrint Device
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 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[    6.728422] i915 0000:00:02.0: [drm] Finished loading DMC firmware i915/icl_dmc_ver1_09.bin (v1.9)
[  131.924258] iwlwifi 0000:00:14.3: loaded firmware version 63.c04f3485.0 Qu-c0-hr-b0-63.ucode op_mode iwlmvm
[  132.022131] Bluetooth: Core ver 2.22
[  132.022154] Bluetooth: HCI device and connection manager initialized
[  132.022159] Bluetooth: HCI socket layer initialized
[  132.022162] Bluetooth: L2CAP socket layer initialized
[  132.022166] Bluetooth: SCO socket layer initialized
[  132.147943] Bluetooth: hci0: Bootloader revision 0.4 build 0 week 11 2017
[  132.148943] Bluetooth: hci0: Device revision is 2
[  132.148945] Bluetooth: hci0: Secure boot is enabled
[  132.148946] Bluetooth: hci0: OTP lock is enabled
[  132.148947] Bluetooth: hci0: API lock is enabled
[  132.148947] Bluetooth: hci0: Debug lock is disabled
[  132.148947] Bluetooth: hci0: Minimum firmware build 1 week 10 2014
[  132.152089] Bluetooth: hci0: Found device firmware: intel/ibt-19-32-4.sfi
[  133.715425] Bluetooth: hci0: Waiting for firmware download to complete
[  133.715942] Bluetooth: hci0: Firmware loaded in 1527196 usecs
[  133.716026] Bluetooth: hci0: Waiting for device to boot
[  133.731078] Bluetooth: hci0: Device booted in 14720 usecs
[  133.731693] Bluetooth: hci0: Found Intel DDC parameters: intel/ibt-19-32-4.ddc
[  133.734061] Bluetooth: hci0: Applying Intel DDC parameters completed
[  133.736995] Bluetooth: hci0: Firmware revision 0.0 build 121 week 36 2020
[  133.796965] Bluetooth: hci0: MSFT filter_enable is already on
[  135.656768] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[  135.656771] Bluetooth: BNEP filters: protocol multicast
[  135.656778] Bluetooth: BNEP socket layer initialized
[  136.784480] Bluetooth: RFCOMM TTY layer initialized
[  136.784487] Bluetooth: RFCOMM socket layer initialized
[  136.784491] Bluetooth: RFCOMM ver 1.11
[  151.284331] audit: type=1107 audit(1645090240.283:147): pid=1864 uid=103 auid=4294967295 ses=4294967295 subj=unconfined msg='apparmor="DENIED" operation="dbus_method_call"  bus="system" path="/" interface="org.freedesktop.DBus.ObjectManager" member="GetManagedObjects" mask="send" name="org.bluez" pid=3385 label="snap.bitwarden.bitwarden" peer_pid=1859 peer_label="unconfined"
[ 1612.134048] audit: type=1107 audit(1645091700.798:179): pid=1864 uid=103 auid=4294967295 ses=4294967295 subj=unconfined msg='apparmor="DENIED" operation="dbus_method_call"  bus="system" path="/" interface="org.freedesktop.DBus.ObjectManager" member="GetManagedObjects" mask="send" name="org.bluez" pid=15716 label="snap.bitwarden.bitwarden" peer_pid=1859 peer_label="unconfined"

Check device status III

$ systemctl list-unit-files | grep blue
blueman-mechanism.service                      enabled         enabled      
bluetooth.service                              enabled         enabled      
dbus-org.bluez.service                         enabled         enabled      
bluetooth.target                               static          enabled

From https://stackoverflow.com/a/68335639/236081

This may indicate that multiple conflicting services are inhibiting Bluetooth. (Still investigating. Note that blueman-mechanism.service is DISABLED in normal status.)

Start blueman-manager from the command line

$ blueman-manager
blueman-manager version 2.1.2 starting  
blueman-manager 12.42.28 ERROR    Manager:118 on_dbus_name_appeared: Default adapter not found, trying first available.  
blueman-manager 12.42.28 ERROR    Manager:122 on_dbus_name_appeared: No adapter(s) found, exiting

Result: Fails to start. Adapter not found.

Turning it off and on again

  • In power settings, I tried turning "Bluetooth can be turned off" setting off and on again.

  • A hit my keyboard button for "Airplane mode", setting it off and on again.

Result: In each case, Bluetooth Manager indicator pops up then disappears.

in flag
Is your Bluetooth radio on a USB or a PCI device? You may be able to power cycle *just* the Bluetooth transmitter depending on what it is and how it’s connected
lofidevops avatar
us flag
@matigo It's a PCI (builtin) device. Now that you mention it, I have an "airplane mode" button on the keyboard, I will try that next time. Thanks!
Jeremy31 avatar
ke flag
Post results for `lsusb; dmesg | egrep -i 'blue|firm'` after suspending
lofidevops avatar
us flag
@Jeremy31 thanks for the tip, the results include an audit error from my bitwarden snap, but killing bitwarden then trying all the restart options doesn't seem to have made a difference -- is there anything I should be looking for in those results?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.