我在 Ubuntu 17.10 上使用 bluez v5.46,但无法连接到配对的蓝牙设备。
这是bluetoothctl
命令的输出:
$ bluetoothctl
[NEW] Controller 6C:0B:84:27:43:66 tensorFlowPHY [default]
Agent registered
[bluetooth]# scan on
Discovery started
[CHG] Controller 6C:0B:84:27:43:66 Discovering: yes
[NEW] Device FC:58:FA:A1:C2:70 OE-P51
[bluetooth]# pair FC:58:FA:A1:C2:70
Attempting to pair with FC:58:FA:A1:C2:70
[CHG] Device FC:58:FA:A1:C2:70 Connected: yes
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 00001101-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 00001108-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 0000111e-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 ServicesResolved: yes
[CHG] Device FC:58:FA:A1:C2:70 Paired: yes
Pairing successful
[CHG] Device FC:58:FA:A1:C2:70 ServicesResolved: no
[CHG] Device FC:58:FA:A1:C2:70 Connected: no
[CHG] Controller 6C:0B:84:27:43:66 Discoverable: no
[bluetooth]# connect FC:58:FA:A1:C2:70
Attempting to connect to FC:58:FA:A1:C2:70
Failed to connect: org.bluez.Error.Failed
这是更多信息:
$ journalctl -u bluetooth | tail
Mar 29 12:06:01 tensorFlowPHY systemd[1]: Started Bluetooth service.
Mar 29 12:06:01 tensorFlowPHY bluetoothd[1136]: Starting SDP server
Mar 29 12:06:01 tensorFlowPHY bluetoothd[1136]: Bluetooth management interface 1.14 initialized
Mar 29 14:36:12 tensorFlowPHY bluetoothd[1136]: a2dp-sink profile connect failed for FC:58:FA:A1:C2:70: Protocol not available
Mar 29 14:36:59 tensorFlowPHY bluetoothd[1136]: a2dp-sink profile connect failed for FC:58:FA:A1:C2:70: Protocol not available
并systemctl
说:
$ systemctl status bluetooth
● bluetooth.service - Bluetooth service
Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2018-03-30 16:30:15 CEST; 21s ago
Docs: man:bluetoothd(8)
Main PID: 1492 (bluetoothd)
Status: "Running"
Tasks: 1 (limit: 4915)
Memory: 1.5M
CPU: 42ms
CGroup: /system.slice/bluetooth.service
└─1492 /usr/lib/bluetooth/bluetoothd
Mar 30 16:30:15 tensorFlowPHY systemd[1]: Starting Bluetooth service...
Mar 30 16:30:15 tensorFlowPHY bluetoothd[1492]: Bluetooth daemon 5.46
Mar 30 16:30:15 tensorFlowPHY systemd[1]: Started Bluetooth service.
Mar 30 16:30:15 tensorFlowPHY bluetoothd[1492]: Starting SDP server
Mar 30 16:30:15 tensorFlowPHY bluetoothd[1492]: Bluetooth management interface 1.14 initialized
Mar 30 16:30:20 tensorFlowPHY bluetoothd[1492]: a2dp-sink profile connect failed for FC:58:FA:A1:C2:70: Protocol not available
Mar 30 16:30:31 tensorFlowPHY bluetoothd[1492]: a2dp-sink profile connect failed for FC:58:FA:A1:C2:70: Protocol not available
编辑 1:我安装了一个缺少的 Ubuntu 软件包:pulseaudio-module-bluetooth
并使用以下命令重新启动了 pulseaudio:pulseaudio -k
现在连接试验后蓝牙日志的输出是:
Mar 30 16:36:59 tensorFlowPHY bluetoothd[1492]: Unable to get connect data for Headset Voice gateway: getpeername: Transport endpoint is not connected (107)
Mar 30 16:37:00 tensorFlowPHY bluetoothd[1492]: connect error: Connection refused (111)
Mar 30 16:37:02 tensorFlowPHY bluetoothd[1492]: connect error: Connection refused (111)
知道为什么吗?
编辑 2:我刚刚按照有人要求重新启动了 Ubuntu。仍然有相同的铅。
编辑 3:我已经加载了两个模块/etc/pulse/default.pa
:
$ egrep "(policy|discover)" /etc/pulse/default.pa
.ifexists module-bluetooth-policy.so
load-module module-bluetooth-policy
.ifexists module-bluetooth-discover.so
load-module module-bluetooth-discover
但是我在硬盘上找不到那些,我需要安装其他东西吗?
编辑 4:我的错误,我使用了locate
命令。在 a 之后sudo updatedb
,该locate
命令现在能够找到这两个文件。
编辑 5:这是pactl
输出:
$ pactl list modules | grep "Name:"
Name: module-device-restore
Name: module-stream-restore
Name: module-card-restore
Name: module-augment-properties
Name: module-switch-on-port-available
Name: module-udev-detect
Name: module-alsa-card
Name: module-alsa-card
Name: module-bluetooth-policy
Name: module-bluetooth-discover
Name: module-bluez5-discover
Name: module-native-protocol-unix
Name: module-default-device-restore
Name: module-rescue-streams
Name: module-always-sink
Name: module-intended-roles
Name: module-suspend-on-idle
Name: module-console-kit
Name: module-systemd-login
Name: module-position-event-sounds
Name: module-role-cork
Name: module-filter-heuristics
Name: module-filter-apply
Name: module-switch-on-connect
Name: module-x11-publish
Name: module-x11-cork-request
Name: module-x11-xsmp
和dpkg -l
输出:
$ dpkg -l | grep blue
ii bluefish 2.2.9-1 amd64 advanced Gtk+ text editor for web and software development
ii bluefish-data 2.2.9-1 all advanced Gtk+ text editor (data)
ii bluefish-plugins 2.2.9-1 amd64 advanced Gtk+ text editor (plugins)
ii blueman 2.0.4-1ubuntu3 amd64 Graphical bluetooth manager
ii bluez 5.46-0ubuntu3 amd64 Bluetooth tools and daemons
ii bluez-cups 5.46-0ubuntu3 amd64 Bluetooth printer driver for CUPS
ii bluez-obexd 5.46-0ubuntu3 amd64 bluez obex daemon
ii bluez-tools 0.2.0~20140808-5build1 amd64 Set of tools to manage Bluetooth devices for linux
ii gnome-bluetooth 3.26.1-1 amd64 GNOME Bluetooth tools
ii indicator-bluetooth 0.0.6+17.10.20170605-0ubuntu3 amd64 System bluetooth indicator.
ii libbluetooth3:amd64 5.46-0ubuntu3 amd64 Library to use the BlueZ Linux Bluetooth stack
ii libgnome-bluetooth13:amd64 3.26.1-1 amd64 GNOME Bluetooth tools - support library
ii pulseaudio-module-bluetooth 1:10.0-2ubuntu3.1 amd64 Bluetooth module for PulseAudio sound server
这是加载的蓝牙脉冲音频模块:
$ pactl list modules short | grep module-bluetooth
9 module-bluetooth-policy
10 module-bluetooth-discover
编辑 6:您的解决方案有效!所以总结一下:
$ bluetoothctl
[bluetooth]# power on
Changing power on succeeded
[CHG] Controller 6C:0B:84:27:43:66 Powered: yes
[bluetooth]# remove FC:58:FA:A1:C2:70
[DEL] Device FC:58:FA:A1:C2:70 OE-P51
Device has been removed
[bluetooth]# exit
Agent unregistered
[DEL] Controller 6C:0B:84:27:43:66 tensorFlowPHY [default]
$ sudo service bluetooth restart
最后:
$ bluetoothctl
[NEW] Controller 6C:0B:84:27:43:66 tensorFlowPHY [default]
Agent registered
[bluetooth]# power on
Changing power on succeeded
[CHG] Controller 6C:0B:84:27:43:66 Powered: yes
[bluetooth]# scan on
Discovery started
[CHG] Controller 6C:0B:84:27:43:66 Discovering: yes
[NEW] Device FC:58:FA:A1:C2:70 OE-P51
[bluetooth]# pair FC:58:FA:A1:C2:70
Attempting to pair with FC:58:FA:A1:C2:70
[CHG] Device FC:58:FA:A1:C2:70 Connected: yes
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 00001101-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 00001108-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 0000111e-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 ServicesResolved: yes
[CHG] Device FC:58:FA:A1:C2:70 Paired: yes
Pairing successful
[CHG] Device FC:58:FA:A1:C2:70 ServicesResolved: no
[CHG] Device FC:58:FA:A1:C2:70 Connected: no
[bluetooth]# connect FC:58:FA:A1:C2:70
Attempting to connect to FC:58:FA:A1:C2:70
[CHG] Device FC:58:FA:A1:C2:70 Connected: yes
Connection successful
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 00001101-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 00001108-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 UUIDs: 0000111e-0000-1000-8000-00805f9b34fb
[CHG] Device FC:58:FA:A1:C2:70 ServicesResolved: yes
[OE-P51]#
来自Arch wiki,配对有效,但连接无效,部分:
但是
pulseaudio-bluetooth
软件包的名称pulseaudio-module-bluetooth
在 Ubuntu 上。所以你的问题应该在安装后解决:
安装此软件包后,重新启动系统以加载一些脉冲音频模块,如
module-bluetooth-policy
和module-bluetooth-discover
.更新:
但如果仍然如此,您会在重新启动后收到以下消息:
根据这个答案,您应该将这些行添加到
/etc/pulse/default.pa
文件中。(如果不存在):但是这些行应该默认存在,并且在重新启动系统后,应该加载这些模块。
更新2:
根据Arch wiki 上的这篇文章:
因此,请使用此命令重新配对您的设备(或者您可以使用 GUI 方法):
第一次运行:
然后使用此命令显示配对设备:
这应该有一些像这样的输出:
然后使用以下命令删除配对设备:
并重启蓝牙服务:
然后尝试再次配对设备。
禁用网络管理器!
...或类似的网络管理。它解决了大多数网络问题,您手动尝试控制 NetworkManager 被编程监督的服务。
在 Kali Linux 中编辑/usr/sbin/update-rc.d其中“自动禁用我们不想默认启动的服务”。
在白名单中找到此条目
并将其移至黑名单并将 enabled 更改为disabled。同样,将蓝牙移动到白名单并启用,如果您希望它在手动打开时通过重新启动保持打开状态。其次,不要忘记打开蓝牙电源以使连接持久。
您还可以在/etc/NetworkManager/NetworkManager.conf中为单个设备禁用 NetworkManager,通过 MAC 地址或接口名称对其进行屏蔽:
要查找本地蓝牙设备的 MAC 地址和接口名称,请使用命令
您可能需要重新阅读设备手册以了解如何配对。我已经为这个特殊问题浪费了 3 个小时,结果我的设备有关于如何配对的特定说明。按照说明进行后,我可以配对没有问题