Extremely low volume with AirPods (Ubuntu 19.10)

Andrei Dyomin's answer is subtly wrong; it will technically work, but it will disable all other plugins than a2dp, meaning bluetooth keyboards/mice/gamepads/etc will stop working, when the only plugin causing issues seems to be one called avrcp.

Edit

sudo nano /lib/systemd/system/bluetooth.service

and change

ExecStart=/usr/lib/bluetooth/bluetoothd

to

ExecStart=/usr/lib/bluetooth/bluetoothd --noplugin=avrcp

and run

sudo systemctl daemon-reload
sudo systemctl restart bluetooth

Maybe, it is necessary to unpair and re-pair the device.


I know next to nothing about Bluetooth stack, so I cannot explain why, but following these steps helped:

Edit the file at /lib/systemd/system/bluetooth.service:

sudo nano /lib/systemd/system/bluetooth.service

Change this line:

ExecStart=/usr/lib/bluetooth/bluetoothd  

To this:

ExecStart=/usr/lib/bluetooth/bluetoothd --plugin=a2dp

Save (CTRL + O) and Exit (CTRL + X)

Restart the daemon and the Bluetooth service:

sudo systemctl daemon-reload  
sudo systemctl restart bluetooth  

This answer is adapted from this source.

I have tested this answer with AirPods 1st gen on Ubuntu 18.04.


My AirPods became very quiet recently. I tried --noplugin=avrcp and --plugin=a2dp but neither worked.

This is quite a hack, but it's possible to set the volume level on AirPods in Linux if you patch bluez.

sudo apt install ccache
sudo apt install build-essential devscripts lintian diffutils patch patchutils
apt-get source bluez
apt-get build-dep bluez

cd bluez-5.50

Edit profiles/audio/transport.c:

630 static gboolean volume_exists(const GDBusPropertyTable *property, void *data)
631 {
632         struct media_transport *transport = data;
633         struct a2dp_transport *a2dp = transport->data;
634
635         // return a2dp->volume <= 127;
636         return TRUE; // force true so we can change AirPod volume
637 }

Build and install:

dpkg-buildpackage -rfakeroot -uc -b
sudo dpkg -i ../bluez_5.50-1.2~deb10u1_amd64.deb

Reboot.

I found these scripts on the manjaro forums:

list_airpods.sh

#!/bin/bash
dbus-send --print-reply --system --dest=org.bluez / org.freedesktop.DBus.ObjectManager.GetManagedObjects | grep -E '/org/bluez/hci./dev_.._.._.._.._.._../fd[0-9]+' -o

airvol.sh

#!/bin/bash
echo Setting volume to $1
for dev in $(./list_airpods.sh); do dbus-send --print-reply --system --dest=org.bluez "$dev" org.freedesktop.DBus.Properties.Set string:org.bluez.MediaTransport1 string:Volume variant:uint16:$1; done

Now we can adjust the AirPods volume!

$ ./airvol.sh 90
Setting volume to 90
method return time=1621509655.344706 sender=:1.7 -> destination=:1.82 serial=220 reply_serial=2

I have to do this every time I connect my AirPods. I find a volume of 90 or 95 works well. Then in VLC I can have a reasonable level like 65-70 with no distortion.