30

When I was using GNOME, my bluetooth devices worked fine. But now I've moved to i3 and use blueman. When I try to connect to any headphone, blueman throws

blueman.bluez.errors.DBusFailedError: Protocol not available.

In logs there are pretty similar errors:

сен 09 21:00:45 keddad-pc bluetoothd[916]: a2dp-sink profile connect failed for FC:A8:9A:90:B

The only fix I could find is to install pulseaudio-module-bluetooth, but it is already installed. What might cause this problem?

I tried adding

load-module module-bluetooth-policy
load-module module-bluetooth-discover

to /etc/pulse/system.pa as in Arch Wiki, but it didn't fix anything

This gist didn't help either.

Zanna
  • 70,465
keddad
  • 793

9 Answers9

82

Run the following commands:

sudo apt-get install pulseaudio-module-bluetooth
sudo killall pulseaudio
pulseaudio --start    
sudo systemctl restart bluetooth
turbo
  • 66
Marko
  • 931
  • In my case, by mistake , I should have uninstalled pulseaudio-module-bluetooth. I installed the same and just restarted the system. Thanks. – Aravind May 23 '20 at 08:54
  • 1
    This fixed my problem on Ubuntu 22.04 after having made sure I'm running pulseaudio and not pipewire using pactl info | grep -i "server name" – Tobias Gierke Dec 31 '22 at 15:11
8

I was able to solve the same problem on Ubuntu 21.04 based on this solution:

Adding the module-bluez5-discover at the end of the pulseaudio /etc/pulse/default.pa config:

load-module module-bluez5-discover

Restart PulseAudio:

killall pulseaudio
Zanna
  • 70,465
mrcll
  • 99
8

Run the following commands for Ubuntu 22.101:

sudo apt install libspa-0.2-bluetooth
systemctl --user restart wireplumber

1On Ubuntu 22.10, my pulseaudio-module-bluetooth does not work anymore, but it has been replaced with libspa-0.2-bluetooth. This seems to be caused by Ubuntu's switch from PulseAudio to PipeWire.

Daniel T
  • 4,594
5

In my case(Ubuntu 18.04/Awesome wm), pulseaudio-module-bluetooth is already installed too.

Run the following commands to fix permissions:

sudo chown -R $USER:$USER $HOME/
sudo apt-get --purge --reinstall install pulseaudio-module-bluetooth alsa-base pulseaudio
mv ~/.config/pulse ~/.config/pulse.old

Then reboot your system.

Nmath
  • 12,333
3

Looks like something wrong was with module loading. I didn't really figure the reason, but I made i3 to load them manually on startup.

Add these lines to ~/.config/i3/config

exec --no-startup-id pactl load-module module-bluetooth-policy
exec --no-startup-id pactl load-module module-bluetooth-discover
Zanna
  • 70,465
keddad
  • 793
2

I have the exact same problem a2dp-sink profile connect failed + blueman.bluez.errors.DBusFailedError: Protocol not available.

I think the problem might be in our ~/.config/pulse/default.pa

#!/usr/bin/pulseaudio -nF
#
# Work around for PA not allowing access to A2DP profiles in the user session
# because GDM already has it open.
# LP: #1703415

load system wide configuration

.include /etc/pulse/default.pa

unload driver modules for Bluetooth hardware

.ifexists module-bluetooth-policy.so unload-module module-bluetooth-policy .endif

.ifexists module-bluetooth-discover.so unload-module module-bluetooth-discover .endif

As I do not reproduce the original bug listed in this workaround ( https://bugs.launchpad.net/ubuntu/+source/gdm3/+bug/1703415 ) I think it can be safely commented :

#!/usr/bin/pulseaudio -nF
#
# Work around for PA not allowing access to A2DP profiles in the user session
# because GDM already has it open.
# LP: #1703415

load system wide configuration

.include /etc/pulse/default.pa

unload driver modules for Bluetooth hardware

#.ifexists module-bluetooth-policy.so

unload-module module-bluetooth-policy

#.endif

#.ifexists module-bluetooth-discover.so

unload-module module-bluetooth-discover

#.endif

then restart pulseaudio with

$ pulseaudio -k

It's also possible that this problematic workaround is not present in a fresh install of the latest Ubuntu release, I did not check. (I'm currently in 20.10, coming from an install in 18.10)

Saroumane
  • 181
2

It depends on the used sound system. For users using pipewire (Ubuntu 22.04) the answer https://askubuntu.com/a/1432859/1646539 worked. When using Ubuntu with pipewire install libspa-0.2-bluetooth and restart wireplumber, as described above.

You can check if you use pipewire:

$ pactl info | grep -i "server name"
Server Name: PulseAudio (on PipeWire 0.3.48)

I had also problems installing the package libspa-0.2-bluetooth:

Preparing to unpack .../libldacbt-abr2_2.0.2.3+git20200429+ed310a0-4_amd64.deb ...
Unpacking libldacbt-abr2:amd64 (2.0.2.3+git20200429+ed310a0-4) ...
dpkg: error processing archive /var/cache/apt/archives/libldacbt-abr2_2.0.2.3+git20200429+ed310a0-4_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/x86_64-linux-gnu/libldacBT_abr.so.2', which is also in package libldac:amd64 2.0.2.3~r26478861
Errors were encountered while processing:
 /var/cache/apt/archives/libldacbt-abr2_2.0.2.3+git20200429+ed310a0-4_amd64.deb

The follwoing commands fixed the issue for me (using pipewire):

sudo apt purge libldac
sudo apt install libspa-0.2-bluetooth
systemctl --user restart wireplumber.service

After installing the package and running systemctl status bluetooth the error src/service.c:btd_service_connect() a2dp-sink profile connect failed for …: Protocol not available is gone:

… bluetoothd[1246]: Player registered: sender=:1.32573 path=/media_player0
… bluetoothd[1246]: Endpoint registered: sender=:1.32573 path=/MediaEndpoint/A2DPSource/ldac
… bluetoothd[1246]: Endpoint registered: sender=:1.32573 path=/MediaEndpoint/A2DPSink/sbc
… bluetoothd[1246]: Endpoint registered: sender=:1.32573 path=/MediaEndpoint/A2DPSource/sbc
… bluetoothd[1246]: Endpoint registered: sender=:1.32573 path=/MediaEndpoint/A2DPSink/sbc_xq
… bluetoothd[1246]: Endpoint registered: sender=:1.32573 path=/MediaEndpoint/A2DPSource/sbc_xq
… bluetoothd[1246]: Endpoint registered: sender=:1.32573 path=/MediaEndpoint/A2DPSource/faststream
… bluetoothd[1246]: Endpoint registered: sender=:1.32573 path=/MediaEndpoint/A2DPSource/faststream_duplex
Hannes
  • 76
0

If you see this kind of error when you are trying to automatically connect your bluetooth audio device at boot time. Then it is probably caused by a lack of synchronisation between the systemd bluetooth service and pulseaudio.

Synchronizing bluetoothd and pulseaudio

The problem

Bluetoothd, the bluetooth daemon that handles bluetooth devices in Linux is normally started under the control of a system initialisation manager such as Systemd. The pulseaudio audio routing process as usually started as a per user process from the autostart mechanisms associated with a graphical desktop manager. The desktop manager itself is usually among the last processes started as part of the initial boot processing. There is no synchronisation between these two launch mechanisms. This means that bluetoothd has usually finished its initialisation well before pulseaudio has started. This is not a problem for non audio bluetooth devices. However audio bluetooth devices that attempt to use pulseaudio via dbus as part of their initialisation will always fail. In practice this means any device that requires 'load-module module-bluez5-discover' in the pulseaudio configuration. This type of failure is characterised by the appearance in the system logs and journals of a message similar to the following.

Sep 15 09:04:25 dragon bluetoothd[1423]: src/service.c:btd_service_connect() a2dp-sink profile connect failed for 65:DE:65:37:94:79: Protocol not available.

The solution

The easiest way to fix this is to restart bluetoothd after pulseaudio has fully started. The are two components to this solution. One is simple shell script that uses systemctl to restart the bluetooth daemon. This script is called from the kick-bluetooth.desktop file. This file needs to placed in the autostart directory of the user requiring use of the device. This is usually ~/.config/autostart.

Caveats

This solution works well on gnome desktops. Other environments may need some tweaks. Feel free to contribute what works for you and I will add it to these notes.

For the files see here. https://github.com/rogerjames99/kick-bluetooth.git

  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. – Community Sep 15 '22 at 14:18
  • If that link has info that would help in this answer it needs to be in the answer not as a link. – David Sep 22 '22 at 08:05
0

[Ubuntu 22.04]

After a mix of installing and uninstalling, between pipewire and pulseaudio, nothing working, I put the system back to a pristine install with no pulseaudio

$ apt list pipe* wirep* *blue* pulse* -i
Listing... Done
bluedevil/jammy-updates,now 4:5.24.7-0ubuntu0.1 amd64 [installed]
bluez-cups/jammy-updates,jammy-security,now 5.64-0ubuntu1.1 amd64 [installed]
bluez-obexd/jammy-updates,jammy-security,now 5.64-0ubuntu1.1 amd64 [installed,automatic]
bluez/jammy-updates,jammy-security,now 5.64-0ubuntu1.1 amd64 [installed]
libbluetooth3/jammy-updates,jammy-security,now 5.64-0ubuntu1.1 amd64 [installed,automatic]
libkf5bluezqt-data/jammy,jammy,now 5.92.0-0ubuntu1 all [installed,automatic]
libkf5bluezqt6/jammy,now 5.92.0-0ubuntu1 amd64 [installed,automatic]
libspa-0.2-bluetooth/jammy-updates,now 0.3.48-1ubuntu3 amd64 [installed]
pipewire-audio-client-libraries/jammy-updates,now 0.3.48-1ubuntu3 amd64 [installed]
pipewire-bin/jammy-updates,now 0.3.48-1ubuntu3 amd64 [installed,automatic]
pipewire-pulse/jammy-updates,now 0.3.48-1ubuntu3 amd64 [installed,automatic]
pipewire/jammy-updates,now 0.3.48-1ubuntu3 amd64 [installed,automatic]
qml-module-org-kde-bluezqt/jammy,now 5.92.0-0ubuntu1 amd64 [installed,automatic]
wireplumber/jammy,now 0.4.8-4 amd64 [installed]

Then, following huvelyb's archlinux post,
I added load-module module-bluez5-discover to /etc/pulse/default.pa.
Here is the whole section, for reference

### Automatically restore the volume of streams and devices
load-module module-device-restore
load-module module-stream-restore
load-module module-card-restore
load-module module-bluez5-discover

Then restart all of the services:

sudo systemctl restart bluetooth
systemctl --user restart pipew* wirepl*

et voilà!

ergohack
  • 103
  • 5