Bug 1503759

Summary: Can't switch bluetooth headset to use A2DP
Product: [Fedora] Fedora Reporter: Grzegorz <gp.bialek>
Component: pulseaudioAssignee: Lennart Poettering <lpoetter>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 28CC: 08826794brmt, ben.r.xiao, bugzilla-redhat, bugzilla, christof, dominik, extras-qa, horsley1953, lkundrak, lpoetter, michele.mazza, miguelbl9, mmccune, polozovbv, rdieter, redhat, rronnander, social, wtaymans
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1356136 Environment:
Last Closed: 2019-05-28 23:54:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Grzegorz 2017-10-18 16:15:00 UTC
+++ This bug was initially created as a clone of Bug #1356136 +++

Description of problem:

Switching headset to use A2DP instead of HSP/HFP fails. Sound testing A2DP displays headset as mono instead of stereo. Poor sound quality.

Version-Release number of selected component (if applicable):

pulseaudio-11.1-3.fc27.src.rpm
bluez-5.47-2.fc27.src.rpm

How reproducible:

Always

Steps to Reproduce:
1. Pair bluetooth headset
2. Go to Sound settings
3. Select headset
4. Select High Fidelity Playback (A2DP sink)
5. Click on Test Speakers

Actual results:
* Mono
* Poor sound quality

Expected results:
* Stereo
* Good sound quality

Additional info:

This can be worked around by either preventing GDM from starting its own pulseaudio instance or by preventing GDM's pulseaudio instance from loading the bluetooth modules (reboot required):

$ su -s /bin/sh -c "sed '/.*ifexists.*bluetooth.*/,/.*endif.*/d' /etc/pulse/default.pa > ~gdm/.config/pulse/default.pa" gdm

Comment 1 George Sapkin 2017-12-06 09:32:07 UTC
Same issue here. I haven't tried the GDM workaround yet.

bluez-5.47-2.fc27.x86_64
kernel-4.14.3-300.fc27.x86_64
pipewire-0.1.6-2.fc27.x86_64
pulseaudio-11.1-7.fc27.x86_64

Intel(R) Dual Band Wireless AC 8265, REV=0x230 with firmware 34.0.1

Relevant error messages:

[pulseaudio] module-bluez5-device.c: Refused to switch profile to a2dp_sink: Not connected

[  100.163879] Bluetooth: hci0 SCO packet for unknown connection handle 0  
[  100.173891] Bluetooth: hci0 SCO packet for unknown connection handle 0  
[  100.173893] Bluetooth: hci0 SCO packet for unknown connection handle 0  
[  100.173893] Bluetooth: hci0 SCO packet for unknown connection handle 0  
[  105.190667] Bluetooth: hci0 SCO packet for unknown connection handle 257
[  105.190670] Bluetooth: hci0 SCO packet for unknown connection handle 257
[  105.190672] Bluetooth: hci0 SCO packet for unknown connection handle 257

Comment 2 George Sapkin 2017-12-06 09:58:20 UTC
GDM workaround didn't work.

Comment 3 Erwan Legrand 2017-12-12 11:26:05 UTC
If the workaround I have suggested does not work for you, you should perhaps try this other workaround: https://bugzilla.freedesktop.org/show_bug.cgi?id=73325#c52

Comment 4 George Sapkin 2017-12-12 16:22:15 UTC
(In reply to Erwan Legrand from comment #3)
> If the workaround I have suggested does not work for you, you should perhaps
> try this other workaround:
> https://bugzilla.freedesktop.org/show_bug.cgi?id=73325#c52

The `headset=auto` workaround works. Thanks.

Comment 5 George Sapkin 2017-12-13 12:27:17 UTC
Looks like it was some kind of a placebo effect: after a restart the issue is back.

Comment 6 Tom Horsley 2018-01-03 00:44:54 UTC
The solution here worked for me:

https://linuxsuperuser.com/fix-bluetooth-speaker-a2dp-issue-fedora-archlinux/

It moves the load of module-bluetooth-discover to the pulseaudio start
script at the very end. (I have no idea why that works, mind you).

Comment 7 Benjamin Xiao 2018-02-19 10:33:44 UTC
I am getting the same issue with my Sony WH-1000XM2 headset. When I turn it on, it will connect but fail to switch to A2DP. However, if I disconnect the device using the Gnome Bluetooth settings and then reconnect, A2DP starts working again. I have to do this every time I power on the device and it gets really annoying.

Comment 8 andy 2018-04-18 11:50:45 UTC
(In reply to Benjamin Xiao from comment #7)
> I am getting the same issue with my Sony WH-1000XM2 headset. When I turn it
> on, it will connect but fail to switch to A2DP. However, if I disconnect the
> device using the Gnome Bluetooth settings and then reconnect, A2DP starts
> working again. I have to do this every time I power on the device and it
> gets really annoying.

I managed to get my WH-1000XM2 working. I was having the same problem as you described. I hope that this works for other people too. 

This is what I did.

1. get root privileges

2.
echo -e "autospawn = no\ndaemon-binary = /bin/true" \ >/var/lib/gdm/.config/pulse/client.conf

chown gdm:gdm /var/lib/gdm/.config/pulse/client.conf

3. reboot

I tried to re-pair the device and it selected A2DP per default. :)

Comment 9 andy 2018-04-19 06:17:12 UTC
(In reply to andy from comment #8)
> (In reply to Benjamin Xiao from comment #7)
> > I am getting the same issue with my Sony WH-1000XM2 headset. When I turn it
> > on, it will connect but fail to switch to A2DP. However, if I disconnect the
> > device using the Gnome Bluetooth settings and then reconnect, A2DP starts
> > working again. I have to do this every time I power on the device and it
> > gets really annoying.
> 
> I managed to get my WH-1000XM2 working. I was having the same problem as you
> described. I hope that this works for other people too. 
> 
> This is what I did.
> 
> 1. get root privileges
> 
> 2.
> echo -e "autospawn = no\ndaemon-binary = /bin/true" \
> >/var/lib/gdm/.config/pulse/client.conf
> 
> chown gdm:gdm /var/lib/gdm/.config/pulse/client.conf
> 
> 3. reboot
> 
> I tried to re-pair the device and it selected A2DP per default. :)

:(. Problem reoccurred after resume from sleep.

Comment 10 Benjamin Xiao 2018-05-04 09:48:29 UTC
(In reply to andy from comment #8)
> (In reply to Benjamin Xiao from comment #7)
> > I am getting the same issue with my Sony WH-1000XM2 headset. When I turn it
> > on, it will connect but fail to switch to A2DP. However, if I disconnect the
> > device using the Gnome Bluetooth settings and then reconnect, A2DP starts
> > working again. I have to do this every time I power on the device and it
> > gets really annoying.
> 
> I managed to get my WH-1000XM2 working. I was having the same problem as you
> described. I hope that this works for other people too. 
> 
> This is what I did.
> 
> 1. get root privileges
> 
> 2.
> echo -e "autospawn = no\ndaemon-binary = /bin/true" \
> >/var/lib/gdm/.config/pulse/client.conf
> 
> chown gdm:gdm /var/lib/gdm/.config/pulse/client.conf
> 
> 3. reboot
> 
> I tried to re-pair the device and it selected A2DP per default. :)

I've switched to using KDE now. Is there a way to do this in KDE?

Also, this bug is still present in Fedora 28. Can someone update the bug?

Comment 11 Christof Damian 2018-06-21 16:57:36 UTC
This is still present Fedora 28, workarounds didn't work for me.

Comment 12 andy 2018-09-10 15:31:39 UTC
Bug is still present here too. Using Sony WH-1000XM2. 

When I try to change from HSP to A2DP in sound settings I receive:
W: [pulseaudio] module-bluez5-device.c: Refused to switch profile to a2dp_sink: Not connected

To get A2DP working I have to do the following:
1. Connect headphones.
2. Restart bluetooth (systemctl restart bluetooth).
3. Connect headphones again and A2DP is set as default.

Comment 13 andy 2018-11-27 06:24:18 UTC
This problem seem to have disappeared for me in F29 (4.19.3-300.fc29.x86_64).
A2DP has been selected as default source and stereo is working as intended.

No workarounds are needed for me.

Comment 14 Ben Cotton 2019-05-02 19:41:51 UTC
This message is a reminder that Fedora 28 is nearing its end of life.
On 2019-May-28 Fedora will stop maintaining and issuing updates for
Fedora 28. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora 'version' of '28'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 28 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 15 Ben Cotton 2019-05-28 23:54:10 UTC
Fedora 28 changed to end-of-life (EOL) status on 2019-05-28. Fedora 28 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 16 Boris Polozov 2020-07-25 13:43:10 UTC
My devices 

- Latitude e7470 - Network controller: Intel Corporation Wireless 8260 (rev 3a)
- Sony mdr-zx330bt

Catched on:

[195005.778758] Bluetooth: hci0: SCO packet for unknown connection handle 0
[195005.778769] Bluetooth: hci0: SCO packet for unknown connection handle 0
[195005.788781] Bluetooth: hci0: SCO packet for unknown connection handle 0
[195005.788791] Bluetooth: hci0: SCO packet for unknown connection handle 0
[195005.788796] Bluetooth: hci0: SCO packet for unknown connection handle 0
[195744.241384] Bluetooth: hci0: SCO packet for unknown connection handle 257
[195744.241386] Bluetooth: hci0: SCO packet for unknown connection handle 257

Faced with the problem on Fedora 31, after upgrade to Fedora 32 the problem still existed.

Packages: 

~/F/math dnf list installed | grep bluez

ошибка: rpmdb: получен поврежденный заголовок #6940 -- пропускается.
bluez.x86_64                                             5.54-1.fc32                            @fedora                     
bluez-libs.x86_64                                        5.54-1.fc32                            @fedora                     
kf5-bluez-qt.x86_64                                      5.70.0-1.fc32                          @updates                    
kf5-bluez-qt-devel.x86_64                                5.70.0-1.fc32                          @updates

Solved with:

sudo systemctl stop bluetooth && sudo rm -rf /var/lib/bluetooth/*  && sudo systemctl start bluetooth , then pair headset again. This made a2dp available on my sink device.

Hope this will help someone :)

Comment 17 Ryan Ronnander 2022-01-26 01:12:53 UTC
(In reply to Boris Polozov from comment #16)
> [...]
> Solved with:
> 
> sudo systemctl stop bluetooth && sudo rm -rf /var/lib/bluetooth/*  && sudo
> systemctl start bluetooth , then pair headset again. This made a2dp
> available on my sink device.
> 
> Hope this will help someone :)

Thank you! This helped me. This bug may very well still be out there in the wild. 

I just encountered it on my desktop (not Fedora, but posting it here anways): 

- Distro: openSUSE Tumbleweed 20220124-0
- Kernel: 5.16.1-1-default 
- Bluetooth: 03:00.0 Network controller: Intel Corporation Dual Band Wireless-AC 3168NGW [Stone Peak] (rev 10)
- Bluez version: 5.62-2.2

Comment 18 miguelbl9 2023-03-24 19:01:01 UTC
(In reply to Boris Polozov from comment #16)
> [...]
> Solved with:
> 
> sudo systemctl stop bluetooth && sudo rm -rf /var/lib/bluetooth/*  && sudo
> systemctl start bluetooth , then pair headset again. This made a2dp
> available on my sink device.
> 
> Hope this will help someone :)

Thank you so much, it helped me too! My setup

- Distro: Ubuntu 22.04.2 LTS
- Kernel: 5.19.0-35-generic
- Bluetooth: 01:00.0 Network controller: Intel Corporation Wireless 8260 (rev 3a)
- bluez version: 5.64-0ubuntu1
- Headphones: Sony MDR-ZX330BT