Linux Ubuntu18.04蓝牙没声音 org.bluez.Error.Failed, name org.PulseAudio1 already taken

文章目录

  • ubuntu 18.04 终端命令行开启/关闭蓝牙
  • 蓝牙没有声音怎么解决?
  • 解决
  • 当Blueman也不好使...
  • 机器其他配置
  • 报错集锦


ubuntu 18.04 终端命令行开启/关闭蓝牙

设置面板的蓝牙开关按钮不好用了, 关了就开不了了, 如何手动开启?看这里.

蓝牙没有声音怎么解决?

我的经历,供参考:
蓝牙连上了但是没有声音, 一通折腾, 横冲直撞满头包… 网上说的什么 a2db.py, 反复折腾PulseAudo, Alsamixer 统统不管用. pulseaudio进程杀也杀不死, 死了又复生.
本来觉得已经无望了, 但我怎么会轻易放弃 ?

解决

遇到这个问题,请首先尝试安装Blueman解决,好用!

$ sudo apt-get install blueman

如果到这已经解决了你的问题,后面的内容就不用看了.以下作为记录,仅供参考.不清楚具体哪些操作起到了作用, 所以尽量列出. 有一些是为了展示当前配置.

# 安装pulseaudio-module-bluetooth,还是没有好
$ sudo apt install pulseaudio-module-bluetooth
# pulseaudio -k不起作用.试了改权限
$ sudo chown -R $USER:$USER $HOME/
# 查看进程,准备杀进程,但是其实是杀不死的
$ ps -e | grep pulse
# 输出:
11681 ?        00:00:00 pulseaudio
11686 ?        00:00:00 pulseaudio
# 尝试杀死
$ sudo killall pulseaudio
# 死而复生
$ ps -e | grep pulse
# 输出:
# 11716 ?        00:00:00 pulseaudio
# 11717 tty2     00:00:00 pulseaudio
# 11718 tty2     00:00:00 pulseaudio
# 11720 ?        00:00:00 pulseaudio
# 11721 ?        00:00:00 pulseaudio
# 根据报错 E: [pulseaudio] core-util.c: XDG_RUNTIME_DIR (/run/user/0) 不属于本进程 再次尝试改权限
$ sudo chown -R xxx /run/user/0
# 安装dkms,本机其实已经安装了dkms: 2.3-3ubuntu9.7
$ sudo apt-get install dkms
# 改pulse配置
$ sudo gedit /etc/pulse/default.pa
# 将 load-module module-udev-detect 改为 load-module module-udev-detect tsched=0
# 终极解决:安装blueman!!!
$ sudo apt-get install blueman
# 从启动器打开blueman,设置如下

blueman设置:
Linux Ubuntu18.04蓝牙没声音 org.bluez.Error.Failed, name org.PulseAudio1 already taken_第1张图片
pulseaudio设置1:
Linux Ubuntu18.04蓝牙没声音 org.bluez.Error.Failed, name org.PulseAudio1 already taken_第2张图片
pulseaudio设置2:
Linux Ubuntu18.04蓝牙没声音 org.bluez.Error.Failed, name org.PulseAudio1 already taken_第3张图片
声音设置:
Linux Ubuntu18.04蓝牙没声音 org.bluez.Error.Failed, name org.PulseAudio1 already taken_第4张图片
蓝牙耳机:
Linux Ubuntu18.04蓝牙没声音 org.bluez.Error.Failed, name org.PulseAudio1 already taken_第5张图片


当Blueman也不好使…

感谢: https://blog.csdn.net/github_36674178/article/details/84715079, 2020.07.20再一次治好ubuntu18.04连不上蓝牙耳机. blueman也不好使
解决过程:

  1. 事先重装更新了一些软件:
$ sudo /etc/init.d/bluetooth stop
$ sudo apt-get purge blueman bluez-utils bluez bluetooth
$ sudo apt-get install blueman bluez:i386 bluetooth
$ sudo apt-get install pulseaudio-module-bluetooth* ubuntu-desktop* unity-control-center*
$ sudo /etc/init.d/bluetooth start
  1. 然后按照帖子里的说明手动进行配对和连接, 比什么blueman工具都好用
$ bluetoothctl
[bluetooth]# power on
[bluetooth]# show
# 移除
[bluetooth]# remove AE:28:47:A4:16:48
[bluetooth]# list
# 配对
[bluetooth]# pair AE:28:47:A4:16:48
Attempting to pair with AE:28:47:A4:16:48
Failed to pair: org.bluez.Error.ConnectionAttemptFailed
[bluetooth]# pair AE:28:47:A4:16:48
Attempting to pair with AE:28:47:A4:16:48
[CHG] Device AE:28:47:A4:16:48 Connected: yes
# 连接
[bluetooth]# connect AE:28:47:A4:16:48
Attempting to connect to AE:28:47:A4:16:48
Failed to connect: org.bluez.Error.Failed
[CHG] Device AE:28:47:A4:16:48 RSSI: -64
...
[CHG] Device AE:28:47:A4:16:48 RSSI: -76
[bluetooth]# connect AE:28:47:A4:16:48
Attempting to connect to AE:28:47:A4:16:48
[CHG] Device AE:28:47:A4:16:48 RSSI: -64
Failed to connect: org.bluez.Error.Failed
[CHG] Device AE:28:47:A4:16:48 RSSI: -75
...
[CHG] Device AE:28:47:A4:16:48 Connected: yes
[CHG] Device AE:28:47:A4:16:48 Trusted: yes

最后终于配对成功, 去设置-声音里切换输出,就可以听到了.

  1. 只有一边有声音
    先将有声音的那只耳机power offer, 然后尝试看能不能连接上没有声音的另一只. 如果连接成功, 再将关闭电源的那只耳机打开.

其他参考: https://www.maketecheasier.com/setup-bluetooth-in-linux/


机器其他配置

$ pulseaudio --version
# 输出:
# pulseaudio 11.1
$ alsactl -version
# 输出:
# alsactl version 1.1.3
$ lspci|grep Audio
# 输出:
# 00:1f.3 Audio device: Intel Corporation Cannon Lake PCH cAVS (rev 10)
# 01:00.1 Audio device: NVIDIA Corporation GP102 HDMI Audio Controller (rev a1)
# 02:00.1 Audio device: NVIDIA Corporation GP102 HDMI Audio Controller (rev a1)
$ printenv DBUS_SESSION_BUS_ADDRESS
# 输出:
# unix:path=/run/user/1000/bus,guid=3d0415cee43b15860a7edd7d5eec1603

折腾过程中的报错如下 (排名不分先后, 如有遗漏敬请主动与我联系,有一个算一个

报错集锦

$ pyton3.6 a2db.py
Connection MADE
Selecting device:
1. F0:BA:E1:F2:E0:E6   
2. 43:C0:06:48:26:E1 43-C0-06-48-26-E1
3. 4A:78:E0:01:28:62 4A-78-E0-01-28-62
4. 5D:DB:F6:E0:19:03 5D-DB-F6-E0-19-03
5. 5E:71:C8:B4:EC:B1 5E-71-C8-B4-EC-B1
6. 7E:AA:F5:DD:03:17 7E-AA-F5-DD-03-17
7. 80:32:53:7F:3C:07 G08CNXNFRDC1617
8. C8:0F:10:B7:F8:3A MI_SCALE
9. 4C:6F:9C:DC:37:E2 OPPO K5
10. FA:D8:93:DC:D9:39 i11
11. 24:09:95:F2:E7:47 jjjjjjj
12. 9C:2E:A1:40:2C:AE 小米手机
Select device[1]:
10
Device MAC: FA:D8:93:DC:D9:39
Cannot find `bluez_card.FA_D8_93_DC_D9_39` using `pactl list cards short`. Retrying 15 more times
Cannot find `bluez_card.FA_D8_93_DC_D9_39` using `pactl list cards short`. Retrying 14 more times
Cannot find `bluez_card.FA_D8_93_DC_D9_39` using `pactl list cards short`. Retrying 13 more times
Cannot find `bluez_card.FA_D8_93_DC_D9_39` using `pactl list cards short`. Retrying 12 more times
Cannot find `bluez_card.FA_D8_93_DC_D9_39` using `pactl list cards short`. Retrying 11 more times
Cannot find `bluez_card.FA_D8_93_DC_D9_39` using `pactl list cards short`. Retrying 10 more times
Cannot find `bluez_card.FA_D8_93_DC_D9_39` using `pactl list cards short`. Retrying 9 more times
Cannot find `bluez_card.FA_D8_93_DC_D9_39` using `pactl list cards short`. Retrying 8 more times
Cannot find `bluez_card.FA_D8_93_DC_D9_39` using `pactl list cards short`. Retrying 7 more times
Cannot find `bluez_card.FA_D8_93_DC_D9_39` using `pactl list cards short`. Retrying 6 more times
Cannot find `bluez_card.FA_D8_93_DC_D9_39` using `pactl list cards short`. Retrying 5 more times
Cannot find `bluez_card.FA_D8_93_DC_D9_39` using `pactl list cards short`. Retrying 4 more times
Cannot find `bluez_card.FA_D8_93_DC_D9_39` using `pactl list cards short`. Retrying 3 more times
Cannot find `bluez_card.FA_D8_93_DC_D9_39` using `pactl list cards short`. Retrying 2 more times
Cannot find `bluez_card.FA_D8_93_DC_D9_39` using `pactl list cards short`. Retrying 1 more times
It seems device: FA:D8:93:DC:D9:39 is not connected yet, trying to connect.
Connecting again.
Exiting bluetoothctl
Expression "Failed to connect: org.bluez.Error.Failed" failed with fail pattern: "fail"
$ pulseaudio
E: [pulseaudio] core-util.c: XDG_RUNTIME_DIR (/run/user/0) 不属于本进程 (uid 1000),而属于 uid 0 号进程! (这可能是在原生协议下通过 root 用户连接一个非 root 用户的 PulseAudio 导致的,请不要这样做。)
$ pulseaudio
E: [pulseaudio] main.c: D-Bus name org.PulseAudio1 already taken.
$ sudo pulseaudio -k
E: [pulseaudio] core-util.c: Home directory not accessible: 权限不够
E: [pulseaudio] main.c: 杀死守护进程失败:没有那个文件或目录
$ sudo pulseaudio --start
W: [pulseaudio] main.c: 不应以 root 身份运行本程序(除非指定 --system 参数)。
E: [autospawn] core-util.c: Home directory not accessible: 权限不够
W: [autospawn] lock-autospawn.c: 不能访问自动执行锁。
E: [pulseaudio] main.c: Failed to acquire autospawn lock
$ HOME=/tmp/$USER pulseaudio -k
E: [pulseaudio] main.c: 杀死守护进程失败:没有那个进程
$ HOME=/tmp/$USER pulseaudio --start
E: [pulseaudio] main.c: 守护程序启动失败。
$ systemctl --user start pulseaudio.service
Warning! D-Bus connection terminated.
Failed to start pulseaudio.service: 连接被对方重设
See user logs and 'systemctl --user status pulseaudio.service' for details.
$ systemctl --user status pulseaudio.service
Failed to get properties: 连接被对方重设
$ pactl load-module module-bluetooth-discover
连接失败:拒绝连接
pa_context_connect() 失败:拒绝连接
$ pactl list modules | grep blue
连接失败:拒绝连接
pa_context_connect() 失败:拒绝连接

你可能感兴趣的:(Linux,运维)