12

In the spirit of full disclosure, i just posted this question to the ubuntu forums, but i figure more heads working on it couldn't hurt.

I have a multi-seat setup working quite well. Hot plugging input devices works as expected and such. The only issue I am still not able to resolve is getting the audio for each seat.

Here is a summary of my attempts at getting audio to work:

  1. Make ~/.pulse/default.pa dynamically configured based on which $DISPLAY the user logs in at.

  2. Load pulseaudio as a system-wide instance.

    • Couldn't get this to work. None of the audio hardware was accessible to the users.
  3. Use udev rules to mark seats in ConsoleKit. Following udev guidelines found here: http://www.freedesktop.org/wiki/Software/systemd/multiseat

    • I didn't think this would work, although it was "guaranteed" to work by someone in irc.freenode #pulseaudio

None of those attempts yielded success, which is why I now turn to the community for help. It is quite possible that the suggested methods work and I just messed some aspect of it up, idk. This is the last piece of the puzzle which is needed before I can go and update the MultiseatX page to include instructions for Ubuntu 12.04.

My understandings on the situation: Access to pulseaudio is restricted to the active session as marked by ConsoleKit (something about an ACL). CK can only mark one session as active at a time. This simple little fact of life leads me to believe that the solution should involve pulseaudio being run as a system-wide instance. Each user should connect to the pulse server and be limited to a subset of all the hardware. Maybe each user connects to the pulse server via localhost, idk. I do know that regardless of my attempts and their failed results, I was always able to use sudo aplay -D plughw:0,0 /usr/share/sounds/alsa/Front_Center.wav to play something to any of the hardware.

I'm grasping at straws and am now down to the last few hairs i can pull out of my head. Please, help me figure this out so we can share the wealth. Any additional information needed will be provided at your request.

10
  • Did I understand correctly: it's 2 seats 2 soundcards? Did you replace default.pa with the tiny custom files or do add the custom lines to the otherwise unchanged default.pa?
    – Takkat
    Sep 24, 2012 at 18:52
  • I wish i would have noticed the comment here... So yes, it is 2 sound cards. One is the onboard audio, the other is the audio from the HDMI in the gpu. The tiny custom files are in ~/.pulse but /etc/pulse/default.pa is untouched. So in that case, as far as i understand, the ~/.pulse/default.pa will not replace /etc/pulse/default.pa, but rather merge with it.
    – Anthony
    Sep 24, 2012 at 23:45
  • Try with two custom .pa files with full content of the default.pa where the different device section as in the two existing files is added (in case they are not merged).
    – Takkat
    Sep 25, 2012 at 6:24
  • Also, the default.pa read by pulseaudio run in system-wide mode should be in /etc/pulse, not in HOME.
    – Takkat
    Sep 25, 2012 at 6:54
  • i have it mostly working atm. I'll report back when i have it all ironed out.
    – Anthony
    Sep 25, 2012 at 19:22

3 Answers 3

7
+100

I've spent many hours researching online, testing various setups and talking to Pulseaudio devs. The bottom line of it all is that running pulseaudio in normal user mode will allow only the active session as marked by ConsoleKit to access the audio hardware. Since current ConsoleKit is only able to mark one session as active at a time, this means that we must run a system-wide instance of pulseaudio. The upside: Each seat can have individual audio. The downside: ALL audio hardware is available to any user and can be manipulated AT WILL. This is not an ideal situation for an internet cafe or other public setting where security is a real concern. Keep this in mind when creating your site security policy. It might be prudent to restrict pavucontrol execution to admins only.

As always, make a backup of all of your default config files. If you have tinkered with your configs without backing up, you may retrieve the pulseaudio package with apt-get -d install pulseaudio. This will download the package (to /var/cache/archives/apt) only and you can extract the contents to retrieve the default configs. Be aware that client.conf is not included in there.

To run pulseaudio as a system-wide daemon, we need to edit a few files.

1.) /etc/default/pulseaudio

    PULSEAUDIO_SYSTEM_START=1

2.) /etc/pulse/daemon.conf - See man pulse-daemon.conf for more information.

    daemonize = yes
    local-server-type = system

3.) /etc/pulse/client.conf

    autospawn = no

We also need to add users to the pulse-access group.

sudo usermod -a -G pulse-access <username>

Now that all users are able to access the audio hardware, we need to select the hardware each user will use. This can be done using pavucontrol. Please be aware that the settings are stored PER USER and will not follow the seat. If users switch seats, you will need to re-select the desired audio hardware.

Additional Comments on Pulseaudio

I had hoped that there would be a more elegant solution for getting per seat audio working. Using a systemwide Pulseaudio in multiseat has many drawbacks and is not entirely stable between reboots. I had attempted to start a systemwide instance and have user instances connect to it as a server via localhost. That doesn't seem to work since when pulseaudio --start is run it sources daemon.conf.

Regarding ConsolKit

The issue we see when running a normal per-user pulseaudio is that one seat has access to the hardware and all others have Dummy Output. This is due to ConsoleKit not being entirely seat aware. CK considers all of our seats as sessions of seat1 and can only mark one session as active. This fact can be seen by running getfacl /dev/snd/*. The thought occurred to me that we might be able to edit the acl of the appropriate /dev/snd/ files based on which $DISPLAY a particular user is using. This is an option that I have not explored. Please consider contributing to the multiseat cause by exploring this hypothesis and editing the document with your findings.

Multiseat branches for ConsoleKit, GDM-2.3 and GDM-3.x do exist which should provide for automatic multiseat functionality.

Additional Notes

1.) It would be wise to also disallow users from loading modules DISALLOW_MODULE_LOADING=1.

2.) autospawn = no is not entirely necessary as seen in my example file. It causes no issues.

1
  • 1
    Anthony, thanks for your post it was helpful! I faced the same issue and found out how to achieve desired result without running Pulseaudio in System Mode. Take a look: unix.stackexchange.com/a/104344/34581. I hope it will be useful.
    – Ilia Ross
    Dec 9, 2013 at 9:20
1

My understandings on the situation: Access to pulseaudio is restricted to the active session as marked by ConsoleKit (something about an ACL). CK can only mark one session as active at a time.

There is a patch to ConsoleKit to add multiseat support; this will allow it to report all active seats as active. Perhaps this will fix your problem. It needs cooperation with the display manager, and there is a patch to old versions of GDM that adds this support.

I got multiseat working in Natty (11.04) using modified ConsoleKit and GDM packages from a PPA. I haven't upgraded from Natty yet -- it took me a long time to figure out how to get it to work, and I'm worried that LightDM won't work with the patched ConsoleKit.

EDIT: I should note that Fedora 17 has some impressive multiseat features, some of which will be in Quantal. They have a wiki page describing their approach. Ubuntu can't simply copy Fedora's approach because it would require significant changes; Fedora uses systemd and GDM while Ubuntu uses upstart and LightDM.

1
  • Lol. I've known about the multiseat ConsoleKit and GDM branches. You'll notice that I linked to them in the Ubuntu MultiseatX page that I'm in the process of updating. Actually, the ck branch depends on the gdm branch. They are maintained by the same person from Oracle. The PPA you referenced is also something I've known about and isn't for 12.04. I'm trying to do it in a way that doesn't involve going outside of the standard repos. Regarding Fedora and systemd... the systemd multiseat approach will NOT work with the nvidia binary.
    – Anthony
    Oct 2, 2012 at 1:33
1

I recently was trying to solve the issue with PulseAudio and Multiseat. Seeing that there was no elegant solution, my workaround was to use network.

This solution suits my scenario because I am the user which most often is in the machine and my seat is most often logged in. And my seat is left-handed configured and nobody else uses it.

In my ~/.config/pulse/default.pa I copied the system configuration of /etc/pulse/default.pa and added the following line:

load-module module-native-protocol-tcp auth-anonymous=1 auth-ip-acl=127.0.0.1

In other users' pulseaudio settings, add a tunnel --or several ones, if that's what you need-- with something along:

load-module module-tunnel-sink server=127.0.0.1 sink=alsa_output.pci-0000_00_XX.X.iec958-stereo

Change the sink name to match the one in your machine. You can decide to configure a friendlier name --which means that you should configure that in your pulseaudio settings file-- but I just used the given name by looking it with pacmd list-sinks.

It's not an elegant solution, I will probably try to use a system-wide configuration as suggested by @Anthony in my next rig, but if you have a lot of cards and just want to share one or few sink/source, this is a more "surgical" solution.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .