Multi-user alsa configuration

Journal started Nov 11, 2005


Ha! It only took almost a year of searching and poking, and the entire day today. I figured out how to get alsa playing with many, yes many, users.

A problem with alsa is by default if you don't have a sound card with Audigy support (remember this, shoppers) then only one program can play sound at any one time. Thankfully for us cheapskates there is dmix: a software mixing plugin. So what I initially did was configure a 'music' user to handle most of my music files, and play them using mpd. This is good, smart separation of powers. I don't want my network music player to be able to erase my journal files if it breaks, or is compromised. Unfortunately, alsa doesn't seem to agree.

Permission denied, permission denied, etc etc. Even using dmix, the following situation will occur:

I found a Gentoo wiki that claimed you could have more than one user, allowing a group to use alsa via ipc_perm 0660. Unfortunately, that does absolutely nothing. Well today I found out why.

Someone added recently to the wiki, a little keyword called ipc_key_add_uid. No explanation of course, so I never noticed it. But here I found some people saying that it adds the uid to the unique ipc_key, which needs to be unique. "Great!" thought I, "I'll just set this to true, and every user will have their own unique key!"

...nope. Turns out that option is true by default and because it is true, it prevents more than one user from accessing the same IPC semaphore. And it turns out that only one IPC semaphore is ever valid where dmix is concerned. So here's the summary of what I did to fix the broken default configuration of alsa, so that many users, multi-user, not single user, (hello Google), can play files.

My asound.conf file. Ignore the jack junk at the bottom, that's still acting screwy I think. Woo, I have music again! Music! *dances to Indian folk music*


Comment
Index
Previous (Binary Configuration)
Next (Assumptions...)

(cc) some rights reserved