Proper way for a server to spawn Pulseaudio?

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

 



On Thu, 2016-09-01 at 22:14 +0200, Espen Jürgensen wrote:
> > 
> > I think starting pulseaudio at boot in the system mode makes most
> > sense for headless systems. I don't think another server-type
> > application should spawn it.
> > 
> > When your server runs under a dedicated user, autospawning should work,
> > but then you'll probably run into problems with not having access to
> > the audio hardware, because typically the device permissions are
> > handled dynamically so that only the currently-active login session has
> > access. Trying to "fix" this by making the device permissions static
> > will cause breakage, because your music server will then hog the
> > hardware so that regular users can't access it anymore. It's probably
> > best if you use the PA_CONTEXT_NOAUTOSPAWN flag in your application
> > when connecting to pulseaudio, unless your application runs inside a
> > regular user login session.
> 
> Thanks for the swift advice, I really appreciate that!
> 
> Maybe this info would be good to have in the wiki? Could add it myself,
> once I get it working.

Sure. The wiki account management is a bit weird - the easiest way to
get write access is to send your desired user name and password to me
privately. The recommended user name is FirstnameLastname.

> An extra question, hope you don't mind. What is the explanation of the
> following behavior? (Raspbian, no desktop, just straight ssh terminal)
> 
> pi at jessie ~ $ ps ax | grep pulse
> 25504 pts/0    S+     0:00 grep --color=auto pulse
> pi at jessie ~ $ paplay test.wav
> (audio plays)
> pi at jessie ~ $ sudo su -
> root at jessie:~# killall pulseaudio
> root at jessie:~# paplay test.wav
> Connection failure: Connection refused
> pa_context_connect() failed: Connection refused
> 
> Seems regular user can spawn Pulseaudio, but root can't?

Yes, autospawning is prevented for root. The reason is that the dynamic
permission management that allows smooth switching between users
doesn't work with root, because root will always have access to the
hardware. If root would autospawn for itself, that would cause
interference with other users when root is using the hardware at the
same time when other users expect to have the hardware for themselves.

-- 
Tanu


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

  Powered by Linux