我正在运行标准 Ubuntu 18.04。一周前升级后,蓝牙停止工作。top
显示bluetoothd
运行 100% CPU
top - 20:35:01 up 19 min, 1 user, load average: 1,74, 2,32, 1,62
Tasks: 347 total, 2 running, 281 sleeping, 0 stopped, 0 zombie
%Cpu(s): 27,7 us, 1,3 sy, 0,0 ni, 71,1 id, 0,0 wa, 0,0 hi, 0,0 si, 0,0 st
KiB Mem : 8024888 total, 979120 free, 3965944 used, 3079824 buff/cache
KiB Swap: 8242172 total, 8242172 free, 0 used. 3400808 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1180 root 20 0 121108 88060 4152 R 100,0 1,1 19:37.59 bluetoothd
我将 bluez 升级到 5.50-0ubuntu0ppa1 但这没有帮助。
研究 syslog 我发现了一些有趣的行:
NetworkManager[1259]: <info> [1603476921.1850] Loaded device plugin: NMBluezManager (/usr/lib/x86_64-linux-gnu/NetworkManager/libnm-device-plugin-bluetooth.so)
gnome-bluetooth-panel.desktop[4733]: Agent registration failed: Timeout was reached
dbus-daemon[3607]: [session uid=1000 pid=3607] Activating via systemd: service name='org.bluez.obex' unit='dbus-org.bluez.obex.service' requested by ':1.85' (uid=1000 pid=4733 comm="gnome-control-center bluetooth " label="unconfined")
obexd[4964]: bluetooth: RequestProfile error: org.freedesktop.DBus.Error.NoReply, Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
systemd[1]: bluetooth.target: Unit not needed anymore. Stopping.
gnome-bluetooth-panel.desktop[4733]: Agent unregistration failed: Timeout was reached 'g-io-error-quark'
sudo systemctl disable bluetooth.service
我可以使用并重新启动来完全禁用蓝牙。
我的问题:
- 如何修复我的蓝牙?
答案1
它仍然发生在 Ubuntu 20.04.5 LTS 上,top
显示进程bluetoothd
使用 100% 的 cpu。
通常重新启动服务可以解决问题。
获取有关服务的信息:
systemctl status bluetooth
就我而言,它给出了以下输出:
● bluetooth.service - Bluetooth service
Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2022-10-09 15:58:25 CEST; 1 day 17h ago
Docs: man:bluetoothd(8)
Main PID: 1139 (bluetoothd)
Status: "Running"
Tasks: 1 (limit: 38124)
Memory: 3.2M
CGroup: /system.slice/bluetooth.service
└─1139 /usr/lib/bluetooth/bluetoothd
oct 10 23:32:10 ljaouen-Precision-5560 bluetoothd[1139]: Can't get HIDP connection info
oct 10 23:32:15 ljaouen-Precision-5560 bluetoothd[1139]: connect error: Host is down (112)
oct 10 23:32:40 ljaouen-Precision-5560 bluetoothd[1139]: Can't get HIDP connection info
oct 10 23:32:45 ljaouen-Precision-5560 bluetoothd[1139]: connect error: Host is down (112)
oct 10 23:33:10 ljaouen-Precision-5560 bluetoothd[1139]: Can't get HIDP connection info
oct 10 23:33:15 ljaouen-Precision-5560 bluetoothd[1139]: connect error: Host is down (112)
oct 10 23:33:40 ljaouen-Precision-5560 bluetoothd[1139]: Can't get HIDP connection info
oct 10 23:33:45 ljaouen-Precision-5560 bluetoothd[1139]: connect error: Host is down (112)
oct 10 23:34:10 ljaouen-Precision-5560 bluetoothd[1139]: Can't get HIDP connection info
oct 10 23:34:15 ljaouen-Precision-5560 bluetoothd[1139]: connect error: Host is down (112)
这说明:
- 正是这个服务启动了
bluetoothd
(这是可能的,但安全总比后悔好) - 有一部分日志显示错误
重新启动服务:
sudo systemctl restart bluetooth
该进程bluetoothd
已从 的首页消失htop
。
答案2
用户“svartalf”找到了解决方案(https://bbs.archlinux.org/viewtopic.php?id=229740)
我引用:
好吧,看起来删除 /var/lib/bluetooth/ 就可以了。还是不知道那是什么。蓝牙进程的性能表示它只是卡在某些 strlen 调用上。
所以就
rm -rf /var/lib/bluetooth/*
就我而言,成功了。