![UBUNTU 20.04 上的蓝牙不断断开连接](https://linux22.com/image/1022576/UBUNTU%2020.04%20%E4%B8%8A%E7%9A%84%E8%93%9D%E7%89%99%E4%B8%8D%E6%96%AD%E6%96%AD%E5%BC%80%E8%BF%9E%E6%8E%A5.png)
我已经在笔记本电脑上安装了 Ubuntu 20.04,但蓝牙似乎无法按预期工作。
它连接到我的 Logi MX ERGO 设备,也连接到我的 TWS 耳机,但运行一段时间后(显然是随机时间)它停止工作,所以我需要使用触摸板将蓝牙管理器或 bluesman 切换到 OFF 然后再打开,这样它就会自动连接到我的设备......但过一段时间它就会再次断开连接;
这是 grep blue /var/log/syslog 的输出
Apr 12 18:06:34 leonardo-G3-3579 bluetoothd[834]: /org/bluez/hci0/dev_60_F4_3A_3A_91_F2/sep2/fd0: fd(53) ready
Apr 12 18:06:46 leonardo-G3-3579 systemd[1]: blueman-mechanism.service: Succeeded.
Apr 12 18:06:49 leonardo-G3-3579 bluetoothd[834]: bt_uhid_send: Invalid argument (22)
Apr 12 18:06:49 leonardo-G3-3579 bluetoothd[834]: message repeated 10 times: [ bt_uhid_send: Invalid argument (22)]
Apr 12 18:08:49 leonardo-G3-3579 bluetoothd[834]: No reply to Suspend request
Apr 12 18:08:53 leonardo-G3-3579 dbus-daemon[838]: [system] Activating via systemd: service name='org.blueman.Mechanism' unit='blueman-mechanism.service' requested by ':1.100' (uid=1000 pid=2163 comm="/usr/bin/python3 /usr/bin/blueman-applet " label="unconfined")
Apr 12 18:08:53 leonardo-G3-3579 blueman-mechanism[4127]: Unable to init server: Could not connect: Connection refused
Apr 12 18:08:53 leonardo-G3-3579 blueman-mechanism[4127]: Unable to init server: Não foi possível conectar: Connection refused
Apr 12 18:08:53 leonardo-G3-3579 blueman-mechani[4127]: gtk_icon_theme_get_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed
Apr 12 18:08:53 leonardo-G3-3579 dbus-daemon[838]: [system] Successfully activated service 'org.blueman.Mechanism'
Apr 12 18:08:59 leonardo-G3-3579 bluetoothd[834]: /org/bluez/hci0/dev_60_F4_3A_3A_91_F2/sep2/fd1: fd(39) ready
Apr 12 18:09:23 leonardo-G3-3579 systemd[1]: blueman-mechanism.service: Succeeded.
Apr 12 18:11:47 leonardo-G3-3579 bluetoothd[834]: bt_uhid_send: Invalid argument (22)
Apr 12 18:11:47 leonardo-G3-3579 bluetoothd[834]: message repeated 10 times: [ bt_uhid_send: Invalid argument (22)]
Apr 12 18:11:52 leonardo-G3-3579 dbus-daemon[838]: [system] Activating via systemd: service name='org.blueman.Mechanism' unit='blueman-mechanism.service' requested by ':1.100' (uid=1000 pid=2163 comm="/usr/bin/python3 /usr/bin/blueman-applet " label="unconfined")
Apr 12 18:11:52 leonardo-G3-3579 blueman-mechanism[4425]: Unable to init server: Could not connect: Connection refused
Apr 12 18:11:52 leonardo-G3-3579 blueman-mechanism[4425]: Unable to init server: Não foi possível conectar: Connection refused
Apr 12 18:11:52 leonardo-G3-3579 blueman-mechani[4425]: gtk_icon_theme_get_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed
Apr 12 18:11:52 leonardo-G3-3579 dbus-daemon[838]: [system] Successfully activated service 'org.blueman.Mechanism'
Apr 12 18:12:00 leonardo-G3-3579 bluetoothd[834]: bt_uhid_send: Invalid argument (22)
Apr 12 18:12:00 leonardo-G3-3579 bluetoothd[834]: message repeated 9 times: [ bt_uhid_send: Invalid argument (22)]
Apr 12 18:12:10 leonardo-G3-3579 bluetoothd[834]: /org/bluez/hci0/dev_60_F4_3A_3A_91_F2/sep2/fd2: fd(55) ready
Apr 12 18:12:24 leonardo-G3-3579 systemd[1]: blueman-mechanism.service: Succeeded.
Apr 12 18:35:58 leonardo-G3-3579 blueman.desktop[2309]: Traceback (most recent call last):
Apr 12 18:35:58 leonardo-G3-3579 blueman.desktop[2309]: File "/usr/lib/python3/dist-packages/blueman/main/indicators/GtkStatusIcon.py", line 19, in <lambda>
Apr 12 18:35:58 leonardo-G3-3579 blueman.desktop[2309]: gtk_item.connect('activate', lambda _, idx=index: activate(idx))
Apr 12 18:35:58 leonardo-G3-3579 blueman.desktop[2309]: File "/usr/lib/python3/dist-packages/blueman/main/Tray.py", line 37, in _activate_menu_item
Apr 12 18:35:58 leonardo-G3-3579 blueman.desktop[2309]: return AppletService().ActivateMenuItem('(ai)', indexes)
Apr 12 18:35:58 leonardo-G3-3579 blueman.desktop[2309]: File "/usr/lib/python3/dist-packages/gi/overrides/Gio.py", line 351, in __call__
Apr 12 18:35:58 leonardo-G3-3579 blueman.desktop[2309]: result = self.dbus_proxy.call_sync(self.method_name, arg_variant,
Apr 12 18:35:58 leonardo-G3-3579 blueman.desktop[2309]: gi.repository.GLib.Error: g-io-error-quark: Timeout was reached (24)
Apr 12 18:35:58 leonardo-G3-3579 whoopsie-upload-all[6745]: /var/crash/_usr_bin_blueman-tray.1000.crash already marked for upload, skipping
Apr 12 18:35:58 leonardo-G3-3579 whoopsie-upload-all[6745]: /var/crash/_usr_bin_blueman-assistant.1000.crash already marked for upload, skipping
Apr 12 18:53:15 leonardo-G3-3579 dbus-daemon[838]: [system] Activating via systemd: service name='org.blueman.Mechanism' unit='blueman-mechanism.service' requested by ':1.100' (uid=1000 pid=2163 comm="/usr/bin/python3 /usr/bin/blueman-applet " label="unconfined")
Apr 12 18:53:15 leonardo-G3-3579 blueman-mechanism[9135]: Unable to init server: Could not connect: Connection refused
Apr 12 18:53:15 leonardo-G3-3579 blueman-mechanism[9135]: Unable to init server: Não foi possível conectar: Connection refused
Apr 12 18:53:15 leonardo-G3-3579 blueman-mechani[9135]: gtk_icon_theme_get_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed
Apr 12 18:53:15 leonardo-G3-3579 dbus-daemon[838]: [system] Successfully activated service 'org.blueman.Mechanism'
Apr 12 18:53:25 leonardo-G3-3579 bluetoothd[834]: /org/bluez/hci0/dev_60_F4_3A_3A_91_F2/sep2/fd3: fd(62) ready
Apr 12 18:53:29 leonardo-G3-3579 bluetoothd[834]: bt_uhid_send: Invalid argument (22)
Apr 12 18:53:29 leonardo-G3-3579 bluetoothd[834]: message repeated 10 times: [ bt_uhid_send: Invalid argument (22)]
Apr 12 18:53:47 leonardo-G3-3579 systemd[1]: blueman-mechanism.service: Succeeded.
有人遇到过这个问题吗?我阅读了很多论坛主题并尝试了一些替代方案,但没有一个对我有用。
我将非常感激有关如何解决此问题的任何帮助或参考。
答案1
取消注释以下行可以/etc/bluetooth/input.conf
帮我修复此问题:
UserspaceHID=true
确保systemctl restart bluetooth
应用更改
答案2
我也遇到了同样的问题。找到了解决方案在 Reddit 上 在尝试以下步骤之前,请先完全断开您的设备:
跑步
bluetoothctl
您将收到一个新的提示,您应该输入
agent on
default agent
11:BB:3C:44:5E:FF:7G
然后,使用要连接的设备的MAC 地址(一长串以冒号分隔的字母数字字符,类似于)(您应该能够通过devices
在此提示符下输入来找到它),运行
trust <MAC>
pair <MAC>
connect <MAC>
答案3
我使用的是 Linux Mint。我尝试了很多解决方案,但我发现最好的一个这里。
我做了什么:
编辑:
sudo -e /etc/pulse/default.pa
添加了这一行:
load-module module-bluez5-discover
保存并退出文件,然后使用以下命令重新启动服务:
sudo systemctl restart bluetooth
答案4
对我有用的解决方案
首先运行此命令
`sudo install -m 700 -d /var/lib/bluetooth
然后
sudo systemctl start bluetooth
并重启蓝牙服务
sudo systemctl restart bluetooth.service
最后启用蓝牙
`sudo systemctl enable --now bluetooth`
重新启动你的机器,它就会工作