Sometimes a dad gets lucky. Recently, our daughter bought a Bluetooth headset so she could enjoy her music in private, like so many others of her generation do. After some time, she acquired another one with noise cancelling for better performance while commuting. This is how I came in the possession of a hand-me-down headset. I could finally retire my trusted, cabled headphones! Since my workstation was built for serious scientific number crunching, not for frivolities such as wireless headsets, I needed to purchase a Bluetooth dongle.

When the dongle arrived, I plugged it in a USB slot and rebooted. Behold, Bluetooth turned up in Gnome, but switching it on apparently had no effect at all. Now, in the almost 25 years that I have been using Linux, I have seen it becoming more and more plug-and-play, but sometimes you still have to figure out how to get a piece of hardware functioning in an appropriate manner. I happily accepted the challenge, of course.

First I checked whether the dongle was recognized and this wireless device was enabled. I sat at the terminal and typed:

$lsusb
...
Bus 003 Device 006: ID 2357:0604 TP-Link TP-Link Bluetooth USB Adapter
...
$ sudo apt install rfkill 
$ rfkill list all
0: hci0: Bluetooth
        Soft blocked: no
        Hard blocked: no

Above means that the system sees the TP-Link dongle, and it is not blocked. I was quick to realize that perhaps my Debian installation did not come with the proper firmware for the dongle. After finding the dongle's chipset - some RealTek - the solution was:

# apt install firmware-realtek

Since the Debian Bluetooth stack is Bluez, I installed that as well:

# apt install bluez*

After reboot, the Bluetooth slider actually starts the dongle. Progress! Eagerly I paired the headset. To reconnect automatically, I found I had to edit a system file like so:

$ vi /etc/pulse/default.pa
(select insert mode at end of file, after
.nofail
.include /etc/pulse/default.pa.d)

load-module module-switch-on-connect
load-module module-bluez5-device
load-module module-bluez5-discover

However, since the standard use of a wireless headset is conferencing, what I got was a mono channel optimised for speech. Music reproduction was just unacceptable. Games gave no joy. I found out that the headset needs the A2DP sink, and that several services compete for this precious resource. A first contender was swiftly removed:

# apt purge pulseaudio-module-bluetooth

Alas, no HiFi yet. Apparently, modern Debian prefers pipewire over pulse-audio. Hence I recklessly substituted one for another.

# apt install pipewire-audio pipewire-pulse pipewire-alsa libspa-0.2-bluetooth

Still, no HiFi. One more system file needed editing, I learned from the Arch Linux team:

vi /var/lib/gdm3/.config/pulse/default.pa
(select insert mode)
#!/usr/bin/pulseaudio -nF
#

# 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

In the end however, I was not granted stereophonic delight until I tracked down and removed the last competitor:

# apt purge bluez-alsa-utils

… and there it finally was, musical bliss!

Perhaps this procedure helps you, too. Anyway, should I one day need to redo this, I know where I kept my notes.

Published in Tech Tips

More on Bluetooth, Debian



© 2002-2025 J.M. van der Veer (jmvdveer@xs4all.nl)