The problem
When I try to connect to my bluetooth headset with bluetoothctl, sometimes it fails with:
Failed to connect: org.bluez.Error.Failed br-connection-profile-unavailable
Rebooting the bluetooth service does not help. Rebooting the whole computer seems to help: it seems like every second boot is fine. As if there was a race at boot time and I need to be "lucky" for the right module to be loaded correctly.
I have seen many suggestions online to set ControllerMode = bredr in /etc/bluetooth.main.conf, but it doesn't help.
I see something suspicious in dmesg, but I don't know what to do about it (and it is there even when bluetooth works, so it's probably unrelated):
Bluetooth: hci0: HCI LE Coded PHY feature bit is set, but its usage is not supported.
More details
I am running on Alpine Linux with Wayland and Pipewire. The sound works with the laptop speaker, it really seems related to bluetooth. Also when it works, I don't get the error above ("br-connection-profile-unavailable") and instead bluetoothctl says that it connected successfully.
I installed bluez following the instructions here:
# apk add bluez
# apk add bluez-deprecated
# modprobe btusb
# adduser $USER lp
# rc-service bluetooth start
# rc-update add bluetooth default
The btusb module is loaded:
% lsmod | grep btusb
btusb 81920 0
btrtl 28672 1 btusb
btbcm 24576 1 btusb
btmtk 12288 1 btusb
btintel 57344 1 btusb
bluetooth 1081344 25 btrtl,btmtk,btintel,btbcm,bnep,btusb
usbcore 413696 6 xhci_hcd,usbhid,usb_storage,uvcvideo,btusb,xhci_pci