how to Start a pulseaudio application as a daemon with systemd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2018-05-19 at 18:04 +0200, Christophe Lohr wrote:
> Le 19/05/2018 à 16:44, Tanu Kaskinen a écrit :
> > 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)

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

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


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux