[pulseaudio-discuss] how to Start a pulseaudio application as a daemon with systemd
Tanu Kaskinen
tanuk at iki.fi
Sun May 20 11:28:19 UTC 2018
On Sat, 2018-05-19 at 22:32 +0200, Christophe Lohr wrote:
> Le 19/05/2018 à 18:47, Tanu Kaskinen a écrit :
> > Since the address contains the machine id, I'm pretty sure the address
> > is from the X server.
>
> Bingo! That's it!
> In fact, I'm managing this via a ssh -X
> (the idea is to manage audio applications on the distant machine, not on
> the local one)
>
> $ unset DISPLAY
> $ 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 /var/run/pulse/native...
> Failed to open cookie file '/home/clohr/.config/pulse/cookie': No such
> file or directory
> Failed to load authentication key '/home/clohr/.config/pulse/cookie': No
> such file or directory
> Failed to open cookie file '/home/clohr/.pulse-cookie': No such file or
> directory
> Failed to load authentication key '/home/clohr/.pulse-cookie': No such
> file or directory
> Got 0 bytes from cookie file '/home/clohr/.config/pulse/cookie',
> expected 256
> SHM possible: yes
> Protocol version: remote 32, local 32
> Negotiated SHM: no
> Memfd possible: yes
> Negotiated SHM type: private
>
> This seems ok, isn't it?
> But why does the client tries X11 stuff despite '/etc/pulse/client.conf'
> which says 'default-server = /var/run/pulse/native' ?
I don't know, maybe the thinking was that the variables in X are sort
of similar to environment variables, so they should override the
configuration file. I agree with you that it doesn't seem like a very
good idea. I'll send a patch that changes the ordering.
> > I don't know what you mean by "via pam.d", though.
>
> This:
>
> $ 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
>
>
> this due to /etc/pam.d/systemd-user & co. isn't it ?
> /usr/lib/systemd/user/pulseaudio.socket
> /usr/lib/systemd/user/sockets.target.wants/pulseaudio.socket
Yes.
> (systemd includes too much sorcery for me)
>
> > 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.
>
> Should I disable module-x11-publish ?
No, you can't disable it. Not cleanly, anyway. You could remove it from
/usr/bin/start-pulseaudio-x11... But what I think you should do is
disabling the pulseaudio user service in systemd, using the command
that I already gave:
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.
--
Tanu
https://liberapay.com/tanuk
https://www.patreon.com/tanuk
More information about the pulseaudio-discuss
mailing list