Many thanks for your advice. The 'system-wide' strategy is the solution
to my problem.
https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/SystemWide/
https://gist.github.com/awidegreen/6003640
https://fhackts.wordpress.com/2017/07/01/running-pulseaudio-system-wide-with-pacmd-on-arch/
This seems ok now!
hum hum... in fact, no :-(
this doesn't work so much (my first tests were probably not consistent)
I don't know if clients can't reach the server, or if the server rejects
connection
$ pacat
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
What does this means?
How may I get more detailed log messages? (from clients, from server) A
way to monitor the activity of the server?
The server is executed as follow:
$ pgrep -a pulseaudio
19813 /usr/bin/pulseaudio --system --disallow-exit --realtime
--log-target=journal --daemonize=no
/etc/pulse/client.conf contains:
default-server = /var/run/pulse/native
autospawn = no
I am member of the 'pulse-acces' group:
$ id
uid=1001(clohr) gid=1001(clohr)
groups=1001(clohr),27(sudo),29(audio),110(wireshark),114(pulse-access)
So, what's wrong?
Any idea is welcome
Best regards
Christophe
Post by Christophe Lohr
Many thanks for your advice. The 'system-wide' strategy is the solution
to my problem.
https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/SystemWide/
https://gist.github.com/awidegreen/6003640
https://fhackts.wordpress.com/2017/07/01/running-pulseaudio-system-wide-with-pacmd-on-arch/
This seems ok now!
hum hum... in fact, no :-(
this doesn't work so much (my first tests were probably not consistent)
I don't know if clients can't reach the server, or if the server rejects
connection
$ pacat
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
What does this means?
How may I get more detailed log messages? (from clients, from server) A
way to monitor the activity of the server?
"Connection refused" means that pacat couldn't find the socket file of
the server. You can run "PULSE_LOG=99 pacat" to see where pacat tries
to find the socket, and compare it to "sudo netstat -lxp | grep pulse".
The latter command should show all socket locations that any pulseaudio
instance is listening on.
Post by Christophe Lohr
$ pgrep -a pulseaudio
19813 /usr/bin/pulseaudio --system --disallow-exit --realtime
--log-target=journal --daemonize=no
default-server = /var/run/pulse/native
autospawn = no
Setting default-server should be unnecessary. If libpulse can't connect
to the per-user daemon, it should automatically try the system-wide
socket location.
--
Tanu
https://liberapay.com/tanuk
https://www.patreon.com/tanuk
Post by Tanu Kaskinen
You can run "PULSE_LOG=99 pacat" to see where pacat tries
to find the socket,
$ PULSE_LOG=99 pacat
Parsing configuration file '/etc/pulse/client.conf'
Parsing configuration file
'/etc/pulse/client.conf.d/00-disable-autospawn.conf'
Using shared memfd memory pool with 1024 slots of size 64.0 KiB each,
total size is 64.0 MiB, maximum usable slot size is 65472
Trying to connect to
{51a261c88a763f7966ea19eb4a450bb2}unix:/run/user/1000/pulse/native...
parsing address failed:
{51a261c88a763f7966ea19eb4a450bb2}unix:/run/user/1000/pulse/native
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
Why does it look at /user/1000 ?
I'm user 1001 !
$ id
uid=1001(clohr) gid=1001(clohr)
groupes=1001(clohr),27(sudo),29(audio),110(wireshark),114(pulse-access)
Post by Tanu Kaskinen
and compare it to "sudo netstat -lxp | grep pulse".
The latter command should show all socket locations that any pulseaudio
instance is listening on.
$ sudo netstat -lxp | grep pulse
unix 2 [ ACC ] STREAM LISTENING 474424
23106/systemd /run/user/65534/pulse/native
unix 2 [ ACC ] STREAM LISTENING 477788
23070/systemd /run/user/33/pulse/native
unix 2 [ ACC ] STREAM LISTENING 720251
8555/systemd /run/user/1000/pulse/native
unix 2 [ ACC ] STREAM LISTENING 855796
11301/pulseaudio /run/pulse/native
If I understand well, the last line corresponds to the pulseaudio server
I started in "system whide" mode
The former lines correspond to sockets monitored by systemd for sessions
of users, via pam.d
isn't it?
Post by Tanu Kaskinen
Post by Christophe Lohr
$ pgrep -a pulseaudio
19813 /usr/bin/pulseaudio --system --disallow-exit --realtime
--log-target=journal --daemonize=no
default-server = /var/run/pulse/native
autospawn = no
Setting default-server should be unnecessary. If libpulse can't connect
to the per-user daemon, it should automatically try the system-wide
socket location.
Post by Christophe Lohr
Post by Tanu Kaskinen
You can run "PULSE_LOG=99 pacat" to see where pacat tries
to find the socket,
$ PULSE_LOG=99 pacat
Parsing configuration file '/etc/pulse/client.conf'
Parsing configuration file
'/etc/pulse/client.conf.d/00-disable-autospawn.conf'
Using shared memfd memory pool with 1024 slots of size 64.0 KiB each,
total size is 64.0 MiB, maximum usable slot size is 65472
Trying to connect to
{51a261c88a763f7966ea19eb4a450bb2}unix:/run/user/1000/pulse/native...
{51a261c88a763f7966ea19eb4a450bb2}unix:/run/user/1000/pulse/native
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
Why does it look at /user/1000 ?
I'm user 1001 !
$ id
uid=1001(clohr) gid=1001(clohr)
groupes=1001(clohr),27(sudo),29(audio),110(wireshark),114(pulse-access)
Since the address contains the machine id, I'm pretty sure the address
is from the X server. When starting a graphical session,
/etc/xdg/autostart/pulseaudio.desktop tells the session manager to run
start-pulseaudio-x11, which is a shell script that will load module-
x11-publish, which will store the server's socket address in the root X
window. libpulse will read the address from the root window if it's set
there. My guess is that you're using user 1000 to start X, and then
doing stuff under user 1001 using the same X session in some kind of
sandbox (I'm guessing you're using a sandbox, because the "parsing
address failed" error can only happen if user 1001 can't read
/etc/machine_id or the machine id in the socket address doesn't match
/etc/machine_id).
Post by Christophe Lohr
Post by Tanu Kaskinen
and compare it to "sudo netstat -lxp | grep pulse".
The latter command should show all socket locations that any pulseaudio
instance is listening on.
$ sudo netstat -lxp | grep pulse
unix 2 [ ACC ] STREAM LISTENING 474424
23106/systemd /run/user/65534/pulse/native
unix 2 [ ACC ] STREAM LISTENING 477788
23070/systemd /run/user/33/pulse/native
unix 2 [ ACC ] STREAM LISTENING 720251
8555/systemd /run/user/1000/pulse/native
unix 2 [ ACC ] STREAM LISTENING 855796
11301/pulseaudio /run/pulse/native
If I understand well, the last line corresponds to the pulseaudio server
I started in "system whide" mode
The former lines correspond to sockets monitored by systemd for sessions
of users, via pam.d
isn't it?
Yes, pretty much (I don't know what you mean by "via pam.d", though).
If you're using the system-wide mode, I think it's best to disable all
per-user pulseaudio services in systemd. I'm not sure how to do that,
maybe "sudo systemctl --global disable pulseaudio.socket
pulseaudio.service" does the trick. This should also prevent the wrong
address getting stored in X, because when start-pulseaudio-x11 tries to
load module-x11-publish, that will fail because systemd didn't start a
pulseaudio daemon for the user.
--
Tanu
https://liberapay.com/tanuk
https://www.patreon.com/tanuk
But what I think you should do is
disabling the pulseaudio user service in systemd, using the command
sudo systemctl --global disable pulseaudio.socket pulseaudio.service
If you are using pulseaudio in the system-wide mode, you don't want
systemd starting user instances as well.
done! ;-)
Many thanks for your guidance.
The wiki page about "pulseaudio as system-wide" may be extended with
systemd materials ;-)
<https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/SystemWide/>
... how to write a new pulseaudio.service, how to enable it, how to
disable user service, etc.
Rather than just document how to write pulseaudio.service for the
system mode, we should provide and install that by default (but not
enable).
Regarding disabling the user services - yeah, I'll add that to the wiki
page. Thanks for pointing that out!
--
Tanu
https://liberapay.com/tanuk
https://www.patreon.com/tanuk