Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.59] A2DP sink profile is unavailable on newly added/paired devices #157

Closed
knovoselic opened this issue Jun 17, 2021 · 41 comments
Closed

Comments

@knovoselic
Copy link

Seems like we've discovered a new bug related to ServiceRecords/Endpoints discovery on 5.59. After pairing my headphones for the first time on bluez 5.59, I couldn't get A2DP profile working (it would be marked as unavailable).

After some experimentation I've found out that downgrading to 5.58 works, but only if I remove /var/lib/bluetooth folder before pairing the headphones again.
After a little bit of digging, I've narrowed the issue down to the cache file for the headphones. The cache file created by 5.59 seems to have some of the services/endpoints not listed properly. Here's the cache file created by 5.58, where A2DP works fine:

───────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: bluetooth_working/00:1A:7D:DA:71:13/cache/00:16:94:20:DF:B3
───────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ [General]
   2   │ Name=PXC 550
   3   │ 
   4   │ [ServiceRecords]
   5   │ 0x00010001=35300900000A0001000109000135031918010900043513350619010009001F35091900070900060900060900053503191002
   6   │ 0x00010002=35300900000A00010002090001350319180F0900043513350619010009001F350919000709000709000A0900053503191002
   7   │ 0x00010003=353E0900000A0001000309000135111C6333135823C111E5B696FEFF819CDC9F0900043513350619010009001F350919000709000B09FFFF0900053503191002
   8   │ 0x00010004=35590900000A00010004090001350619111E191203090004350C35031901003505190003080A090006350909656E09006A0901000900093508350619111E090106090100250F48616E64732D4672656
       │ 520756E697409031109003B
   9   │ 0x00010005=354A0900000A0001000509000135111C1DDCE62AECB1445581530743C87AEC9F090004350C350319010035051900030801090006350909656E09006A09010009010025084E617574696C7573
  10   │ 0x00010007=35380900000A00010007090001350319110B0900043510350619010009001935061900190901030900093508350619110D090103090311090001
  11   │ 0x00010008=353B0900000A00010008090001350619110E19110F0900043510350619010009001735061900170901040900093508350619110E090106090311090001
  12   │ 0x00010009=35380900000A00010009090001350319110C0900043510350619010009001735061900170901040900093508350619110E090106090311090002
  13   │ 0x000100A4=35530900000A000100A40900013509191108191131191203090004350C35031901003505190003080D090006350909656E09006A0901000900093508350619110809010209010025074865616473657
       │ 40903022801
  14   │ 0x00010000=35410900000A000100000900013503191200090006350909656E09006A0901000902000901030902010900820902020900460902030901060902042801090205090001
  15   │ 0x000100A6=35530900000A000100A60900013509191108191131191203090004350C35031901003505190003080D090006350909656E09006A0901000900093508350619110809010209010025074865616473657
       │ 40903022801
  16   │ 0x000100A7=35530900000A000100A70900013509191108191131191203090004350C35031901003505190003080B090006350909656E09006A0901000900093508350619110809010209010025074865616473657
       │ 40903022801
  17   │ 
  18   │ [Endpoints]
  19   │ 03=01:ff:01:4f0000000100ff
  20   │ 01=01:00:01:ffff0235
  21   │ LastUsed=02:01
───────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

and here's the same file created on 5.59, where A2DP is reported as unavailable:

───────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: bluetooth_broken/00:1A:7D:DA:71:13/cache/00:16:94:20:DF:B3
───────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ [General]
   2   │ Name=PXC 550
   3   │ 
   4   │ [ServiceRecords]
   5   │ 0x00010001=35300900000A0001000109000135031918010900043513350619010009001F35091900070900060900060900053503191002
   6   │ 0x00010002=35300900000A00010002090001350319180F0900043513350619010009001F350919000709000709000A0900053503191002
   7   │ 0x00010003=353E0900000A0001000309000135111C6333135823C111E5B696FEFF819CDC9F0900043513350619010009001F350919000709000B09FFFF0900053503191002
   8   │ 0x00010005=354A0900000A0001000509000135111C1DDCE62AECB1445581530743C87AEC9F090004350C350319010035051900030801090006350909656E09006A09010009010025084E617574696C7573
   9   │ 0x00010007=35380900000A00010007090001350319110B0900043510350619010009001935061900190901030900093508350619110D090103090311090001
  10   │ 0x00010008=353B0900000A00010008090001350619110E19110F0900043510350619010009001735061900170901040900093508350619110E090106090311090001
  11   │ 0x00010009=35380900000A00010009090001350319110C0900043510350619010009001735061900170901040900093508350619110E090106090311090002
  12   │ 0x000100A9=35590900000A000100A9090001350619111E191203090004350C35031901003505190003080C090006350909656E09006A0901000900093508350619111E090106090100250F48616E64732D4672656
       │ 520756E697409031109003B
  13   │ 0x000100AE=35530900000A000100AE0900013509191108191131191203090004350C35031901003505190003080B090006350909656E09006A0901000900093508350619110809010209010025074865616473657
       │ 40903022801
  14   │ 0x00010000=35410900000A000100000900013503191200090006350909656E09006A0901000902000901030902010900820902020900460902030901060902042801090205090001
  15   │ 
  16   │ [Endpoints]
  17   │ 03=01:00:00:ffff0235
  18   │ 01=01:00:00:ffff0235
───────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

There are differences in both ServiceRecords and Endpoints sections.

Please not that this bug is visible only on 5.59 if you're pairing the device for the first time, or if you manually remove /var/lib/bluetooth folder. If the folder contains the cache file for your device created by one of the older bluez (5.58 or older), A2DP profile will work fine, even if you remove and re-pair the device. It only doesn't work if the cache file doesn't exist yet (if 5.59 version creates the file).

You can read more info about how we've discovered the bug here: https://bbs.archlinux.org/viewtopic.php?pid=1978509

@Vudentz
Copy link
Contributor

Vudentz commented Jun 18, 2021

@abhijeetviswa
Copy link

I have the same issue as OP.
@Vudentz I installed bluez-git on my Arch Linux machine and this patch fixed the issue.

@Vudentz
Copy link
Contributor

Vudentz commented Jun 18, 2021

@abhijeetviswa thanks for confirming it, we might have to release 5.60 sooner.

@knovoselic
Copy link
Author

@Vudentz thanks for the quick fix, the patch works. Tested with it and without it (just a commit before) to be sure,

@marcelofern
Copy link

I have the same issue as OP. Just posting it here to register that this might not be something rare.

@mtekman
Copy link

mtekman commented Jun 20, 2021

Attempt1: Bluez-Git

I had the exact same problem, and the fix by installing bluez-git in Arch Linux temporarily worked:

 pikaur -S bluez-git

Upon next reboot, I had the exact same problems connecting as before. I could pair/trust, but not connect.

Attempt 2: Downgrade to 5.58

  sudo pacman -R bluez-git  
  sudo pacman -U https://archive.archlinux.org/packages/b/bluez-utils/bluez-utils-5.58-1-x86_64.pkg.tar.zst  
  sudo pacman -U https://archive.archlinux.org/packages/b/bluez-libs/bluez-libs-5.58-1-x86_64.pkg.tar.zst  
  sudo pacman -U https://archive.archlinux.org/packages/b/bluez/bluez-5.58-1-x86_64.pkg.tar.zst

But it would still only pair/trust and not connect

Attempt 3: Replace pulseaudio with pipewire (fixed!)

Pipewire replaces both pulseaudio and pulseaudio-bluetooth:

sudo pacman -S pipewire pipewire-pulse
systemctl --user start pipewire-pulse      ## "enable" too if this works
sudo systemctl stop bluetooth
rm -rf /var/lib/bluetooth                  ## clear any profiles
sudo systemctl start bluetooth
bluetoothctl                               ##  power on, scan on, pair, and finally connect

In my case I believe the problem was simply pulseaudio-bluetooth

(Edit: I fixed some formatting of this post for better readability.)

@tim-hilt
Copy link

I hoped this would solve the issues I'm having with my AirPods Pro, however it got even worse. Here's how my connection-procedure looked like with bluez from arch/extra repo:

  1. Set ControllerMode = bredr in /etc/bluetooth/main.conf
  2. systemctl restart bluetooth
  3. Try to connect with the AirPods (which would always fail, but after that, the device shows up in the settings
  4. Comment out ControllerMode = bredr
  5. systemctl restart bluetooth
  6. Connect successfully to the AirPods (even works automatically whenever I open the case).

After that the connection would be established automatically, however there's only HSP/HFP would be available. As soon as I switch the profile to A2DP (within KDEs bluetooth-settings), the output would get deactivated.

Now, that I have installed bluez-git, I can still connect to the AirPods Pro with the same procedure as above, however, the headphones aren't registered as audio-sink anymore.

Is this to be expected with Apple hardware or am I hitting another bug here?

@joakim-tjernlund
Copy link
Contributor

@tim-hilt , you may need to rm /var/lib/bluetooth folder and repair the your AirPods, according to above.

@tim-hilt
Copy link

tim-hilt commented Jun 21, 2021

@joakim-tjernlund thanks for the reply, but unfortunately this doesn't change the behavior for me.

@joakim-tjernlund
Copy link
Contributor

Just another bug I would guess, perhaps not bluez but pipewire/pulsaudio or kernel

@tim-hilt
Copy link

Thanks for the hint! Will investigate this further.

@artemkovalyov
Copy link

I'm also affected by this one. Downgrading the bluez to 5.58 now.

@artemkovalyov
Copy link

Downgrading bluez to 5.58 and removing /var/lib/bluetooth worked. Thanks for the workaround but would be really nice to fix this bug.

@joakim-tjernlund
Copy link
Contributor

@kmoad
Copy link

kmoad commented Jun 22, 2021

Encountered this on Fedora 34 with bluez 5.59 and Jabra 75T earbuds. Steps below to fix it.

Downgrade bluez, in Fedora 34, this will install bluez 5.56

dnf downgrade bluez

Next, remove the bluetooth cache. Be aware that it will also remove all your paired bluetooth connections.

rm -rf /var/lib/bluetooth

Reboot

Re-pair with the device

Some folks above have been able to update bluez after pairing with the older version, and have kept A2DP functionality. I found that if I updated to the latest bluez, I would lose A2DP after a few reboots or restarts of bluetooth. But your experience may be different.

If you want to lock your version of bluez and wait for a fix, you can do so with

dnf install dnf-plugin-versionlock
dnf versionlock bluez

@Mythbusters123
Copy link

Mythbusters123 commented Jun 23, 2021

Exact same problem, and fix from bluez-git worked

Edit: Temporarily worked... I confusingly cannot connect again, despite pairing/trusting fine.
Edit2: Same result (can pair, can't connect) with 5.58 downgrade:

sudo pacman -R bluez-git  
sudo pacman -U https://archive.archlinux.org/packages/b/bluez-utils/bluez-utils-5.58-1-x86_64.pkg.tar.zst  
sudo pacman -U https://archive.archlinux.org/packages/b/bluez-libs/bluez-libs-5.58-1-x86_64.pkg.tar.zst  
sudo pacman -U https://archive.archlinux.org/packages/b/bluez/bluez-5.58-1-x86_64.pkg.tar.zst

Edit3: Fixed, with

  1. Installed pipewire and pipewire-pulse (this replaces pulseaudio and pulseaudio-bluetooth),
  2. systemctl --user start pipewire-pulse
  3. sudo systemctl stop bluetooth
  4. rm -rf /var/lib/bluetooth (for the nth time)
  5. sudo systemctl start bluetooth
  6. bluetoothctl (power on, scan on, pair, connect)

In my case I believe the problem was simply pulseaudio-bluetooth

I am also using arch linux, but I did not have to change from pulseaudio to pipewire. you only needed to
1.
sudo pacman -R bluez-git
sudo pacman -U https://archive.archlinux.org/packages/b/bluez-utils/bluez-utils-5.58-1-x86_64.pkg.tar.zst
sudo pacman -U https://archive.archlinux.org/packages/b/bluez-libs/bluez-libs-5.58-1-x86_64.pkg.tar.zst
sudo pacman -U https://archive.archlinux.org/packages/b/bluez/bluez-5.58-1-x86_64.pkg.tar.zst

  1. sudo systemctl stop bluetooth
  2. rm -rf /var/lib/bluetooth
  3. sudo systemctl start bluetooth
  4. bluetoothctl
    These worked for 1st gen AirPods, too.

@marcelofern
Copy link

Sorry to be a pain but is there an estimated date for release 5.6?

@nilathedragon
Copy link

I hit the same issue with AirPods, downgrading to 5.58 and removing the bluetooth folder fixed it. I hope this will be fixed in the next update?

@tim-hilt
Copy link

To give an update from my side: The issue I saw before was fixed by swapping out pulseaudio in favor of pipewire-pulse. @Infinytum maybe this will also help in your case.

I also had problems with the firmware of my bluetooth-card (Intel AX200). I could listen to music, but experienced a very small sound-droput every approx. 6 seconds. I actually timed that and the 6 second delta was surprisingly uniform. Apparently the issues got fixed in linux-firmware 20210518.

In my case, I just installed linux-firmware-git via the AUR. Powered the laptop off (Important! Don't just reboot - power off, since the bluetooth card resets itself by being without voltage for a bit of time).

Now I don't have any disconnects, deactivations or dropout, but I'm experiencing low volume levels on the AirPods and none of the suggested fixes from the Arch Wiki (running bluetoothd with --nolplugin=avrcp, disabling spatial audio, turning AirPods to Mono-Audio) worked in my case. So if anyone has another idea about that: Thanks in advance!

@joakim-tjernlund actually pointed me in the right directions to solve the audio-artifacts over at pipewires GitLab. I had them on all of my bluetooth-headphones, although with different characteristics. Thanks again Joakim!

@nilathedragon
Copy link

@tim-hilt I used a smartphone to increase my AirPods audio level, then reconnect them to the PC and they somehow were louder. Maybe that works? It seems that the AirPods have their own "volume" that is synced on iOS but not Linux?

If I try with AirPods Max, I can adjust the volume on the headphones + the system volume separately. I had to turn them to maximum volume to be able to use the Linux controls in normal levels.

@tim-hilt
Copy link

@Infinytum oh wow, that's some interesting insight! However, I couldn't reproduce this behavior unfortunately. I set the volume to different extremes on the iPhone, but didn't notice any change in volume level on the laptop. This holds true for my ThinkPad T14S, as well as my ThinkPad X1 Carbon 5th gen.

Other than that, the volume-dropouts started reappearing on the T14S, whereas I didn't notice any audio-artifacts on the X1 Carbon. Strange...

@SebiderSushi
Copy link

Now I don't have any disconnects, deactivations or dropout, but I'm experiencing low volume levels on the AirPods and none of the suggested fixes from the Arch Wiki (running bluetoothd with --nolplugin=avrcp, disabling spatial audio, turning AirPods to Mono-Audio) worked in my case. So if anyone has another idea about that: Thanks in advance!

This is how i deal with the AirPods volume: #17 (comment)
basically the issue is that PulseAudio did not support absolute volume for bluetooth devices for a very long time (the patch for it was merged about one month ago).

I use a script that iterates through a few of the possible d-bus paths and tries setting the remote volume to the maximum value of '127' for the MAC address of my AirPods. I mapped the script to a keyboard shortcut and that's good enough as a workaround for me.

This is the script i use

@joakim-tjernlund
Copy link
Contributor

@tim-hilt
Copy link

@joakim-tjernlund man, I really should watch those logs more regularly! Updated, rebooted, works again.

@tim-hilt
Copy link

@SebiderSushi thanks for the tip! Again, that are some "exotic" recommendations that I've hadn't heard of before. I just blindly copied and executed your script and it then printed

Error org.freedesktop.DBus.Error.UnknownObject: Method "Set" with signature "ssv" on interface "org.freedesktop.DBus.Properties" doesn't exist

Error org.freedesktop.DBus.Error.UnknownProperty: No such property 'Volume'
Error org.freedesktop.DBus.Error.UnknownObject: Method "Set" with signature "ssv" on interface "org.freedesktop.DBus.Properties" doesn't exist

[ ... repeat last line 15 times ]

it might stem from the fact, that I don't even use pulseaudio directly, but pipewire-pulse! When taking a look at d-feet, I don't even see org.bluez.MediaTransport1, never mind a Volume property.

Let's not spam this thread any further, as it gravitates towards my AirPods-issues rather than being concerned with the original bluez-issue. Is there a different way to reach you? You can also find some contact-information about myself in my GitHub-profile, if you want to reach out to me. Thanks again for the tip so far!

@CathalOConnorRH
Copy link

also seeing this with Sony XM4 on Fedora 34, These hadn't been paired before.
Followed the steps in [1] and working perfectly.

[1] #157 (comment)

@DanielKotik
Copy link

DanielKotik commented Jul 3, 2021

Can confirm this with my new Poly Voyager 8200 UC on Fedora 34. Workaround #157 (comment) has helped me too.

@jonkoops
Copy link

jonkoops commented Jul 4, 2021

I am experiencing this issue as well on my Sony WH-1000XM3, running Fedora Silverblue (34). @Vudentz would it be possible to get a hot fix release for this issue, it seems very widespread.

@garrett
Copy link

garrett commented Jul 5, 2021

Firstly: This is the first time I can remember having Bluetooth broken like this in Linux. Bluetooth is generally excellent on Linux, thanks to this project Huge thanks to everyone at working on Bluez. 👏 👍

However, Bluetooth audio has been broken for over two weeks on all Linux distributions that have upgraded to Bluez 5.59, including (but probably not limited to) Fedora and Arch.

Having broken Bluetooth audio is bad in most times, but it's compounded by the need to use headphones for many people to be able to do video calling for remote work, remote schooling, calling friends and family, and so on, in the age of the pandemic.

It would be excellent to have a new release with the fix, either as a full release or as a hotfix.


@jonkoops: I'm also using my Sony WH-1000XM3 on Fedora Silverblue 34. At first, I did a workaround by adding a wacky USB audio device that exports as Bluetooth (needed for a Nintendo Switch) and paired to that until I found this issue and did an override for Silverblue. (I couldn't do a rollback, as I had to do a fresh reinstall two weeks ago.)

For Silverblue, I had to hunt down builds of the previous version of Bluez, download RPMs (x86_64), and do an override for the packages that are installed by default: rpm-ostree override replace bluez bluez-libs bluez-obexd bluez-cups

FWIW: There's a Fedora bug at https://bugzilla.redhat.com/show_bug.cgi?id=1976795.

@abhijeetviswa
Copy link

@garrett I agree. The regression is serious enough that warrants an immediate hot fix release. Hopefully we see one soon 🤞

@DenisValcke
Copy link

The downgrade also solved the issue for me.

@ErikReider
Copy link

For me using bluez-git from the AUR and removing /var/lib/bluetooth worked for my Airpods Pro

@ghost
Copy link

ghost commented Jul 6, 2021

For me this bug happens even though I am using pipewire and not pulseaudio.

@garrett
Copy link

garrett commented Jul 6, 2021

@Toadfield: Yep, everyone on Fedora 34 is on PipeWire by default and are hit by this bug too. There's a big enough mix of people above in this issue using PipeWire and PulseAudio that I think we can safely say this issue is really about Bluez, irrespective of PipeWire or PulseAudio.

Hopefully there will be an official fix soon, as most people definitely won't find this bug and know to downgrade Bluez... they'll just have broken Bluetooth audio like we all have had for the past few weeks.

@ghost
Copy link

ghost commented Jul 6, 2021

When will the fix be released?
Cause I don't want to downgrade or install bluez-git.

@SocketByte
Copy link

SocketByte commented Jul 7, 2021

My god, it's such a blessing that I've found this issue. I've been pulling my hair for the past few days because my bluetooth would just not cooperate at all. I honestly didn't think it could've been an issue with bluez, as I'm always taking the blame on myself when something doesn't work haha.

Using bluez-git and removing /var/lib/bluetooth did it for me, finally. Hopefully we'll see a patched version soon!

@Vudentz
Copy link
Contributor

Vudentz commented Jul 7, 2021

5.60 has been released:

e1432e7

@Vudentz Vudentz closed this as completed Jul 7, 2021
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this issue Jul 7, 2021
https://build.opensuse.org/request/show/903983
by user seife + dimstar_suse
add bluez-5.59-0388794dc5fdb73a4ea.diff, fixes a2dp on newly paired devices, bluez/bluez#157 (forwarded request 903982 from seife)
@jonkoops
Copy link

5.60 has indeed resolved the problem and has been rolled out to the latest Silverblue. I did however still need to remove the /var/lib/bluetooth directory and restart the service before things were working properly.

deepcube added a commit to deepcube/void-packages that referenced this issue Jul 12, 2021
Note that in some circumstances the user must delete /var/lib/bluetooth
if 5.59 created cache files affected by bluez issue 157[0].  I don't
know if it's acceptable to do this in post_install().  I will note that
archlinux did not remove /var/lib/bluetooth[1].

[0] bluez/bluez#157
[1] archlinux/svntogit-packages@03e8179
@JulindM
Copy link

JulindM commented Jul 16, 2021

5.60 has indeed resolved the problem and has been rolled out to the latest Silverblue. I did however still need to remove the /var/lib/bluetooth directory and restart the service before things were working properly.

This is critical. I was having these problems and only when I removed the /var/lib/bluetooth folder, I got it all working again.

ericonr pushed a commit to deepcube/void-packages that referenced this issue Jul 17, 2021
In some circumstances, the user must delete /var/lib/bluetooth if 5.59
created cache files affected by bluez issue void-linux#157 [1]. We chose not to
automate this procedure, since it would also delete user configurations.
Instead, we will keep an INSTALL.msg until the next version bump.

[1] bluez/bluez#157
ericonr pushed a commit to void-linux/void-packages that referenced this issue Jul 17, 2021
In some circumstances, the user must delete /var/lib/bluetooth if 5.59
created cache files affected by bluez issue #157 [1]. We chose not to
automate this procedure, since it would also delete user configurations.
Instead, we will keep an INSTALL.msg until the next version bump.

[1] bluez/bluez#157
@MarcelRobitaille
Copy link

I was not seeing the A2DP profile even after following all these steps. My issue was that there was a --noplugin a2dp in the ExecStart of /etc/systemd/system/bluetooth.service. Not sure how that got there

Sorry if this isn't the place for it, but maybe this will help somebody else out.

@pourmand1376
Copy link

I also had this problem and it showed Failed to connect: org.bluez.Error.Failed and loading module-bluetooth-discover gave an error.

pactl load-module module-bluetooth-discover
Failure: Module initialization failed

All I have to do as mentioned was to:

    sudo systemctl stop bluetooth
    rm -rf /var/lib/bluetooth
    sudo systemctl start bluetooth
    bluetoothctl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests