How to fix bluetooth speakers on ubuntu

Here is a list of common problems while setting up the Bluetooth speakers on Ubuntu.

Most of the times the following steps to fix bluetooth on Ubuntu:

sudo vim  /etc/bluetooth/main.conf

Change #AutoEnable=false to AutoEnable=true (at the bottom of the file, by default)

sudo service /etc/init.d/bluetooth restart

Quick command Checklist

We recommend to always check the Bluetooth service status with:

/etc/init.d/bluetooth status
lsmod | grep btusb # make sure btusb module is loaded
rfkill list # Make sure that blocked says no, you can try to use rfkill unblock
pactl list short | grep module-bluetooth

if the last command throws the error:

shm_open() failed: No such file or directory
Connection failure: Protocol error

Check the next solution 1!

Solution 1: bluetooth speaker: org.bluez.Error.Failed

Make sure that you have the pulseaudio-module-bluetooth installed on your system:

sudo apt-get install pulseaudio-module-bluetooth
pactl load-module module-bluetooth-discover
pulseaudio -k
pulseaudio --start

You could also try to delete pulse configuration in the .config directory on your home.

Solution: Failed to connect: org.bluez.Error.Failed

You can try to install bluez:

sudo apt-get install bluez

Alternative using bluez ppa

sudo add-apt-repository ppa:blueman/ppa
sudo apt update
sudo apt upgrade

Once blueman is installed, Open it, your speaker will be listed under Bluetooth Devices. Right click on the device and select “setup”. under setup, go to connect and select “Audio Sink”, then click on next, at top right corner. That’s it now you can find your Bluetooth speaker listed in PluseAudio.

Solution: Device is not trusted

Sometimes you need to tell Ubuntu to trust the Bluetooth device. You will need to use the bluetoothctl command:

sudo bluetoothctl
[bluetooth]# power on
[bluetooth]# agent on
[bluetooth]# default-agent
[bluetooth]# scan on
# This will show you a list of devices
[bluetooth]# scan off
[bluetooth]# trust XX:XX:XX:XX:XX:XX
[bluetooth]# pair XX:XX:XX:XX:XX:XX

Solution

Error

pulseaudio[1148]: [pulseaudio] module-bluez5-device.c: Profile a2dp_sink has no transport
pulseaudio[1148]: [pulseaudio] module-bluez5-device.c: Refused to switch profile to a2dp_sink: Not connected

fix:

nano .bashrc

Then add the following line at the end:

alias soundon = 'pacmd set-card-profile device_name a2dp_sink'

Where device name is the output of “pacmd list-cards” command

Solution 3: When you turn on bluetooth nothing happens

It could be that your Ubuntu install could be missing some package, try to install the following:

sudo apt-get install unity-control-center

Solution 4: You still have bluetooth issues

If you already tried solution 1 and 2, you can try the following:

rfkill block bluetooth
rfkill unblock bluetooth

Solution 5: Remove TLP tools for power management

You can also try to remove TLP tools. If you remove TLP you will be missing some power management features, but it could fix your problems with bluetooth and Ubuntu:

sudo apt remove tlp

If you don’t want to remove TLP you can try the latest version using the linrunner/tlp PPA:

sudo add-apt-repository ppa:linrunner/tlp
sudo apt update
sudo apt install tlp

You will need to reboot

Solution: make PluseAudio Bluetooth module to load after X11

Open /etc/pulse/default.pa

sudo vim /etc/pulse/default.pa

Comment the following linea by appending #:

# .ifexists module-bluetooth-discover.so
# load-module module-bluetooth-discover
# .endif
``
Then open /usr/bin/start-pulseaudio-x11

sudo vim /usr/bin/start-pulseaudio-x11


Add the following line at the end:

/usr/bin/pactl load-module module-bluetooth-discover ```