, 2 min read

Bluetooth Headphones in Arch Linux

Original post is here eklausmeier.goip.de/blog/2016/10-26-bluetooth-headphones-in-arch-linux.


There is a big difference between noise-cancelling headphones, and classical headphones without noise-cancelling ability! Especially when you use them in a noisy environment, like a plane or a large office bureau. Inspired by a positive review of the Bose headphones by Marques Brownlee, I bought them.

Here is the review:

Pairing with my OnePlus One smartphone was completely automatic and works like a charm. No further explanation is required.

Paring with a PC/laptop running Arch Linux needed a little more effort. Some advice in Bluetooth headset helped me alot.

One-time configuation:

systemctl start bluetooth.service
hciconfig hci0 up piscan
pacmd list-sinks | grep index:
bluetoothctl

In bluetoothctl enter

help
show
devices
pair xx:yy:...
trust xx:yy:...
connect xx:yy:...
paired-devices

I had to delete the directory below /var/lib/bluetooth. Apparently something was stored there which shouldn't have been there.

Once the pairing works, as described above, I just use:

systemctl start bluetooth.service
hciconfig hci0 up piscan

for starting bluetooth and making my PC with bluetooth visible. I switch on the headphone, which normally finds the PC in less than a second. Then I have to set the right sink via pacmd:

pacmd set-default-sink `pacmd list-sinks | grep index: | tail -1 | cut -d " " -f6`

Checking that all is well is:

pacmd list-sinks | grep index:

Once paired with your Linux machine, yo have to repeat set-default-sink if you lose the connection to your Linux machine, for example by walking too far away. If you lose Bluetooth connection apparently sound output will go to the regular speakers of your Linux machine. In case you are working in a large office other people will hear your music. Of course, you can mute the regular loudspeakers of your Linux machine using

pacmd set-sink-volume 0 0

assuming sink #0 is regular loudspeaker.

Added 13-Oct-2017: Arch Linux dropped hciconfig+hcictool from package bluez-utils since version 5.44. My latest good package still containing these commands is 5.43-2, for easy reference located here bluez-utils-5.43-2-x86_64.pkg.tar.xz. Download it and use ascii2hex.c to convert from hex to ascii/binary because WordPress.com does not allow XZ-files.