AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1020257
Accepted
SebMa
SebMa
Asked: 2018-03-30 04:48:49 +0800 CST2018-03-30 04:48:49 +0800 CST 2018-03-30 04:48:49 +0800 CST

bluez5:无法连接到 Ubuntu 17.10 上的配对蓝牙设备

  • 772

我在 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]#
pulseaudio bluetooth bluez
  • 3 3 个回答
  • 37473 Views

3 个回答

  • Voted
  1. Best Answer
    Ali Razmdideh
    2018-03-31T06:42:23+08:002018-03-31T06:42:23+08:00

    来自Arch wiki,配对有效,但连接无效,部分:

    这可能是由于未安装 pulseaudio-bluetooth 软件包。如果丢失,请安装它,然后重新启动 pulseaudio。

    但是pulseaudio-bluetooth软件包的名称pulseaudio-module-bluetooth在 Ubuntu 上。

    所以你的问题应该在安装后解决:

    sudo apt install pulseaudio-module-bluetooth
    

    安装此软件包后,重新启动系统以加载一些脉冲音频模块,如module-bluetooth-policy和module-bluetooth-discover.

    更新:

    但如果仍然如此,您会在重新启动后收到以下消息:

    连接错误:连接被拒绝 (111)

    根据这个答案,您应该将这些行添加到/etc/pulse/default.pa文件中。(如果不存在):

    load-module module-bluetooth-policy
    load-module module-bluetooth-discover
    

    但是这些行应该默认存在,并且在重新启动系统后,应该加载这些模块。

    更新2:

    根据Arch wiki 上的这篇文章:

    这可能是因为您已经使用相同的蓝牙适配器将设备与另一个操作系统配对(例如,双启动)。某些设备无法处理与同一 MAC 地址关联的多个配对(即蓝牙适配器)。您可以通过重新配对设备来解决此问题

    因此,请使用此命令重新配对您的设备(或者您可以使用 GUI 方法):

    第一次运行:

    bluetoothctl
    

    然后使用此命令显示配对设备:

    devices
    

    这应该有一些像这样的输出:

    Device XX:XX:XX:XX:XX:XX Device Name
    

    然后使用以下命令删除配对设备:

    remove XX:XX:XX:XX:XX:XX
    

    并重启蓝牙服务:

    sudo service bluetooth restart
    

    然后尝试再次配对设备。

    • 20
  2. jakethefinn
    2020-02-29T02:17:58+08:002020-02-29T02:17:58+08:00

    禁用网络管理器!

    ...或类似的网络管理。它解决了大多数网络问题,您手动尝试控制 NetworkManager 被编程监督的服务。

    在 Kali Linux 中编辑/usr/sbin/update-rc.d其中“自动禁用我们不想默认启动的服务”。

    在白名单中找到此条目

    # List of whitelisted init scripts
    #
    ...
    network-manager enabled
    ...
    

    并将其移至黑名单并将 enabled 更改为disabled。同样,将蓝牙移动到白名单并启用,如果您希望它在手动打开时通过重新启动保持打开状态。其次,不要忘记打开蓝牙电源以使连接持久。

    ...
    [bluetooth]# power on
    Changing power on succeeded
    [CHG] Device FC:58:FA:A1:C2:70 Connected: yes
    

    您还可以在/etc/NetworkManager/NetworkManager.conf中为单个设备禁用 NetworkManager,通过 MAC 地址或接口名称对其进行屏蔽:

    [keyfile]
    unmanaged-devices=mac:<hwaddr>
    
    [keyfile]
    unmanaged-devices=interface-name:<ifname>
    

    要查找本地蓝牙设备的 MAC 地址和接口名称,请使用命令

    hcitool dev
    
    • 2
  3. A N Syafiq.
    2021-05-27T08:04:23+08:002021-05-27T08:04:23+08:00

    您可能需要重新阅读设备手册以了解如何配对。我已经为这个特殊问题浪费了 3 个小时,结果我的设备有关于如何配对的特定说明。按照说明进行后,我可以配对没有问题

    • -1

相关问题

  • 我可以将我的计算机用作 A2DP 接收器/蓝牙扬声器吗?

  • 如何解决联想笔记本电脑上恢复/电源问题时禁用的蓝牙?

  • 如何将音乐流式传输到我的 AirTunes?

  • 声音小程序消失了

  • 声音,在多个程序之间停止

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve