[pulseaudio-discuss] Pulseaudio for two sessions at the same time
gmane at colin.guthr.ie
Thu Dec 9 02:06:00 PST 2010
'Twas brillig, and Noel David Torres Taño at 09/12/10 09:35 did gyre and
> I've a computer at home which uses to have two sessions opened at the same
> time: mine and my wife's. We use to leave both sessions opened instead of
> opening and closing sessions with each seat change. But the problem is that
> the first openes session gets sound and the other one does not: it is
> absolutely mute.
This should not generally happen. PulseAudio is designed to work at a
session level and ensure that when you switch between sessions, control
of the audio device is handed gracefully over to the other user.
All of this is actually handled at a lower level than PA. It's dealt
with by a system called Console Kit. Console Kit maintains a record of
who the "active" user is on a system (you can check via ck-list-sessions
command in a terminal). Console Kit will instruct udev to write ACLs
(access control lists) on various bits of hardware (including the sound
card) so that only the active user has permission to use them at any one
time (otherwise there could be security considerations - e.g. spying on
voip calls etc. etc.)
PA simply honours this lower level system.
Now what is happening in your case is one of three things (the last is
the most likely):
1. Console Kit is not working properly. To test this, open a session
for both users and open a terminal and type ck-list-sessions. As you
switch between the sessions, the "active" user should change.
2. Console Kit is not writing the ACLs properly. Use getfacl /dev/snd/*
in each session to ensure that the relevant user appears in the ACLs for
3. One or both of your users is in the "audio" group. This bypasses all
the nice ACL and session switching logic, but only really works if your
sound hardware supports hardware mixing or you have specific reason to
do something non-standard (see below). Just type "groups" in a terminal
to see if you are in the audio group and if so, use the appropriate
tools to remove this and then reboot (make sure you do this for both
users) and you should get smooth switching of users.
> How can we get session working in both sessions at the same time?
Well that's the important question. Do you *really* want it to work at
the same time, or do you want it to hand over gracefully when you switch
sessions. Most systems (including OSX and Windows etc. - although I've
had odd experience with Windows...) do the latter but some users want
If you fix/debug the above mentioned issues, then you'll get a nice
handover, but if you really do want both at the same time output, then
the simplest way (if you are generally always logged in) is as follows:
1. Add your user to the audio group, but not your wife.
2. Login as you.
3. Start paprefs and tick the "Enable Network Access" box.
4. Copy the file ~/.pulse-cookie to your wife's home directory (so that
you both have the same cookie file).
5. Edit/create the file ~/.pulse/client.conf in your wife's home
directory and put the line "default-server = localhost"
This will mean you run the PA daemon and your wife connects to your
daemon. You can also use a system-wide daemon but this is probably
easier and at least means one user can benefit from SHM IPC whereas with
system-wide no users can.
Tribalogic Limited [http://www.tribalogic.net/]
Mageia Contributor [http://www.mageia.org/]
PulseAudio Hacker [http://www.pulseaudio.org/]
Trac Hacker [http://trac.edgewall.org/]
More information about the pulseaudio-discuss