Bluetooth earphones have to be paired after every reboot

I’m having a problem with my new Bluetooth earphones (HONOR CHOICE Open-Ear Earbuds). I can pair them to my Ubuntu 24.10 PC (it’s a desktop computer with a Bluetooth dongle), after which they work just fine, until I reboot the computer (or restart the bluetooth service), at which point it can’t connect. This didn’t happen with my previous Bluetooth headphones, which worked on Ubuntu just fine.

The only way I can connect the earphones after a reboot is by going through what looks like another pairing process: after some tinkering (turning the earphones or the dongle off and on, trying to connect repeatedly) Ubuntu asks me to confirm a 6-digit code, and after I click “Confirm”, the earphones work again. (The 6-digit code thing is strange by itself, by the way: previous headphones didn’t require one, and there is no way that the earphones can display a code, anyway, so I’m not actually comparing that code with anything.)

After this procedure, the LinkKey in /var/lib/bluetooth/XX:XX:XX:XX:XX:XX/XX:XX:XX:XX:XX:XX/info changes; also, the Bluetooth Manager program that I installed (blueman package) shows the same code in a notification labelled ”Bluetooth Pairing Request”. This makes me reasonably sure that this is, in fact, another pairing that happens.

This problem is specific to Ubuntu: it doesn’t happen on a Windows 11 installation on the same machine, which has no trouble reconnecting after a reboot. (Note that this is not the issue with having to synchronise the link key between two different OSes in case of dual boot: here I’m pairing the earphones with Ubuntu, and then rebooting into Ubuntu again, not touching Windows at all. I’m only mentioning Windows to narrow the issue down to Ubuntu, rather than the earphones or the PC hardware.)

If I try to connect to the earphones via the command line, it produces the following error message (I redacted the device’s address):

$ bluetoothctl connect XX:XX:XX:XX:XX:XX
Attempting to connect to XX:XX:XX:XX:XX:XX
[CHG] Device XX:XX:XX:XX:XX:XX Connected: yes
Failed to connect: org.bluez.Error.Failed br-connection-unknown

I have also discovered the btmon tool, which appears to dump the full trace of Bluetooth messages exchanged between the computer and the devices it interacts with.

In the trace of a failed connection attempt, I found the following exchange:

> HCI Event: Link Key Request (0x17) plen 6                                                                                                                                                                          #55 [hci0] 13.039915
        Address: XX:XX:XX:XX:XX:XX (Tiinlab Corporation)
< HCI Command: Link Key Request Negative Reply (0x01|0x000c) plen 6                                                                                                                                                  #56 [hci0] 13.039939
        Address: XX:XX:XX:XX:XX:XX (Tiinlab Corporation)

Here’s the corresponding part of the trace of a successful connection attempt (after a pairing and before a restart):

> HCI Event: Link Key Request (0x17) plen 6                                                                                                                                  #34 [hci0] 13.524821
        Address: XX:XX:XX:XX:XX:XX (Tiinlab Corporation)
< HCI Command: Link Key Request Reply (0x01|0x000b) plen 22                                                                                                                  #35 [hci0] 13.524834
        Address: XX:XX:XX:XX:XX:XX (Tiinlab Corporation)
        Link key[16]: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

It appears that Ubuntu does not remember that it has a link key for the device after the bluetooth service is restarted.

How can I fix this?

There must be something getting reset in the headphones because what you stated hasn’t happened to me outside of it being a Windows/Linux dual boot key issue. Since it is never an issue in Windows, the simple solution might be to copy that pairing key and use it in Ubuntu

You are on release 24.10, right? Maybe it would be better if you were on LTS 24.04.1.
Do you use blueman-applet? Blueman is a GTK+ Bluetooth manager.
One can configure bluetooth to start when system boots up. Does bluetooth start at bootup?
My budget ($20) bluetooth headphones connect as soon as it is turned on; however, I am still on LTS 22.04.5.

As a tester (Myself) I use all releases including point releases, right now on 25.04
Bluetooth is or can become problematic with incoming new, and dropped libs.

Blueman is an excellent Manager out of our choices to date, and I never have bluetooth enabled at startup. That said all my bluetooth devices just work when I call them to.

One thing I’ve found I’ve needed for stability is

apt list --installed | grep -e bluetooth -e libspa -e blueman

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

blueman/plucky,now 2.4.3-1 amd64 [installed]
bluetooth/plucky,now 5.79-1 all [installed]
libbluetooth3/plucky,now 5.79-1 amd64 [installed,automatic]
libspa-0.2-bluetooth/plucky,now 1.2.6-1build1 amd64 [installed]
libspa-0.2-modules/plucky,now 1.2.6-1build1 amd64 [installed,automatic]
libspandsp2t64/plucky,now 0.0.6+dfsg-2.1build1 amd64 [installed,automatic]
libspatialaudio0t64/plucky,now 0.3.0+git20180730+dfsg1-2.1build1 amd64 [installed,automatic]
pulseaudio-module-bluetooth/plucky,now 1:16.1+dfsg1-5.1ubuntu1 amd64 [installed,automatic]

Apparently, the correct place to look for help was the bluez GitHub repo :smiling_face:

I found issue 973, which describes my situation exactly. Apparently, this is due to a bug in bluez that was fixed in version 5.78, whereas Ubuntu 24.10 repositories contain version 5.77. After installing the latest version of that package compiled from source, the problem was fixed.

Do they know what version introduced this issue? I have Bluez 5.72 and haven’t noticed it

1 Like

They report it was version “bluez-5.76.” Like @Jeremy31 I’ve not seen this on my end

I have same issue with ubuntu 24.04 with latest updates.
After reboot i need to remove headset and pair again.
bluez version is 5.72(default in 24.04)

1 Like

This is fixed in Oracular with 5.77-0ubuntu2. The aforementioned GitHub issue is a duplicate of another. That issue is mentioned directly in the patch included with this latest version in Ubuntu. It even explains the source of the issue— a change in the kernel:

From 366a8c522b648f47147de4852c5c030d69b916b3 Mon Sep 17 00:00:00 2001
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date: Wed, 28 Aug 2024 11:30:16 -0400
Subject: [PATCH] adapter: Fix up address type when loading keys

Due to kernel change 59b047bc9808
("Bluetooth: MGMT/SMP: Fix address type when using SMP over BREDR/LE")
some keys maybe store using the wrong/invalid address type as per MGMT
API, so this attempts to fix them up.

Fixes: https://github.com/bluez/bluez/issues/875
---
 src/adapter.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

Interestingly, the kernel commit mentioned, found in 6.7-rc7, was authored by a bluez contributor. Looks like the commit was reverted in 6.11-rc7. So it seems Plucky (on 6.12.0-12.12 as I type) doesn’t even need the change.

Looking at the rest of the bug report, it’s been confirmed for Noble but unassigned to anyone. I’m not sure I think SRUs are necessarily good first tasks for new packagers, but fixing it for Noble sure is. You’re essentially just copying the above on a different version, making sure it builds, and testing it. I’m sure someone would help sponsor and maybe even do the requisite paperwork.

3 Likes

I am studying this now to see what I can do.

1 Like

I have exactly the same problem as the thread creator with my Bluetooth headset. It’s a Sennheiser Momentum 4 and I’m using Ubuntu 24.04. It would be great if someone could update or patch bluez for 24.04. Unfortunately I can’t do it.

1 Like

According to earlier posts, this has been fixed, however, we will not see it until Ubuntu 25.04 is released in April.
While I agree it is a pain, the fix is only a couple of months away so I am going to continue to be patient until then. I just have to remember to reconnect my Bluetooth headphones after a reboot.
Cheers
Pete

1 Like

With the help of @wxl I am working on patching bluez for noble but I am new at it so I am slow plus I have real life duties to also take care of but I hope to get this done this weekend so it can be looked at by the real devs. Fingers crossed I do not mess it up.

Seriously I have confidence that I will get through it with the excellent help I am receiving.

5 Likes

The patch for noble is ready

1 Like