蓝牙错误“无法加载密钥文件”

蓝牙错误“无法加载密钥文件”

我使用的是 22.04,我的蓝牙出现错误。我可以打开蓝牙,我可以看到其他可以连接的蓝牙设备,但我无法连接。切换联系不起作用。

运行sudo systemctl status bluetooth.service返回以下内容:

● bluetooth.service - Bluetooth service
     Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2023-02-01 12:22:59 EET; 12min ago
       Docs: man:bluetoothd(8)
   Main PID: 7426 (bluetoothd)
     Status: "Running"
      Tasks: 1 (limit: 38166)
     Memory: 808.0K
        CPU: 95ms
     CGroup: /system.slice/bluetooth.service
             └─7426 /usr/lib/bluetooth/bluetoothd

systemd[1]: Starting Bluetooth service...
bluetoothd[7426]: Bluetooth daemon 5.64
systemd[1]: Started Bluetooth service.
bluetoothd[7426]: Starting SDP server
bluetoothd[7426]: Bluetooth management interface 1.21 initialized
bluetoothd[7426]: src/device.c:load_gatt_db() Unable to load key file from /var/lib/bluetooth/84:5C:F3:92:6F:4D/cache/6E:92:30:B5:4A:0D: (No such file or directory)
bluetoothd[7426]: src/device.c:load_gatt_db() No cache for 6E:92:30:B5:4A:0D
bluetoothd[7426]: Too small Add Device complete event

编辑:

的输出sudo dmesg | grep -i blue为:

[    3.356236] Bluetooth: Core ver 2.22
[    3.356430] NET: Registered PF_BLUETOOTH protocol family
[    3.356431] Bluetooth: HCI device and connection manager initialized
[    3.356433] Bluetooth: HCI socket layer initialized
[    3.356434] Bluetooth: L2CAP socket layer initialized
[    3.356447] Bluetooth: SCO socket layer initialized
[    3.427475] Bluetooth: hci0: Legacy ROM 2.x revision 5.0 build 25 week 20 2015
[    3.428603] Bluetooth: hci0: Intel Bluetooth firmware file: intel/ibt-hw-37.8.10-fw-22.50.19.14.f.bseq
[    3.662489] Bluetooth: hci0: Intel BT fw patch 0x43 completed & activated
[    3.996584] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    3.996587] Bluetooth: BNEP filters: protocol multicast
[    3.996589] Bluetooth: BNEP socket layer initialized
[  410.123831] Bluetooth: hci0: link tx timeout

答案1

今天,当我尝试在同一台 PC 的 Windows 和 Ubuntu 上配对蓝牙鼠标时,遇到了同样的问题。我重命名/var/lib/bluetooth/PC:MAC:ADDRESS/MOUSE:MAC:ADDRESS以匹配 Windows 上的鼠标地址,当我重新启动时bluetooth.service,它失败并出现“无法加载密钥文件”错误。事实证明目录中需要一个缓存的属性文件/var/lib/bluetooth/PC:MAC:ADDRESS/cache,该文件也应该与目录的名称和内容匹配MOUSE:MAC:ADDRESS。所以我必须删除MOUSE:MAC:ADDRESS目录(在您的例子中是6E:92:30:B5:4A:0D),重新启动蓝牙服务,然后一切又恢复正常(尽管我仍然需要修理我的鼠标)。

请注意,删除此目录需要sudo -i先进行。

答案2

我不确定这是否是完全相同的问题,但在运行 22.04 时,我遇到了一个问题,即我尝试配对的任何蓝牙控制器(多种类型/制造商)都无法完全配对,控制器显示已连接,但 KDE 对话框无法连接并要求重新启动向导。此后,任何连接控制器的尝试都会导致无休止的连接/断开连接消息。以下是来自 bluetoothctl 的配对和后续连接/断开连接消息的示例:

[NEW] Device 98:B6:E8:96:64:C9 Gamesir-T4pro_64C9
[CHG] Device 98:B6:E8:96:64:C9 RSSI is nil
[CHG] Controller 00:02:72:AC:61:90 Discovering: no
[CHG] Device 98:B6:E8:96:64:C9 Connected: yes
[CHG] Device 98:B6:E8:96:64:C9 Bonded: yes
[CHG] Device 98:B6:E8:96:64:C9 Modalias: usb:v1949p0402d011B
[CHG] Device 98:B6:E8:96:64:C9 UUIDs: 00001124-0000-1000-8000-00805f9b34fb
[CHG] Device 98:B6:E8:96:64:C9 UUIDs: 00001200-0000-1000-8000-00805f9b34fb
[CHG] Device 98:B6:E8:96:64:C9 ServicesResolved: yes
[CHG] Device 98:B6:E8:96:64:C9 Paired: yes
[CHG] Device 98:B6:E8:96:64:C9 WakeAllowed: yes
[CHG] Device 98:B6:E8:96:64:C9 Trusted: yes
[CHG] Device 98:B6:E8:96:64:C9 ServicesResolved: no
[CHG] Device 98:B6:E8:96:64:C9 Connected: no
[CHG] Device 98:B6:E8:96:64:C9 Connected: yes
[CHG] Device 98:B6:E8:96:64:C9 Connected: no
[CHG] Device 98:B6:E8:96:64:C9 Connected: yes
[CHG] Device 98:B6:E8:96:64:C9 Connected: no

最后,我尝试删除整个 BT 适配器目录(我知道,这是绝望的):

rm -rf /usr/var/lib/bluetooth/00:02:72:AC:61:90

蓝牙服务无法启动,因为它缺少 /usr/libexec/bluetooth/bluetoothd 中的 bluetoothd 可执行文件,不知道是怎么回事。我尝试链接源并重新启动服务,一切正常!

ln -s /usr/sbin/bluetoothd /usr/libexec/bluetooth/bluetoothd
systemctl restart bluetooth.service

非常奇怪,这种情况突然就发生了(哈哈),我甚至从板载 BT 适配器切换到 USB 适配器,但没有任何效果,所以删除/链接/重新启动是唯一有效的方法。我应该说一下,我尝试了所有正常的方法:更新、重新启动、重新启动服务、取消配对/修复等,但都没有成功。

相关内容