22

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.

0

8 Answers 8

53

Run the following commands:

sudo apt-get install pulseaudio-module-bluetooth
sudo killall pulseaudio
pulseaudio --start    
sudo systemctl restart bluetooth
1
  • 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, 2020 at 8:54
6

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
5
  • 1
    I can't thank you yet with upvoting @mrcll but your solution works perfectly with me in my Ubuntu 21.04 and my JBL Charge 5.1 !
    – Quentin
    Aug 14, 2021 at 19:48
  • 2
    This works with Ubuntu 21.04 and WH-1000XM4 Aug 24, 2021 at 20:05
  • Works on Kubuntu 20.04 as well Oct 23, 2021 at 5:15
  • This didn't work for me in 21.10.
    – Paul A.
    Mar 1 at 4:31
  • I don't know how to thank you worked for my Ubuntu 20.4.
    – Mohsen
    Jun 25 at 16:10
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.

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)

2

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
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

2
  • 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 Bot
    Sep 15 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 at 8:05
0

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.

2
  • This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. To get notified when this question gets new answers, you can follow this question. Once you have enough reputation, you can also add a bounty to draw more attention to this question. - From Review
    – David
    Sep 30 at 16:49
  • I reworded my answer to be styled more like the top answer. Does this answer the question now?
    – Daniel T
    Oct 1 at 2:04
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.