So, in the name productivity and as a reward for cleaning my office room, I decided to reward myself with high-quality headphones. My office room is next to a busy cycling street, and during rush hour it can be challenging to focus. Furthermore, my girlfriend is tutororing math at home causing the doorbell to ring many times during the day.

My previous headphones where all in the €50 price range and did not have noise cancelation, a feature that should weaken external sounds. After some research and looking at various price categories I decided to buy one of the most expensive ones. The €327 Sony WH-1000XM2 which, reviews said, had the best noise cancellation, excellent sound quality and wireless audio with Bluetooth.

With the Sony Headphones app, the headphones worked out of the box on my android phone. To connect them to the desktop I bought a popular Bluetooth adapter. The adapter worked fine on Windows, but it gave all sort of issues on my Ubuntu 16.04 installation (I run a dual boot). This article should help in understanding the concept and tools necessary to get your Bluetooth headphones to work on Linux.

Drivers and firmware

The first step is to check if there are issues with the Bluetooth adapter drivers. We can do this by using dmesg which gives output from the low level hardware drivers. When you suspect the hardware is broken, you can check the output of lsusb to see if the USB Bluetooth adapter is detected.

1
2
3
dmesg | grep -i bluetooth # Shows all Bluetooth driver info
dmesg | grep -i bluetooth | grep -i firmware # Shows Bluetooth firmware issues
lsusb # Displays hardware connected to the USB ports

In my case, dmesg gave a firmware error trying to load a file that did not exist. To fix this, I had to manually copy the related firmware file to /lib/firmware/brcm which I got from the winterheart/broadcom-bt-firmware GIT repository.

Now, you should be able to discover Bluetooth devices, pair and connect to them. The best way to see if everything works, is to use the bluetoothctl tool.

1
2
3
4
5
6
7
8
9
10
11
12
13
bluetoothctl # Start the tool it should show something like the output below:
[NEW] Controller DC:A9:71:10:24:89 niels-300V3A-300V4A-300V5A [default]
Agent registered

show # Information about the adapter
help # Info about all Bluetooth commands
scan on # Scans for Bluetooth devices
devices # Shows the Bluetooth devices
Device EC:88:92:6F:30:96 Headphones

pair EC:88:92:6F:30:96 # Start the pairing procedure
Pairing successful
[CHG] Device EC:88:92:6F:30:96 Trusted: yes

Sound and Audio profiles

So, with the hardware driver ready there is a high probability that you encounter issues with your sound system. When you pair and connect the Bluetooth headset, and you can not select it in the sound settings as an input or output device, then the first step is to install Blueman.

1
2
sudo apt-get update
sudo apt-get install blueman

This tool allows you to modify the audio profiles of the Bluetooth devices with an interface. You can play around with re-pairing your devices and with changing the audio profiles to see if you can get it working in the sound settings.

In my case, the system did not recognize the headphones as an audio device, and I could not change the audio profile with Blueman. To fix this, we have to enable the bluetooth-discover module in Pulseaudio, the sound system for most Linux distributions. First, we can check if the module is loaded in Pulseaudio with the pactl.

1
pactl list | grep -i bluetooth # Shows if Bluetooth modules are loaded

If the output is empty, the module is not active. Let’s make sure the package is available with:

1
2
3
sudo apt-get install pulseaudio-module-bluetooth  # Installs the package
sudo pactl load-module module-bluetooth-discover # Loads the module manually
pactl list | grep -i bluetooth # Shows if Bluetooth modules are loaded

Now, the modules are active. However, the chances are that you have to load the module manually everytime you want to use your Bluetooth devices. You can test this by rebooting your machine. I believe the issue is that Pulseaudio gets started before Bluetooth. Sometimes, restarting Pulseaudio by hand can fix the issue.

1
2
pulseaudio --k
pulseaudio --start

What worked for me without having to restart Pulseaudio was changing some configuration in /etc/pulse/default.pa:

1
sudo nano /etc/pulse/default.pa # Open the configuration in your favorite editor

Find the following section:

1
2
3
4
5
6
7
8
### Automatically load driver modules for Bluetooth hardware
.ifexists module-bluetooth-policy.so
load-module module-bluetooth-policy
.endif

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

And comment out the ifexist statements:

1
2
3
4
5
6
7
8
### Automatically load driver modules for Bluetooth hardware
#.ifexists module-bluetooth-policy.so
load-module module-bluetooth-policy
#.endif

#.ifexists module-bluetooth-discover.so
load-module module-bluetooth-discover
#.endif

Wrap things up

Now, with all the hardware and software ready it is best to remove all previously paired devices and pair them with Blueman. Now, the system should detect that it is a headset and you can set the correct audio profiles which should be visible in the sound system.

All in all, the Bluetooth adapter manufacturers have some work to do to make there drivers better accessible on Linux. However, the user experience from the Linux side can get an upgrade as well. Even as a technical person I had many issues to understand the output given to me.

Was this article helpful, please consider to

Buy me a coffeeBuy me a coffee

25 Comments

them_sony_headphones · January 5, 2019 at 7:02 pm

Thanks a lot, the stackoverflow solution didn’t work for me, but this did.

Thanks a lot.

Jim · February 8, 2019 at 8:37 pm

Thanks for the write-up … in my case (Ubuntu 18.04 and Sony WH-1000MX3 headphones) the only thing I needed was the Broadcom driver from the winterheart repository … and a reboot … then the normal GUI tools were successful.

Matti · March 3, 2019 at 8:32 pm

It helps me too. Thank you a lot.

Francesco · April 13, 2019 at 10:05 am

Thank you very much. It’ the only tutorial on the internet that ir really working.

snevas · May 24, 2019 at 12:09 pm

If you want to get the LDAC codec working on Ubuntu, add the PPA here:
https://github.com/EHfive/pulseaudio-modules-bt/wiki/Packages

Seriously, if you are doing to use a $350 headset with SBC, you should consider buying a cheaper headset and donating the difference to a good cause 🙂

Rizki Lazuardi · September 2, 2019 at 11:51 am

Thank youuuuuuu very much!! works like a charm

Patrick Ponte · September 6, 2019 at 12:59 pm

Thank you man …. Working like a charm with my skullcandy !

Praphul · October 5, 2019 at 6:31 am

Thank you. I had issues in getting bluetooth to work in my Manjaro KDE 18.1.0. This solution helped me fixing the issue.

Eugene Magnier · December 15, 2019 at 7:40 pm

thanks for the help with my bluetooth headphones. I didn’t notice the error messages I was getting in dmesg, but your pointer got me the patch (brcm/BCM20702A1-0a5c-21e8.hcd) that fixed my problem right way.

groetjes uit hawaii
gene

chebbi · March 9, 2020 at 10:56 am

Work nice with mpow flame also on ubuntu 18 ans Asus Rog, thank you
I have to restart after copying the correct driver file

Anonymous · May 8, 2020 at 12:06 pm

working thank you

Anonymous · May 12, 2020 at 9:02 am

This actually worked, got tired of reading StackOverflow and found a great solution here. Cheers!

Daniel Loureiro · May 13, 2020 at 10:49 am

Thanks for sharing this!

But I was not able to compare my 1st gen airpods.

Daniel Jacoby · June 18, 2020 at 12:06 am

Thank you !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Anonymous · June 25, 2020 at 4:53 am

The God

Henry · July 30, 2020 at 8:43 am

worked for me, thanks!

Ignacio · August 16, 2020 at 8:31 pm

Thank you a lot!!! Now is working!

2REDGE2 · January 9, 2021 at 5:53 pm

thank you, works fine !

Prash · February 23, 2021 at 11:31 pm

worked like a charm on my Debian buster with EPOS Senheiser Adapt 360. only thing was I didnt have to play with pulse config at the end to make it work without restart. removing paired device and pairing again worked.
Thanks alot.

Fajri Abdillah · March 20, 2021 at 3:48 pm

Thanks a lot. Working perfectly with Pop-os 18.04 and Sony WH-CH510.

Leonardo · April 19, 2021 at 11:31 am

My problem persist:
https://askubuntu.com/questions/1332332/connect-jbl-tune-500bt-on-ubuntu-20-04

Asanga Dewaguru · July 21, 2021 at 7:14 am

Thank you so much. This was the only solution that’s solved my issue. At least I can use my bluetooth headphones for listing. But I still cannot use it’s mic. Headsets mic is not getting listed under the sound settings inputs. (ubuntu 20.04)

Alexander · August 29, 2021 at 11:25 am

Thank you! It worked!

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *