Bluetooth headphones keeps getting turned off

I have an annoying “feature” on my laptop where my bluetooth headphones will “turn off” and reconnect every 3 minutes or so, as if it was trying to suspend itself. This is a problem that happens only on the laptop, while on the desktop the same device works as expected, so I guess this is a weird interaction between the bluetooth drivers on the laptop and the headphones. How can I start to debug this problem?

Edit: So, after a little bit of investigation, I’ve found that the issue may be related to Intel drivers: apparently, wifi conflicts with Bluetooth, so turning off wifi, connecting the device and then turning wifi on seems to be a workaround. Really weird…

Not sure what your situation is, but your surroundings can also interfere with connections too. My body is currently being bombarded with at least a dozen different family’s WiFi and Bluetooth energy.

nmcli should have a command (can’t remember ATM) that let’s you see all the WiFi connections in range, and the channels they are on. It’s possible to move your signal to a channel on the spectrum that’s less congested if you have admin access to your router. Router’s tend to use the same few generic channels, so you might be able to get some easy optimization just by picking a less-used bandwidth.

I don’t use Bluetooth much but I’d expect you should be able to tweak the channels in a similar fashion.

I think I fixed by adding the option

options iwlwifi bt_coex_active=N

to /etc/modprobe.d/iwlwifi.conf.

Or it’s just placebo, I don’t know anymore :sweat_smile:. Tested it for a while and It seems to be fixed.

Yeah, no. It persists, sadly. However after some time it just stops happening :thinking:

systemctl bluetooth status gives that the service is active, but it complains about

src/profile.c:ext_io_disconnected() Unable to get io data for Hands-Free Voice gateway: getpeername: Transport endpoint is not connected (107)

Monitoring bluetoothctl, it seems to me that the device gets removed and reconnected each time it fails, but I don’t know if the info is relevant:

[DEL] Device C9:55:C0:AF:1F:CB JBL TUNE520BT-LE
[CHG] Device 74:2A:8A:C6:10:12 Connected: no
[bluetooth]# [DEL] Transport /org/bluez/hci0/dev_74_2A_8A_C6_10_12/sep2/fd8 
[bluetooth]# [DEL] Endpoint /org/bluez/hci0/dev_74_2A_8A_C6_10_12/sep1 
[bluetooth]# [DEL] Endpoint /org/bluez/hci0/dev_74_2A_8A_C6_10_12/sep2 
[CHG] Device 74:2A:8A:C6:10:12 Connected: yes
[JBL TUNE520BT]# [NEW] Endpoint /org/bluez/hci0/dev_74_2A_8A_C6_10_12/sep1 
[JBL TUNE520BT]# [NEW] Endpoint /org/bluez/hci0/dev_74_2A_8A_C6_10_12/sep2 
[JBL TUNE520BT]# [NEW] Transport /org/bluez/hci0/dev_74_2A_8A_C6_10_12/sep2/fd9 
[JBL TUNE520BT]# [CHG] Transport /org/bluez/hci0/dev_74_2A_8A_C6_10_12/sep2/fd9 Delay: 0x05dc (1500)
[JBL TUNE520BT]# [CHG] Transport /org/bluez/hci0/dev_74_2A_8A_C6_10_12/sep2/fd9 Volume: 0x004c (76)
[JBL TUNE520BT]# [CHG] Transport /org/bluez/hci0/dev_74_2A_8A_C6_10_12/sep2/fd9 State: active

After more looking around on the internet, I found this is a common issue with headphones, apparently: it has to do with A2DP (which I don’t know what it is, honestly) and from what I understood it is a problem with headphones with built-in mics, I guess? Makes sense because this is the only bluetooth device I have problems with, my keyboard works just fine, for example, and it doesn’t disconnect whenever the headphones does.

From what I’ve seen, people were downgrading the firmware to make it work, but I don’t know if I should do that, specially because most issues I’ve found online are from 2 - 3 years ago…

Kernel.org wifi bluetooth coexistence may be helpful – at least it explains the reason options iwlwifi bt_coex_active=N was created. Wifi and bluetooth problems are often related to other radio signals present in your vicinity.

I don’t think it is related to wifi anymore. I thought it was the case because it happened only on the laptop, but I managed to reproduce it on a desktop with wired connection as well.

Have you tried to forget the device and repair it? Also, do you have several other devices possibly interfering with the signal?

I always have to forget and repair each time I connect it. Although it can connect to several devices at once, I use it only paired to a single device at each time.

Do you see anything in journalctl -xe | grep -i blue ?

There are other things you can try, along with pairing it manually etc.

I think the relevant output of it is

systemd[2141]: Reached target bluetooth.target - Bluetooth.
bluetoothd[1022]: src/profile.c:ext_connect() Hands-Free Voice gateway failed connect to 74:2A:8A:C6:10:12: Connection refused (111)
bluetoothd[1022]: profiles/audio/avdtp.c:avdtp_connect_cb() connect to 74:2A:8A:C6:10:12: Connection refused (111)
gnome-shell[2385]: Failed to connect device "JBL TUNE520BT": GDBus.Error:org.bluez.Error.Failed: br-connection-unknown
bluetoothd[1022]: profiles/audio/avdtp.c:avdtp_connect_cb() connect to 74:2A:8A:C6:10:12: Connection refused (111)
bluetoothd[1022]: src/profile.c:ext_connect() Hands-Free Voice gateway failed connect to 74:2A:8A:C6:10:12: Connection refused (111)
bluetoothd[1022]: profiles/audio/avdtp.c:avdtp_connect_cb() connect to 74:2A:8A:C6:10:12: Connection refused (111)
gnome-shell[2385]: Failed to connect device "JBL TUNE520BT": GDBus.Error:org.bluez.Error.Failed: br-connection-unknown
bluetoothd[1022]: profiles/audio/avdtp.c:avdtp_connect_cb() connect to 74:2A:8A:C6:10:12: Connection refused (111)
systemd[2141]: Started app-gnome-gnome\x2dbluetooth\x2dpanel-4534.scope - Application launched by gnome-shell.
systemd[2141]: Starting obex.service - Bluetooth OBEX service...
systemd[2141]: Started obex.service - Bluetooth OBEX service.
systemd[2141]: app-gnome-gnome\x2dbluetooth\x2dpanel-4534.scope: Consumed 2.574s CPU time.
bluetoothd[1022]: /org/bluez/hci0/dev_74_2A_8A_C6_10_12/sep2/fd0: fd(44) ready
bluetoothd[1022]: src/profile.c:ext_io_disconnected() Unable to get io data for Hands-Free Voice gateway: getpeername: Transport endpoint is not connected (107)
wireplumber[2347]: Failed to release transport /org/bluez/hci0/dev_74_2A_8A_C6_10_12/sep2/fd0: Method "Release" with signature "" on interface "org.bluez.MediaTransport1" doesn't exist
bluetoothd[1022]: /org/bluez/hci0/dev_74_2A_8A_C6_10_12/sep2/fd1: fd(44) ready
bluetoothd[1022]: src/profile.c:ext_io_disconnected() Unable to get io data for Hands-Free Voice gateway: getpeername: Transport endpoint is not connected (107)
wireplumber[2347]: Failed to release transport /org/bluez/hci0/dev_74_2A_8A_C6_10_12/sep2/fd1: Method "Release" with signature "" on interface "org.bluez.MediaTransport1" doesn't exist
bluetoothd[1022]: /org/bluez/hci0/dev_74_2A_8A_C6_10_12/sep2/fd2: fd(44) ready
bluetoothd[1022]: src/profile.c:ext_io_disconnected() Unable to get io data for Hands-Free Voice gateway: getpeername: Transport endpoint is not connected (107)
wireplumber[2347]: Failed to release transport /org/bluez/hci0/dev_74_2A_8A_C6_10_12/sep2/fd2: Method "Release" with signature "" on interface "org.bluez.MediaTransport1" doesn't exist
bluetoothd[1022]: /org/bluez/hci0/dev_74_2A_8A_C6_10_12/sep2/fd3: fd(44) ready
bluetoothd[1022]: src/profile.c:ext_io_disconnected() Unable to get io data for Hands-Free Voice gateway: getpeername: Transport endpoint is not connected (107)
wireplumber[2347]: Failed to release transport /org/bluez/hci0/dev_74_2A_8A_C6_10_12/sep2/fd3: Method "Release" with signature "" on interface "org.bluez.MediaTransport1" doesn't exist

which is when it disconnects. It may be related to the other issue where it connects to “handsfree mode”, which is probably some phone call mode, I don’t know. Anyway, this one was fixed by forgetting and pairing again. The new bluez version allows to autopair, but maybe it still gets confused when it pairs?