[pulseaudio-discuss] How Do I avoid System Mode?

Colin Guthrie gmane at colin.guthr.ie
Mon Jun 22 00:52:25 PDT 2009


'Twas brillig, and Jim Duda at 21/06/09 17:57 did gyre and gimble:
> Hello,
> 
> I have a couple of computers which are "headless" nodes.  I run the 
> pulseaudio sound server
> on them for network audio, however, no user ever logs in.  Because of 
> this, I am forced to run the pulseaudio server in system mode.  I know 
> of all the reasons which I shouldn't be
> using system mode.  Is there some other means I can run these "headless" 
> machines to use
> pulseaudio without system mode? 

This is probably a valid case *for* using system mode, but I'll explain 
things anyway for the sake of the archives and for any other interested 
party :)


> How can I fake the the system out such 
> that they think
> a user is logged in? 

Well, you don't really need to do that. When pulse is running it will 
look at the permissions of the audio device nodes (/dev/snd/*) and 
automatically suspend and resume itself when the current user has 
permission to use them.

This kind of thing is done via ACLs in any modern distro whereby 
ConsoleKit will inform HAL that user has logged in and HAL will apply an 
ACL that says "OK this user is allowed to use the audio devices". Pulse 
handles this gracefully (unlike any direct alsa app I know off) and will 
deal with the situation nicely, allowing for user switching and other 
such high level goodies.

Now HAL is dying and in the future I believe it will ultimately be the 
job of udev to handle such things.

If you want to bypass this whole thing, you just have to make sure your 
user has the right to use the sound device nodes at all times even if 
they are not "logged in". Typically, the devices nodes will be 
read/write by anyone in the system group "audio" so the easiest way is 
to simply add your pulse user to the "audio" group.

> I haven't yet figured out how pulseaudio auto 
> starts on a system
> which a user logged into gnome. I realize it has something to do with 
> esdcompat, however,
> I don't understand the hook into gnome itself.

No, this is just to handle legacy systems. esdcompat is not really used 
on any modern system.

Pulse will start via two ways normally:

1. It will autospawn itself when the user runs an app that wants to use 
pulse and will die after a period of inactivity.
2. It will be started at X11 login via an XDG compliant .desktop file 
and remain for the duration of the X11 session.

Depending on the use case for the project your working on, you can do 
one of two things:

  1. Just use the autospawn system if the user playing audio is local to 
your machine.
  2. Create a system service script that runs pulseaudio at boot and 
keeps it there (e.g. disable the automatically dying part!) dropping 
privs first to your user so that root is not involved. (su -c 
"pulseaudio" or similar).

> Both of these headless nodes run a streamlined version of Fedora 10.  
> They don't run
> all the typcical services which a login node would run. For example, 
> they don't run
> "dbus", but they could.  I'm not sure which services matter to pulse.

The released versions of pulse expect HAL to be there which requires dbus.

Pulse from git now uses udev.

Hope this helps.

Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
   Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
   Mandriva Linux Contributor [http://www.mandriva.com/]
   PulseAudio Hacker [http://www.pulseaudio.org/]
   Trac Hacker [http://trac.edgewall.org/]




More information about the pulseaudio-discuss mailing list