# udev, /dev/sound permissions problem

## karr

With recent versions of udev(052, and 054) I have had a problem with sound not working when I first boot my computer, but if I run /etc/init.d/alsasound restart, sound starts working. I have alsa set to start at the boot runlevel. Today, I noticed something interesting about the permissions in /dev/sound when restarting alsa. Here is the output of "ls -l /dev/sound/*"

```

crw-------  1 karr audio 14, 12 Feb 26 17:32 /dev/sound/adsp

crw-------  1 karr audio 14, 28 Feb 26 17:32 /dev/sound/adsp1

crw-------  1 karr audio 14,  4 Feb 26 17:32 /dev/sound/audio

crw-------  1 karr audio 14, 20 Feb 26 17:32 /dev/sound/audio1

crw-------  1 karr audio 14,  3 Feb 26 17:32 /dev/sound/dsp

crw-------  1 karr audio 14, 19 Feb 26 17:32 /dev/sound/dsp1

crw-------  1 karr audio 14,  0 Feb 26 17:32 /dev/sound/mixer

crw-------  1 karr audio 14, 16 Feb 26 17:32 /dev/sound/mixer1

crw-------  1 karr audio 14,  1 Feb 26 17:32 /dev/sound/sequencer

crw-------  1 karr audio 14,  8 Feb 26 17:32 /dev/sound/sequencer2

```

And here is the output after /etc/init.d/alsasound restart:

```

crw-rw----  1 root audio 14, 12 Feb 26 17:40 /dev/sound/adsp

crw-rw----  1 root audio 14,  4 Feb 26 17:40 /dev/sound/audio

crw-rw----  1 root audio 14,  3 Feb 26 17:40 /dev/sound/dsp

crw-rw----  1 root audio 14,  0 Feb 26 17:40 /dev/sound/mixer

crw-rw----  1 root audio 14,  1 Feb 26 17:40 /dev/sound/sequencer

crw-rw----  1 root audio 14,  8 Feb 26 17:40 /dev/sound/sequencer2

```

Does anyone have an idea what udev config I need to change? 

Here is what I currently have in my /etc/udev/permissions.d/50-udev.permissions file for audio devices:

```

# audio devices

dsp*:root:audio:0660

audio*:root:audio:0660

midi*:root:audio:0660

mixer*:root:audio:0660

sequencer*:root:audio:0660

sound/*:root:audio:0660

snd/*:root:audio:0660

beep:root:audio:0660

admm*:root:audio:0660

adsp*:root:audio:0660

aload*:root:audio:0660

amidi*:root:audio:0660

dmfm*:root:audio:0660

dmmidi*:root:audio:0660

sndstat:root:audio:0660

```

----------

## doode

I'm having the same problem.. Can't seem to figure it out.. Anyone else?

----------

## lbrtuk

.permissions files are being phased out. You need to specify them along with the rules.

----------

## dsd

every time you login, pam is setting permissions on your device nodes (setting you as the owner, specifying its own permissions, etc). this overrides whatever udev has just set.

----------

## karr

I've made some progress on getting this to work. I removes /etc/security/console.perms, which leaves the permissions closer to correct.

```

crw-rw----  1 root audio 14, 12 Feb 26 17:32 /dev/sound/adsp

crw-rw----  1 root audio 14, 28 Feb 26 17:32 /dev/sound/adsp1

crw-rw----  1 root audio 14,  4 Feb 26 17:32 /dev/sound/audio

crw-rw----  1 root audio 14, 20 Feb 26 17:32 /dev/sound/audio1

crw-rw----  1 root audio 14,  3 Feb 26 17:32 /dev/sound/dsp

crw-rw----  1 root audio 14, 19 Feb 26 17:32 /dev/sound/dsp1

crw-rw----  1 root audio 14,  0 Feb 26 17:32 /dev/sound/mixer

crw-rw----  1 root audio 14, 16 Feb 26 17:32 /dev/sound/mixer1

crw-rw----  1 root audio 14,  1 Feb 26 17:32 /dev/sound/sequencer

crw-rw----  1 root audio 14,  8 Feb 26 17:32 /dev/sound/sequencer2 

```

But I still do not have sound. If I do /etc/init.d/alsasound resart I get the same results as before

```

crw-rw----  1 root audio 14, 12 Feb 26 17:40 /dev/sound/adsp

crw-rw----  1 root audio 14,  4 Feb 26 17:40 /dev/sound/audio

crw-rw----  1 root audio 14,  3 Feb 26 17:40 /dev/sound/dsp

crw-rw----  1 root audio 14,  0 Feb 26 17:40 /dev/sound/mixer

crw-rw----  1 root audio 14,  1 Feb 26 17:40 /dev/sound/sequencer

crw-rw----  1 root audio 14,  8 Feb 26 17:40 /dev/sound/sequencer2 

```

And sound works. One other thing I have noticed is that alsamixer shows a lot of channel being turned off, or missing in the first state, after boot. I returns to normal after resarting alsa.

----------

## Chewi

I've got this problem too but in /dev/snd, not /dev/sound. It only seems to happen to some of my device nodes though.

```
crw-------  1 root audio 116,  0 Mar  2 01:39 controlC0

crw-------  1 root audio 116, 32 Mar  2 01:39 controlC1

crw-rw----  1 root audio 116, 40 Mar  2 01:39 midiC1D0

crw-rw----  1 root audio 116, 41 Mar  2 01:39 midiC1D1

crw-rw----  1 root audio 116, 42 Mar  2 01:39 midiC1D2

crw-rw----  1 root audio 116, 43 Mar  2 01:39 midiC1D3

crw-------  1 root audio 116, 24 Mar  2 01:39 pcmC0D0c

crw-------  1 root audio 116, 16 Mar  2 01:39 pcmC0D0p

crw-rw----  1 root audio 116,  1 Mar  2 01:39 seq

crw-------  1 root audio 116, 33 Mar  2 01:39 timer
```

I didn't happen until I upgraded to udev-52. I've got udev-54 now but it's still occurring. The permissions are set correctly in 50-udev.permissions. I'm interested to hear that these files are being phased out. I did wonder what the point in them was since the permissions can be set in the rule files. Could that be the problem then? Because 50-udev.rules doesn't set any permissions for these nodes.

```
# alsa devices

SUBSYSTEM="sound", GROUP="audio"

KERNEL="controlC[0-9]*",        NAME="snd/%k"

KERNEL="hw[CD0-9]*",            NAME="snd/%k"

KERNEL="pcm[CD0-9cp]*",         NAME="snd/%k"

KERNEL="midiC[D0-9]*",          NAME="snd/%k"

KERNEL="timer",                 NAME="snd/%k"

KERNEL="seq",                   NAME="snd/%k"
```

I'll try this and let you know what happens next time I restart. I've been restarting all night and I can't be bothered to do it again right now.

----------

## nonotme

just a fyi, but running udevstart is sufficient to enable the new rules.

----------

## Epikuros

I have the same "problem" (just a slight annoyance imho). My devices are slightly different before and after the restart. Send more info soon.

----------

## Chewi

Should have replied to this ages ago. My attempt at fixing it didn't work. Grr.

----------

## Morimando

Maybe it's a problem with PAM? Did it give you some weird output lately?

I had some problems with PAM being weird when i changed my system to pure udev/Reiser4, so it's merely a guess, i'm running pam version 0.77-r8 and it works fine.

----------

## Chewi

That's what I've got but there's a newer version. Gonna try that out.

----------

## karr

I finally found the problem: coldplug. I removed it from the boot runlevel, and sound now works. Hope this helps you guys.

----------

## juniper

 *karr wrote:*   

> I've made some progress on getting this to work. I removes /etc/security/console.perms, which leaves the permissions closer to correct.
> 
> ```
> 
> crw-rw----  1 root audio 14, 12 Feb 26 17:32 /dev/sound/adsp
> ...

 

i was having the same problem with my optical device /dev/hdc and i commented out everything in /etc/security/console.perms and it all works now.

so, my question is, what is the point of /etc/security/console.perms (if i am just going to comment out everything anyways)?

j

----------

## zoltix

I have the sampe problem ......

----------

## alligator421

I had the same problem with udev and alsa.

Commenting all stuff in /etc/security/console.perms fixed the problem.

What I understand of the problem is that udev is setting all devices in /dev as root but when setting /etc/security/console.perms,

the console owner is trying make a link/node as a simple user in /dev but it can't because of the permissions. So the link below can't be made.

lrwxrwxrwx  1 root root 9 Apr 30 18:35 /dev/dsp -> sound/dsp

----------

## thepustule

Honestly!

Devfs is deprecated in the kernel.  The newest Gentoo install handbook now instructs us to use udev.  And this is how well it works?

And .permissions is "being phased out"?  What's up with that?  So the /dev filesystem we're supposed to be using still has major design decisions still in the process of being worked out?  What's wrong with this picture?

Can anyone explain to me how this is supposed to be BETTER than devfs?  At least devfs WORKED!

----------

## Chewi

I haven't been getting this problem in a long time and to be honest, I'd rather go through a few glitches in order to get udev than having to stick with devfs forever. It might have worked but it was a total mess. Let's not turn this into yet another udev vs devfs debate though.

----------

## thepustule

Fair enough...

My question wasn't so much about which is better udev or devfs, but more about the wisdom of switching gentoo when when udev seems to still be grossly unready.

Anyhow...

I noticed in /etc/security/console.perms that the line for sound is explicitly configured as 600 root.audio

What is the logic behind this?  I mean, the very fact that we have a group called "audio" - wouldn't it make sense to make it 660?  Or is this something I don't quite understand about what this file is doing?

----------

## Chewi

I don't really understand that either. A lot of the other things seem to say 660.

----------

## alligator421

mmmh. My problem was not completely resolved after all.

Beside alsa, I had still problems with my usb printer as well.

udev was creating a node /dev/usb as a file, instead of a directory thus preventing /dev/usb/lp0 from popping up.

I browsed a while to find that current udev-045 is at fault and simply sucks.

 *Quote:*   

> 
> 
> echo "sys-fs/udev ~x86" >> /etc/portage/package.keywords
> 
> 

 

It installed udev-056. No more problems with devices now.

alsa-oss /dev/dsp emulation and /dev/usb/lp0 are resolved for me.

----------

## tecknojunky

How do you get rid of this stupid audio group and simply let every user the ability to use the sound device?

----------

## Chewi

I wouldn't recommend removing the audio device but you could adjust the permissions to allow "others" to use the device. 666 instead of 660 for example.

----------

## tecknojunky

What's strange is that my Esound daemon dies on start up.  init.d will issue [OK] but when grepping th ps -ef output, esd is dead gone.  After zapping and restarting it, apps can now use sound, but before I applied your permisson hack, it'd still not work.

WHat's wrong with my sound?

----------

## Chewi

Esound is known for being very wobbly. I don't really use it. Try seeing if you can get any log output from it.

----------

## dirt

Listen to dsd... and take a look at /etc/security/console.perms file.

Thanks,

----------

## tecknojunky

I dont't know.  It seem related to when the window manager is restarted, the esd process simply dies.

I have the old e16 wm.  Maybe it's the Entrance login manager that, thinking of it, as been updated at about the same time this trouble started.  To my knowledge, Entrance does not use sounds.  Or does it?

----------

## Chewi

I use Entrance and had a peek at the code a while back. No sound in there as far as I'm aware. Maybe E16 shuts down esd when it exists? It is the Enlightened Sound Daemon, after all, though I'm not 100% sure if they're related?

----------

## tecknojunky

Well, they are related in terms of who wrote it, but the Esound deamon is wm neutral (Gnome use it too) and it's a system wide software sound mixer (even works through networks).

I'm just a bit lazy (or time pressed) to diagnose this, especially since esd zap & esd restart brings it back.  I have tones of annoyances of likes on my box, it's not one more that bothers me that much.  It's just another thing on the todo list.

----------

## palmer

I seem to have a similar problem (more wide-reaching than just the audio devices though)

People have been saying that permisions are being phased out...

I think the solution is to move (backup) the old /etc/udev/rules.d/50-udev.rules

Then replace it with the new one (it is in the same folder, just hidden)

This fixes all my problems!

-palmem

----------

