Discussion:
[PulseAudio] #222: pacmd doesn't work with pulseaudio running as a system-wide daemon
PulseAudio
2008-01-19 11:04:50 UTC
Permalink
#222: pacmd doesn't work with pulseaudio running as a system-wide daemon
------------------------+---------------------------------------------------
Reporter: JeroenHoek | Owner: lennart
Type: defect | Status: new
Priority: normal | Milestone:
Component: daemon | Severity: normal
Keywords: |
------------------------+---------------------------------------------------
I have PulseAudio running as a system-wide daemon. The rationale for this
is the presence of two users and a system-wide MPD daemon. The users
should be able to control MPD and change its volume or redirect streams
through PulseAudio.

pacmd doesn't seem to work in this setup. It does work if a user runs his
own pulsedaemon and connects to that, but not the system-wide one. The
user is in all three pulse* groups and the PID file is accessible.

Error:[[BR]]
E: pacmd.c: no PulseAudio daemon running

Version:[[BR]]
pulseaudio 0.9.8

OS:[[BR]]
Ubunutu 7.10 (Gutsy Gibbon)
--
Ticket URL: <http://pulseaudio.org/ticket/222>
PulseAudio <http://pulseaudio.org/>
The PulseAudio Sound Server
PulseAudio
2008-02-09 21:13:12 UTC
Permalink
#222: pacmd doesn't work with pulseaudio running as a system-wide daemon
-------------------------+--------------------------------------------------
Reporter: JeroenHoek | Owner: lennart
Type: defect | Status: new
Priority: normal | Milestone:
Component: daemon | Severity: normal
Resolution: | Keywords:
-------------------------+--------------------------------------------------
Comment (by hrubi):

first of all you have to set correct PULSE_RUNTIME_PATH environment
variable set (this is not documented as far as i know). on my system i set
it to /var/run/pulse, can differ on your system.

as i've looked in the code, pacmd is trying to send signal 0 to the
daemon, to check if daemon is alive, then it tries to send SIGUSR2, so the
module-cli-protocol-unix is loaded. none of these succeeds as you lack
permissions to do that as an ordinary user.

i've made a workaround for this via sudo, it's rather ugly, but it works:

put these lines into /etc/sudoers

{{{
Defaults:<your_user> env_keep=PULSE_RUNTIME_PATH
<your_user> ALL=(pulse) NOPASSWD: /usr/bin/pacmd
}}}

then you can create some alias like this:[[BR]]
{{{
alias pacmd='PULSE_RUNTIME_PATH=/var/run/pulse sudo -u pulse pacmd'
}}}


i know it's just a weird hack, but it works for this time.
--
Ticket URL: <http://www.pulseaudio.org/ticket/222#comment:1>
PulseAudio <http://pulseaudio.org/>
The PulseAudio Sound Server
PulseAudio
2008-02-09 21:19:25 UTC
Permalink
#222: pacmd doesn't work with pulseaudio running as a system-wide daemon
-------------------------+--------------------------------------------------
Reporter: JeroenHoek | Owner: lennart
Type: defect | Status: new
Priority: normal | Milestone:
Component: daemon | Severity: normal
Resolution: | Keywords:
-------------------------+--------------------------------------------------
Changes (by hrubi):

* cc: ***@gmail.com (added)
--
Ticket URL: <http://www.pulseaudio.org/ticket/222#comment:2>
PulseAudio <http://pulseaudio.org/>
The PulseAudio Sound Server
PulseAudio
2011-01-23 07:00:41 UTC
Permalink
#222: pacmd doesn't work with pulseaudio running as a system-wide daemon
-------------------------+--------------------------------------------------
Reporter: JeroenHoek | Owner: lennart
Type: defect | Status: new
Milestone: | Component: daemon
Resolution: | Keywords:
-------------------------+--------------------------------------------------

Comment(by murz):

I have the same problem with pacmd on pulseaudio running as system-wide.
I have in /var/run/pulse folder files (.esd_auth native pid .pulse-
cookie) and try the command:
{{{
$PULSE_RUNTIME_PATH=/var/run/pulse sudo -u pulse pacmd
}}}
But it isn't help:
No PulseAudio daemon running, or not running as session daemon.

Pulseaudio version: 1:0.9.22-0ubuntu2~diwic

What I can try more for successfully connect to pulseaudio?
--
Ticket URL: <http://pulseaudio.org/ticket/222#comment:3>
PulseAudio <http://pulseaudio.org/>
The PulseAudio Sound Server
PulseAudio
2011-01-23 07:00:55 UTC
Permalink
#222: pacmd doesn't work with pulseaudio running as a system-wide daemon
-------------------------+--------------------------------------------------
Reporter: JeroenHoek | Owner: lennart
Type: defect | Status: new
Milestone: | Component: daemon
Resolution: | Keywords:
-------------------------+--------------------------------------------------
Changes (by murz):

* cc: ***@gmail.com (added)
--
Ticket URL: <http://pulseaudio.org/ticket/222#comment:4>
PulseAudio <http://pulseaudio.org/>
The PulseAudio Sound Server
PulseAudio
2011-01-23 13:09:02 UTC
Permalink
#222: pacmd doesn't work with pulseaudio running as a system-wide daemon
-------------------------+--------------------------------------------------
Reporter: JeroenHoek | Owner: lennart
Type: defect | Status: new
Milestone: | Component: daemon
Resolution: | Keywords:
-------------------------+--------------------------------------------------

Comment(by coling):

You cannot use the $ in your command above murz... When you set the
variable, the $ prefix must be omitted.

As for why it's not working, this is more or less expected. The CLI
interface (which pacmd uses) is a big security issue and thus is not
enabled by default. As described above pacmd tries to tell the daemon to
load the module-cli-protocol-unix module. This module creates a socket
that allows direct communication with PA that bypasses the protocol and
thus allows for extra information and details to be exchanged without
having to squeeze it into the protocol (which is quite awkward).

So once it's loaded this module pacmd connects directly to the "cli"
socket in the runtime path. So check your /var/run/pulse/ folder for a
"cli" socket. If it doesn't exist, pacmd isn't going to work.

Normally the automatic module loading bit will fail with system PAs
because module loading is not allowed and thus the module-cli-protocol-
unix cannot be loaded. So you can try loading it manually in system.pa and
then connect.

Either way, this is by design and I'm not sure it's something we should
change, especially as system mode is not really recommended or really
heavily tested upstream.
--
Ticket URL: <http://pulseaudio.org/ticket/222#comment:5>
PulseAudio <http://pulseaudio.org/>
The PulseAudio Sound Server
PulseAudio
2011-01-23 15:40:07 UTC
Permalink
#222: pacmd doesn't work with pulseaudio running as a system-wide daemon
-------------------------+--------------------------------------------------
Reporter: JeroenHoek | Owner: lennart
Type: defect | Status: new
Milestone: | Component: daemon
Resolution: | Keywords:
-------------------------+--------------------------------------------------

Comment(by murz):

$ is command prompt, command text that I try is without $ symbol.
I add string "load-module module-cli-protocol-unix" in my system.pa, after
that I see the /var/run/pulse/cli socket file (before it absent).
Also I add the option "allow-module-loading = yes" to daemon.conf

But after that pacmd don't want to connect too:
{{{
PULSE_RUNTIME_PATH=/var/run/pulse sudo -u pulse pacmd
[sudo] password for murz:
Home directory /home/murz not ours.
No PulseAudio daemon running, or not running as session daemon.
}}}

I understand that this is security issue, but I need this only for test
time (I want to understand why a2dp sink can't be created when pulseaudio
run as system daemon, issue 898), because pactl tool don't have function
for load module, and several other.

What else can I try?
--
Ticket URL: <http://pulseaudio.org/ticket/222#comment:6>
PulseAudio <http://pulseaudio.org/>
The PulseAudio Sound Server
PulseAudio
2011-01-23 15:46:11 UTC
Permalink
#222: pacmd doesn't work with pulseaudio running as a system-wide daemon
-------------------------+--------------------------------------------------
Reporter: JeroenHoek | Owner: lennart
Type: defect | Status: new
Milestone: | Component: daemon
Resolution: | Keywords:
-------------------------+--------------------------------------------------

Comment(by coling):

The output above suggests you didn't edit the suders file as mentioned in
comment:1 (as it asked for a password which the configuration in comment:1
says it shouldn't). Therefore I suspect that sudo is stripping out that
env var (PULSE_RUNTIME_PATH) and thus it cannot connect. Please try
setting things up as mentioned in comment:1 and report back.
--
Ticket URL: <http://pulseaudio.org/ticket/222#comment:7>
PulseAudio <http://pulseaudio.org/>
The PulseAudio Sound Server
PulseAudio
2011-01-23 15:48:52 UTC
Permalink
#222: pacmd doesn't work with pulseaudio running as a system-wide daemon
-------------------------+--------------------------------------------------
Reporter: JeroenHoek | Owner: lennart
Type: defect | Status: new
Milestone: | Component: daemon
Resolution: | Keywords:
-------------------------+--------------------------------------------------

Comment(by murz):

Thanks!! It works, I successfully connect!
{{{
***@kit:~$ PULSE_RUNTIME_PATH=/var/run/pulse sudo -u pulse pacmd
Welcome to PulseAudio! Use "help" for usage information.
}}}
Before I don't think that sudoers configuration is important.
--
Ticket URL: <http://pulseaudio.org/ticket/222#comment:8>
PulseAudio <http://pulseaudio.org/>
The PulseAudio Sound Server
PulseAudio
2011-01-23 19:22:51 UTC
Permalink
#222: pacmd doesn't work with pulseaudio running as a system-wide daemon
-------------------------+--------------------------------------------------
Reporter: JeroenHoek | Owner: lennart
Type: defect | Status: closed
Milestone: | Component: daemon
Resolution: worksforme | Keywords:
-------------------------+--------------------------------------------------
Changes (by murz):

* status: new => closed
* resolution: => worksforme
--
Ticket URL: <http://pulseaudio.org/ticket/222#comment:9>
PulseAudio <http://pulseaudio.org/>
The PulseAudio Sound Server
Loading...