Tuesday, March 2, 2010

Pausing music when switching users in Ubuntu (Karmic and Lucid)

If you want to have a user, which currently uses the display, to have access to the sound device with all the benefits from pausing upon user switch, you need to uncheck 'Use audio devices' privileges for this user (System->User Settings->Advanced->User Priviledges).

As a matter of fact I unchecked it for all my users. These privileges are very confusing then. I guess their proper interpretation is that if:
- checked: the user locks the audio device as long as he wants, no sound switching upon user switching,
- unchecked: the user which currently uses the display has access to the audio device, sound switching takes place upon user switching.

The problem is more general and it regards permissions to access certain devices (and files in /dev directory). Historically if a user needs access to particular device he is assigned to a group which group-owns the device file. It has worked for ages in the unix world i.e. access to an audio device, cdrom, cd burner etc.

This group based approach has several well known limitations. Now it seems that such an access is controlled by consolekit/policykit/udev, which makes some sense, at least because of the dynamic nature of /dev directory. The gnome-system-tools and especially users-admin seem not to know anything about acl. I'm not sure whether it's good or bad - it depends, espoecially that gnome is cross platform - on other systems /dev might be static or there might be no acl at all.

See  https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/433654 for more details.
And some discussion here: http://ubuntuforums.org/showthread.php?t=1420051

Mind that the sound switching worked fine in previous Ubuntu release (Jaunty).