37

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.

2
  • Adding and enabling the pulseaudio user may also help, check out unix.stackexchange.com/a/721697/221903 Commented Apr 17, 2023 at 8:57
  • This question is emblematic of the piss-poor, disjointed documentation of Linux audio in general - and Bluetooth audio in particular. It's a horrible situation! Commented May 7, 2025 at 4:41

10 Answers 10

91

Run the following commands:

sudo apt-get install pulseaudio-module-bluetooth
sudo killall pulseaudio
pulseaudio --start    
sudo systemctl restart bluetooth
2
  • In my case, by mistake , I should have uninstalled pulseaudio-module-bluetooth. I installed the same and just restarted the system. Thanks. Commented May 23, 2020 at 8: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" Commented Dec 31, 2022 at 15:11
19

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.

7
  • 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 Commented Sep 30, 2022 at 16:49
  • I reworded my answer to be styled more like the top answer. Does this answer the question now? Commented Oct 1, 2022 at 2:04
  • I confirm that it works on ubuntu 23. Thanks for your contribution. Commented May 9, 2024 at 14:07
  • 1
    thanks man. It helped me in 2024 Commented Aug 3, 2024 at 9:43
  • This also fixes the issue on Debian 12. Commented Oct 11, 2024 at 10:21
12

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
7
  • 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 ! Commented Aug 14, 2021 at 19:48
  • 2
    This works with Ubuntu 21.04 and WH-1000XM4 Commented Aug 24, 2021 at 20:05
  • Works on Kubuntu 20.04 as well Commented Oct 23, 2021 at 5:15
  • This didn't work for me in 21.10. Commented Mar 1, 2022 at 4:31
  • I don't know how to thank you worked for my Ubuntu 20.4. Commented Jun 25, 2022 at 16:10
6

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.

1
  • I tried many solution, but this worked, alsa-base was missing, can someone please explain this that how it worked? I am using ubuntu 22.04.04 LTS version kernal 6.5.0-28-generic #29~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Apr 4 14:39:20 UTC 2 x86_64 x86_64 x86_64 GNU/Linux Commented Apr 28, 2024 at 15:36
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
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

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
1

[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à!

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. Commented Sep 15, 2022 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. Commented Sep 22, 2022 at 8:05
0

This isn't exactly Ubuntu-specific but for those using a system-wide pipewire with a dedicated user for pipewire, disabling monitor.bluez.seat-monitoring might be helpful. At the very least it did for me. Example:

wireplumber.profiles = {
  main = {
    hardware.audio = required
    hardware.bluetooth = required
    monitor.bluez.seat-monitoring = disabled
  }
}

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.