Ubuntu – Bluetooth connection (Bluez) not working after logout (works after restart)

18.10bluetoothlubuntulxqt

I use LXQT in Lubuntu 18.10 and I have a problem with keeping the Bluetooth-speaker connected to the laptop after logging out and in. It works fine after reboot though.

So, I have a solution that always works: rebooting – OR: reinstalling bluez:

sudo apt-get install --reinstall bluez

and that always works!

In any case, when my problem happens, the bluetooth is never blocked.

If I reboot or reinstall bluez there is no need to remove and add again the device, setting it to "Audio sink" is enough.


When this happens, after logging out and in:

  • The speaker is listed by blueman-manager, setting to 'Audio Sink' brings the error Protocol Not available.

enter image description here

In terminal:

~$ blueman-manager
_________
Load (/usr/lib/python3/dist-packages/blueman/main/PluginManager.py:60)
['PulseAudioProfile', 'Services'] 
_________
__load_plugin (/usr/lib/python3/dist-packages/blueman/main/PluginManager.py:133)
loading <class 'blueman.plugins.manager.PulseAudioProfile.PulseAudioProfile'> 
_________
pa_context_event (/usr/lib/python3/dist-packages/blueman/main/PulseAudioUtils.py:341)
1 
_________
__load_plugin (/usr/lib/python3/dist-packages/blueman/main/PluginManager.py:133)
loading <class 'blueman.plugins.manager.Services.Services'> 
blueman-manager version 2.0.5 starting
Stale PID, overwriting
_________
pa_context_event (/usr/lib/python3/dist-packages/blueman/main/PulseAudioUtils.py:341)
2 
_________
on_bluez_name_owner_changed (/usr/bin/blueman-manager:96)
org.bluez owner changed to  :1.238 
_________
get_interface_version (/usr/lib/python3/dist-packages/blueman/bluez/BlueZInterface.py:13)
Detected BlueZ 5 
_________
SetAdapter (/usr/lib/python3/dist-packages/blueman/gui/DeviceList.py:271)

_________
on_adapter_changed (/usr/lib/python3/dist-packages/blueman/gui/manager/ManagerToolbar.py:83)
toolbar adapter /org/bluez/hci0 
_________
__init__ (/usr/lib/python3/dist-packages/blueman/main/Device.py:26)
caching initial properties 
_________
add_device (/usr/lib/python3/dist-packages/blueman/gui/DeviceList.py:317)
adding new device 
_________
do_cache (/usr/lib/python3/dist-packages/blueman/gui/DeviceList.py:496)
Caching new device C0:28:8D:81:64:5A 
_________
row_update_event (/usr/lib/python3/dist-packages/blueman/gui/manager/ManagerDeviceList.py:264)
row update event Fake False 
_________
row_update_event (/usr/lib/python3/dist-packages/blueman/gui/manager/ManagerDeviceList.py:264)
row update event Trusted 0 
_________
row_update_event (/usr/lib/python3/dist-packages/blueman/gui/manager/ManagerDeviceList.py:264)
row update event Paired 1 
_________
Generate (/usr/lib/python3/dist-packages/blueman/gui/manager/ManagerDeviceMenu.py:173)
UE BOOM 2 
_________
pa_context_event (/usr/lib/python3/dist-packages/blueman/main/PulseAudioUtils.py:341)
3 
_________
pa_context_event (/usr/lib/python3/dist-packages/blueman/main/PulseAudioUtils.py:341)
4 
_________
on_pa_ready (/usr/lib/python3/dist-packages/blueman/plugins/manager/PulseAudioProfile.py:29)
connected 
_________
<lambda> (/usr/lib/python3/dist-packages/blueman/main/PulseAudioUtils.py:353)
1 
_________
Generate (/usr/lib/python3/dist-packages/blueman/gui/manager/ManagerDeviceMenu.py:173)
UE BOOM 2 
_________
Generate (/usr/lib/python3/dist-packages/blueman/gui/manager/ManagerDeviceMenu.py:173)
UE BOOM 2 
_________
set_op (/usr/lib/python3/dist-packages/blueman/gui/manager/ManagerDeviceMenu.py:85)
op: regenerating instance <ManagerDeviceMenu.ManagerDeviceMenu object at 0x7f8fd0e05e10 (blueman+gui+manager+ManagerDeviceMenu+ManagerDeviceMenu at 0x1efcb60)> 
_________
set_op (/usr/lib/python3/dist-packages/blueman/gui/manager/ManagerDeviceMenu.py:85)
op: regenerating instance <ManagerDeviceMenu.ManagerDeviceMenu object at 0x7f8fd0e0eee8 (blueman+gui+manager+ManagerDeviceMenu+ManagerDeviceMenu at 0x1efce40)> 
_________
unset_op (/usr/lib/python3/dist-packages/blueman/gui/manager/ManagerDeviceMenu.py:99)
op: regenerating instance <ManagerDeviceMenu.ManagerDeviceMenu object at 0x7f8fd0e05e10 (blueman+gui+manager+ManagerDeviceMenu+ManagerDeviceMenu at 0x1efcb60)> 
_________
Generate (/usr/lib/python3/dist-packages/blueman/gui/manager/ManagerDeviceMenu.py:173)
UE BOOM 2 
_________
unset_op (/usr/lib/python3/dist-packages/blueman/gui/manager/ManagerDeviceMenu.py:99)
op: regenerating instance <ManagerDeviceMenu.ManagerDeviceMenu object at 0x7f8fd0e0eee8 (blueman+gui+manager+ManagerDeviceMenu+ManagerDeviceMenu at 0x1efce40)> 
_________
fail (/usr/lib/python3/dist-packages/blueman/gui/manager/ManagerDeviceMenu.py:124)
fail org.freedesktop.DBus.Python.blueman.bluez.errors.DBusFailedError: blueman.bluez.errors.DBusFailedError: Protocol not available

/usr/lib/python3/dist-packages/blueman/gui/manager/ManagerProgressbar.py:165: Warning: Source ID 697 was not found when attempting to remove it
  GObject.source_remove(self.gsource)

and

~$ pactl load-module module-bluetooth-discover
Failure: Module initialization failed

because it was already loaded.

Removing the device and trying to add it again: it is not found at all!


Which aspect in the normal operation of bluez – one that is available at system startup as well as by reinstalling the package – could be lost by restarting the session? – And how to avoid that loss?


UPDATE/EDIT by the OP:

[I am the OP. At some point I have deleted my account and then I came back with the same id.] I want to add that this is a Lubuntu-LXQt-specific problem. I have seen this problem in many Ubuntu and Ubuntu-based distros before 18.04, but in none since 18.x. Since 18.04 it is fixed excepting in Lubuntu-LXQt.

Details of the bluetooth adapter:

lsusb | grep Bluetooth
Bus 001 Device 013: ID 0489:e00f Foxconn / Hon Hai Foxconn T77H114 BCM2070 [Single-Chip Bluetooth 2.1 + EDR Adapter]

Best Answer

It could be unrelated to your strange issue but there have been bugs in bluez for a long time: [Bug 1499858] Re: bluetoothd[650]: Failed to obtain handles for "Service Changed" characteristic

The latest posting this morning reads:

Hello again,

I compiled bluez-5.46 & installed it on ubuntu 16.04 and this has taken care of all of the "Not enough free handles to register service" errors and also "Failed to obtain handles for "Service Changed" characteristic" errors and bluetooth is working better than it ever has, for me anyway. So for me this is solved, I suppose.

Don't know if this will help anyone?? But I hope so!

Cheers,

Singtoh


Consider installing tlp radio device wizard. It will:

  • Enable or disable integrated wifi, bluetooth or wwan devices upon system startup and shutdown
  • Restore radio device state on system startup (from previous shutdown).
  • Radio device wizard: switch radios upon network connect/disconnect and dock/undock
  • Disable Wake On LAN
  • Integrated WWAN and bluetooth state is restored after suspend/hibernate

Source: Welcome to TLP!

Related Question