如果没有“systemctl restart bluetooth”,蓝牙服务无法启动

Sta*_*rák 5 network-manager bluetooth networking drivers iwlwifi

我刚刚收到一台新的 HP 设备。

默认情况下,重新启动后,蓝牙服务无法正确启动,找不到任何可配对的设备,NetworkManager 的蓝牙指示灯也从“关闭”状态变为“打开”状态。

设备: Bus 002 Device 002: ID 8087:0029 Intel Corp. AX200 Bluetooth

日志表明 rfkill 存在问题:

22:22:46 bluetoothd: Failed to set mode: Blocked through rfkill (0x12)
22:22:46 bluetoothd: Failed to set mode: Blocked through rfkill (0x12)
22:19:44 bluetoothd: Failed to set mode: Blocked through rfkill (0x12)
22:13:44 bluetoothd: Failed to set mode: Blocked through rfkill (0x12)
22:13:43 bluetoothd: Failed to set mode: Blocked through rfkill (0x12)
Run Code Online (Sandbox Code Playgroud)

事实上,它是“软阻止”:

# rfkill list
0: hci0: Bluetooth
    Soft blocked: yes
    Hard blocked: no
1: phy0: Wireless LAN
    Soft blocked: no
    Hard blocked: no
Run Code Online (Sandbox Code Playgroud)

如果我解锁它:

# sudo rfkill unblock Bluetooth

并重新启动它

# sudo systemctl restart bluetooth

它立即工作并正确连接到设备,但是,如果我使用 NetworkManager 小程序将其重新关闭并打开,它再次无法工作并且蓝牙保持在“关闭”状态。

截屏

所以看来 NetworkManager 无法重新激活它。只有这样,后续systemctl restart bluetooth命令似乎才能使其再次工作并更改为“打开”状态并开始列出附近的设备。

因此,简而言之,NetworkManager 无法激活蓝牙接口。

请注意,关于 WiFi,它按预期工作。

该问题在该设备上的所有内核(据我测试)中都存在,除了5.4.x. 与 Ubuntu 版本无关,20.04、20.10 和 21.04 上存在相同问题。从 USB 启动时出现同样的问题。在 Windows 上运行没有任何问题。

重新启动计算机后,该问题偶尔不会出现,但大多数情况下都会出现。

小智 2

在我的 HP Elitebook G2 840、Intel\xc2\xae Core\xe2\x84\xa2 i5-5200U CPU @ 2.20GHz \xc3\x97 4\nUbuntu 20.04.2 LTS\nLinux 5.8.0-53-generic x86_64 上,这有效少量:

\n

编辑配置文件:\nsudo nano /etc/bluetooth/main.conf

\n

将 AutoEnable 更改为 True,去掉 #

\n

重新连接时取出#=7

\n

在 Fastconnectable 中取出#

\n

保存并退出。

\n

根据这篇文章:

\n

https://www.makeuseof.com/fix-bluetooth-connectivity-issues-in-ubuntu/

\n


小智 0

我刚刚在一些帮助下解决了这个问题。首先打开终端,使用命令让自己成为 sudo:

sudo -i
cd /etc/init.d
Run Code Online (Sandbox Code Playgroud)

使用文本编辑器将其放入其中:

sleep 10
systemctl restart bluetooth.service
Run Code Online (Sandbox Code Playgroud)

将此脚本另存为BLUETOOTHFIX.sh. 然后启用终端执行:

chmod 755 /etc/init.d/BLUETOOTHFIX.sh
chmod +x /etc/init.d/BLUETOOTHFIX.sh
ln -s /etc/init.d/BLUETOOTHFIX.sh /etc/rc3.d/S99BLUETOOTHFIX.sh
Run Code Online (Sandbox Code Playgroud)