pacmd 的 Pulseaudio 守护程序未运行

pacmd 的 Pulseaudio 守护程序未运行

我目前正在尝试使 HSP 蓝牙配置文件在基于 Atmel SAMA5D2 的定制板上工作。我正在使用由 Buildroot-2017-08 制作的定制 Linux。

我正在尝试配置pulseaudio。 pulseaudio 包是来自 buildroot 的包,我勾选了“作为系统守护进程启动”。

当系统启动时,pulseaudio似乎正在运行

# ps aux | grep pulse
  174 pulse    usr/bin/pulseaudio --system --daemonize --disallow-exit --disallow-module-loading
  197 root     grep pulse

但是,当我尝试与守护进程通信时,它失败了

# pacmd 
No PulseAudio daemon running, or not running as session daemon.
# pacmd info
No PulseAudio daemon running, or not running as session daemon.
# pactl info
Connection failure: Access denied

我意识到如果我导出以下环境变量,消息会发生变化

# export PULSE_RUNTIME_PATH="/run/pulse"
# pacmd info
Daemon not responding.
# pactl info
Connection failure: Access denied

关于访问此文件夹的权限,它们是

# ls -la /run/pulse/
total 8
drwx------ 3 root  root  120 Jan  2 05:09 .
drwxr-xr-x 6 root  root  240 Jan  2 05:09 ..
drwxr-xr-x 3 pulse pulse  60 Jan  2 05:09 .config
-rw------- 1 pulse pulse  16 Jan  2 05:09 .esd_auth
srwxrwxrwx 1 pulse pulse   0 Jan  2 05:09 native
-rw------- 1 pulse pulse   4 Jan  2 05:09 pid

从这个问题脉冲音频问题 - pavucontrol 和 pacmd 未连接到脉冲音频我尝试更改该目录的权限,但没有改变任何内容。

# ls -la /run/pulse/
total 8
drwx------ 3 pulse pulse 120 Jan  2 05:09 .
drwxr-xr-x 6 root  root  240 Jan  2 05:09 ..
drwxr-xr-x 3 pulse pulse  60 Jan  2 05:09 .config
-rw------- 1 pulse pulse  16 Jan  2 05:09 .esd_auth
srwxrwxrwx 1 pulse pulse   0 Jan  2 05:09 native
-rw------- 1 pulse pulse   4 Jan  2 05:09 pid

查看日志时似乎存在一些问题,但我不能说这是否是一个大问题。

# cat /var/log/messages | grep pulse
Jan  2 05:43:19 buildroot pulseaudio[174]: [pulseaudio] caps.c: Normally all extra capabilities would be dropped now, but that's impossible because PulseAudio was built without capabil.
Jan  2 05:43:19 buildroot pulseaudio[174]: [pulseaudio] main.c: OK, so you are running PA in system mode. Please note that you most likely shouldn't be doing that.
Jan  2 05:43:19 buildroot pulseaudio[174]: [pulseaudio] main.c: If you do it nonetheless then it's your own fault if things don't work as expected.
Jan  2 05:43:19 buildroot pulseaudio[174]: [pulseaudio] main.c: Please read http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/WhatIsWrongWithSystemWide/ for an exp.
Jan  2 05:43:19 buildroot pulseaudio[174]: [pulseaudio] module.c: module-detect is deprecated: Please use module-udev-detect instead of module-detect!
Jan  2 05:43:19 buildroot pulseaudio[174]: [pulseaudio] alsa-util.c: Disabling timer-based scheduling because high-resolution timers are not available from the kernel.
Jan  2 05:43:20 buildroot pulseaudio[174]: [pulseaudio] authkey.c: Failed to open cookie file '/var/run/pulse/.config/pulse/cookie': No such file or directory
Jan  2 05:43:20 buildroot pulseaudio[174]: [pulseaudio] authkey.c: Failed to load authentication key '/var/run/pulse/.config/pulse/cookie': No such file or directory
Jan  2 05:43:20 buildroot pulseaudio[174]: [pulseaudio] authkey.c: Failed to open cookie file '/var/run/pulse/.pulse-cookie': No such file or directory
Jan  2 05:43:20 buildroot pulseaudio[174]: [pulseaudio] authkey.c: Failed to load authentication key '/var/run/pulse/.pulse-cookie': No such file or directory

另外,我无法选择以root身份运行pulseaudio,因为我的目标上没有其他用户。


编辑 :

以详细模式(-vvv)重新启动pulseaudio后,问题似乎来自无效的连接数据

# pactl info -vvv
Connection failure: Access denied
# cat /var/log/messages | grep pulse | tail -n 20
Jan  2 06:27:51 buildroot pulseaudio[250]: [pulseaudio] main.c: Daemon startup successful.
Jan  2 06:27:51 buildroot pulseaudio[252]: [pulseaudio] main.c: Daemon startup complete.
Jan  2 06:27:51 buildroot pulseaudio[252]: [pulseaudio] module.c: Unloading "module-detect" (index: #0).
Jan  2 06:27:51 buildroot pulseaudio[252]: [pulseaudio] module.c: Unloaded "module-detect" (index: #0).
Jan  2 06:27:56 buildroot pulseaudio[252]: [pulseaudio] module-suspend-on-idle.c: Sink alsa_output.0.analog-stereo idle for too long, suspending ...
Jan  2 06:27:56 buildroot pulseaudio[252]: [pulseaudio] sink.c: Suspend cause of sink alsa_output.0.analog-stereo is 0x0004, suspending
Jan  2 06:27:56 buildroot pulseaudio[252]: [alsa-sink-CLASSD PCM atmel-classd-hifi-0] alsa-sink.c: Device suspended...
Jan  2 06:27:56 buildroot pulseaudio[252]: [pulseaudio] core.c: Hmm, no streams around, trying to vacuum.
Jan  2 06:28:28 buildroot pulseaudio[252]: [pulseaudio] client.c: Created 0 "Native client (UNIX socket client)"
Jan  2 06:28:28 buildroot pulseaudio[252]: [pulseaudio] protocol-native.c: Protocol version: remote 31, local 31
Jan  2 06:28:28 buildroot pulseaudio[252]: [pulseaudio] protocol-native.c: Got credentials: uid=0 gid=0 success=0
Jan  2 06:28:28 buildroot pulseaudio[252]: [pulseaudio] protocol-native.c: Denied access to client with invalid authentication data.
Jan  2 06:28:28 buildroot pulseaudio[252]: [pulseaudio] client.c: Freed 0 "Native client (UNIX socket client)"
Jan  2 06:28:28 buildroot pulseaudio[252]: [pulseaudio] protocol-native.c: Connection died.
Jan  2 06:28:43 buildroot pulseaudio[252]: [pulseaudio] client.c: Created 1 "Native client (UNIX socket client)"
Jan  2 06:28:43 buildroot pulseaudio[252]: [pulseaudio] protocol-native.c: Protocol version: remote 31, local 31
Jan  2 06:28:43 buildroot pulseaudio[252]: [pulseaudio] protocol-native.c: Got credentials: uid=0 gid=0 success=0
Jan  2 06:28:43 buildroot pulseaudio[252]: [pulseaudio] protocol-native.c: Denied access to client with invalid authentication data.
Jan  2 06:28:43 buildroot pulseaudio[252]: [pulseaudio] client.c: Freed 1 "Native client (UNIX socket client)"
Jan  2 06:28:43 buildroot pulseaudio[252]: [pulseaudio] protocol-native.c: Connection died.

将root用户添加到pulse组后问题仍然存在。


编辑2:

更改进程访问权限以允许脉冲组的成员读/写和执行文件似乎解锁了一些情况,因为我现在可以与守护进程通信但不能对其进行操作。

# pactl info
Server String: /run/pulse/native
Library Protocol Version: 31
Server Protocol Version: 31
Is Local: yes
Client Index: 1
Tile Size: 65496
User Name: pulse
Host Name: buildroot
Server Name: pulseaudio
Server Version: 9.0
Default Sample Specification: s16le 2ch 44100Hz
Default Channel Map: front-left,front-right
Default Sink: alsa_output.platform-fc048000.classd.analog-stereo
Default Source: alsa_output.platform-fc048000.classd.analog-stereo.monitor
Cookie: 6ae9:b402
# pacmd info
Daemon not responding.

答案1

最后,似乎这是一个配置文件问题。

我刚刚将 umask 行从 更改umask 077umask 007in /etc/init.d/S50pulseaudio,以便脉冲组的成员可以访问文件。

内容/etc/init.d/S50pulseaudio

#!/bin/sh
#
# Starts pulseaudio.
#


start() {
        printf "Starting pulseaudio: "
        #umask 077
        umask 007
        /usr/bin/pulseaudio --system --daemonize --disallow-exit --disallow-module-loading -vvv
        echo "OK"
}
stop() {
        printf "Stopping pulseaudio: "
        killall pulseaudio
        echo "OK"
}
restart() {
        stop
        start
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart|reload)
        restart
        ;;
  *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
esac

exit $?

关于pacmd这是正常的,我无法访问它,因为我正在全系统范围内运行pulseaudio。

相关内容