Tuesday, November 18, 2008

A fix for: alsamixer: function snd_ctl_open failed for default: No such device

I recently setup Ubuntu Server 8.10 with RAID and LVM which I plan to use as a file server among other things. 

I also wanted to be able to play audio with the machine since my decent speakers are still attached to this machine. 

So, I installed alsa and pulse audio. You can find that advice on many websites.  Ubuntu has quite a bit of good documentation. That wasn't the tough part.

When I tried to invoke alsamixer this is what I would get:

alsamixer: function snd_ctl_open failed for default: No such device

There are lots of posts about this issue but I didn't find any answers.

Luckily I used to use Slackware; if you don't know Slackware is mainly configured via command line only so I had setup alsa by hand before, albeit quite a while ago. And I recalled that /dev/dsp is going to be owned by root by default. On Ubuntu /dev/dsp is owned by root:audio.

Which means if you aren't root, or in the audio group, the system won't be able to see /dev/dsp.

So, I added my user to the audio group and everything worked after that.

Hope this helps someone.

Cheers,
Yoyar.

Addendum: If you alter the groups you are in, which you have to do as root, you then want to logout from your regular user (i.e. yoyar) and then log back in. This will allow the system to see that you are in the new group (i.e. audio). Otherwise, the system will still behave as if you are not in the audio group.  Just logout and log back in and it'll work.