[pulseaudio-discuss] ubuntu usb "desktop-server" with single user and constant audio feed from mpd

Colin Guthrie gmane at colin.guthr.ie
Fri Sep 16 04:35:54 PDT 2011


'Twas brillig, and Martin Hamant at 16/09/11 10:19 did gyre and gimble:
> Hi there,
> 
> I need to setup a server that permanently plays audio by mpd thru
> pulseaudio. With or without X/gnome started. Means pulseaudio and mpd
> should start before the graphical part.
> There will be only one unique user on this box.
> 
> using Ubuntu 10.04 LTS, pulseaudio daemon starts thanks to the
> auto-spawn feature, when a gnome user logs in -  the issue is,  if I
> start mpd (or any software that use pulseaudio) before gnome, it'll
> spawn a pulseaudio daemon that belongs to the mpd user. So I get two
> pulseaudio instances: one which belongs to mpd, the other to my unique
> system user... But here I need my system user to "supervise" volumes and
> pulseaudio properties for the whole system !
> 
> if I delay mpd startup (by modifying init.d script....), all's going
> well - as it connects to the existing pulseaudio instance. But I don't
> feel good about that  "strap".
> 
> In a common usage you won't really notice what I describe here, but as I
> am running this ubuntu from a USB stick, there is a period of time
> before gnome starts where any program that use pulseaudio will start its
> own instance.
> 
> Of course the solution that comes in mind is System Mode. Not good.
> Second: delays => not good
> So... What is the best pratice to do that ? Is running mpd as the user
> which runs the gnome session is a working /or good solution ?
> 
> Thanks !!

OK, so the long term solution is for Ubuntu to switch to systemd (I'm
sure they will eventually) and then use the login lingering feature of
session management to allow certain user processes to start before the
user has logged in (this is specifically designed for situations like
sharing files via network with Rygel).

This feature could be extended to PA but it does come with some
complications. Only the "active" user is allowed access ot audio. When
the login manager is present this is GDM (of course Ubunutu are also
potentially going to use lightdm which will be broken in all sorts of
ways until they start running a full session (which I think was the
whole reason to use it in the first place... so don't know what's going
on there).

Now if the login manager wants to use sounds (e.g. for feedback/earcandy
etc.) then it needs to have it's own PA.

But, regardless of the above complications, running mpd as a user
lingered processes is likely the best route forward.



As a secondary solution for you now, what I'd recommend is the following:

 1. Add your user to the "audio" group. THis means you'll always have
the right to use the audio devices on your system even when not logged
in. This comes with some drawbacks (like gdm user not being able to
access the device when you've got it open with mpd) but in a single
(real) user system, this isn't too bad.

 2. Run mpd as you, not as an "mpd" user.


With this setup things should (mostly) work OK for you.


The alternative is to use system wide mode but then you won't get the
benefits of e.g. SHM and module loading etc. etc. without doing quite a
few tweaks.

Col






-- 

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

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]



More information about the pulseaudio-discuss mailing list