5

I'm currently trying to make HSP bluetooth profile works on a custom board based on Atmel SAMA5D2. I'm using a custom Linux made from Buildroot-2017-08.

I'm at the point where I try to configure pulseaudio. The pulseaudio package is the one from buildroot and I ticked "start as system daemon".

When the system starts, pulseaudio seems to be running

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

However when I try to communicate with the daemon it fails

# 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

I realized that the message change if I export the following environement variable

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

Concerning rights to access this folder here they are

# 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

From this question Problems with pulseaudio - pavucontrol and pacmd not connecting to pulseaudio I tried to change rights about the directory but it didn't changed anything.

# 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

It seems that there are some problems when looking at logs but I can't say if this is a big deal or not.

# 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

Also I have no choice to run pulseaudio as root because there is no other user on my target.


EDIT :

After restarting pulseaudio in verbose mode (-vvv) it seems that the problem comes from an invalid connection data

# 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.

After adding root user to pulse group the problem persists.


EDIT 2 :

Changing the process access rights to allow pulse group's members to read/write and execute files seems to unlock a bit the situation as I can now communicate with the daemon but not act on it.

# 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.
2

Finally seems that it was a profile issue.

I just changed the umask line from umask 077 to umask 007 in /etc/init.d/S50pulseaudio so members of group pulse can access files.

Content of /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 $?

Regarding pacmd it's normal I can't access it as I'm running pulseaudio system-wide.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.