ALSA device not found by some users... why?

View: New views
3 Messages — Rating Filter:   Alert me  

ALSA device not found by some users... why?

by Tim Black-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

ALSA device not found by some users... why?

Some users on my Fedora Core 8 system cannot seem to access any ALSA devices, while some can:

[tim@servy ~]$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: AudioPCI [Ensoniq AudioPCI], device 0: ES1371/1 [ES1371 DAC2/ADC]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: AudioPCI [Ensoniq AudioPCI], device 1: ES1371/2 [ES1371 DAC1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: AudioPCI_1 [Ensoniq AudioPCI], device 0: ES1371/1 [ES1371 DAC2/ADC]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: AudioPCI_1 [Ensoniq AudioPCI], device 1: ES1371/2 [ES1371 DAC1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: I6300ESB [Intel 6300ESB], device 0: Intel ICH [Intel 6300ESB]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: I6300ESB [Intel 6300ESB], device 4: Intel ICH - IEC958 [Intel 6300ESB - IEC958]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

while:

[tim@servy ~]$ su mpd2
Password:
[mpd2@servy tim]$ aplay -l
**** List of PLAYBACK Hardware Devices ****
<empty list>

User mpd2 needs access to ALSA devices bc I'm running MPD (music player daemon) as this user. When this daemon tries to access ALSA device hw:0,0, it gets an "Error opening ALSA device: hw:0,0 No such device" error.  (But if I run the daemon as 'tim' or root there are no such errors.)

I created a new "audio" group, made all sound devices (/dev/snd/, /dev/dsp*, /dev/audio*) accessible to the "audio" group members, and added the mpd2 user to this group, but I still get the same errors. In fact, the only way I've been able to get past the permission problem is to put the new users into the root group, which is not an acceptable solution to me.

So this seems very much like a case of bad ALSA device permissions, but I don't know what else I can do to fix it. Do you? What am I missing?

The /proc/asound filesystem seems to be fully populated and accessible by both tim and mpd2. My ALSA Driver Version is 1.0.15 (Tue Nov 20 19:16:42 2007 UTC).

Since I'm using FC8, I was beginning to think that PulseAudio was behind this. I've followed the threads on FC8 audio problems, but none of the suggested solutions have worked for me. (I have ConsoleKit and avahi daemons running and have removed alsa-plugins-pulseaudio and am still getting the same errors.)

I would appreciate any suggestions or clues anyone might have.
Thanks,
Tim


BIAMP SYSTEMS EMAIL NOTICE 
The information contained in this email and any attachments is confidential and 
may be subject to copyright or other intellectual property protection. If you 
are not the intended recipient, you are not authorized to use or disclose this 
information, and we request that you notify us by reply mail or telephone and 
delete the original message from your mail system.

_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@...
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user

Re: ALSA device not found by some users... why?

by Clemens Ladisch-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Tim Black wrote:
> User mpd2 needs access to ALSA devices bc I'm running MPD (music
> player daemon) as this user. When this daemon tries to access ALSA
> device hw:0,0, it gets an "Error opening ALSA device: hw:0,0 No such
> device" error.  (But if I run the daemon as 'tim' or root there are
> no such errors.)

When the device nodes in /dev/snd/ are created dynamically (with udev),
it's possible that their permissions are set by the udev rules and do
not come from the directory.

When you log in as mpd2, what are the permissions of the files in
/dev/snd/?  Do you get the expected result when doing "cat
/dev/snd/pcmC0D0c"?  (The expected result is "file descriptor in bad
state".)

> BIAMP SYSTEMS EMAIL NOTICE
> The information contained in this email and any attachments is confidential and
> may be subject to copyright or other intellectual property protection. If you
> are not the intended recipient, you are not authorized to use or disclose this
> information, and we request that you notify us by reply mail or telephone and
> delete the original message from your mail system.

*** DISCLAIMER ***
This e-mail contains public information intended for any subscriber of
this mailing list and for anybody else who bothers to read it; it will
be copied, disclosed and distributed to the public.  If you think you
are not the intended recipient, please commit suicide immediately.
These terms apply also to any e-mails quoted in, referenced from, or
answering this e-mail, and supersede any disclaimers in those e-mails.
Additionally, disclaimers in those e-mails will incur legal processing
fees of $42 per line; you have agreed to this by reading this
disclaimer.
*** END OF DISCLAIMER ***


Regards,
Clemens
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@...
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user

Parent Message unknown Re: ALSA device not found by some users... why?

by Tim Black-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks, Clemens. Right, initially /dev/snd/*, /dev/dsp*, and
/dev/audio* permissions were 600 root:root, and this is presumably set
by udev. In this state, mpd2 could not access the devices, but if when
I added mpd2 user to the root group it could, providing a somewhat
insecure kludgey solution to my problem. So I keep looking for another
solution...

Then I added the following lines to my
/etc/security/console.perms.d/50-default.perms:

<sound>=/dev/dsp* /dev/snd/* /dev/audio*
<console>  0666 <sound>      0600 root.audio

and now the permissions are 0666 root.audio by default. When I log in
as user tim, it appears that the permissions get changed to 0666
tim.audio. This should still be fine, bc my mpd2 user is in the audio
group, so *should* have read/write access. When I su mpd2, the
permissions listed are the same, but mpd2 can't access the devices. I
haven't tried actually logging in as mpd2 bc I didn't think it would
be any different. I will try that later, but this may all be a moot
point bc mpd2 is basically going to be a "server-only" user, with
SHELL=/sbin/nologin, so for all this, I've modified the user to use
bash just for testing purposes.

Interestingly, as mpd2, I get permission denied error when try to
access /dev/snd/pcmC0D0c, but as tim I get the expected error:

[mpd2@servy tim]$ ls -la /dev/snd
total 0
drwxr-xr-x   2 root root      460 2008-02-06 22:17 .
drwxr-xr-x  15 root root     4520 2008-02-06 22:17 ..
crw-rw-rw-+  1 tim  audio 116, 17 2008-02-06 22:17 controlC0
crw-rw-rw-+  1 tim  audio 116, 22 2008-02-06 22:17 controlC1
crw-rw-rw-+  1 tim  audio 116, 12 2008-02-06 22:17 controlC2
crw-rw-rw-   1 tim  audio 116,  4 2008-02-06 22:17 controlC3
crw-rw-rw-+  1 tim  audio 116, 13 2008-02-06 22:17 midiC0D0
crw-rw-rw-+  1 tim  audio 116, 18 2008-02-06 22:17 midiC1D0
crw-rw-rw-   1 tim  audio 116,  3 2008-02-06 22:17 midiC3D0
crw-rw-rw-+  1 tim  audio 116, 16 2008-02-06 22:17 pcmC0D0c
crw-rw-rw-+  1 tim  audio 116, 15 2008-02-06 22:17 pcmC0D0p
crw-rw-rw-+  1 tim  audio 116, 14 2008-02-06 22:17 pcmC0D1p
crw-rw-rw-+  1 tim  audio 116, 21 2008-02-06 22:17 pcmC1D0c
crw-rw-rw-+  1 tim  audio 116, 20 2008-02-06 22:17 pcmC1D0p
crw-rw-rw-+  1 tim  audio 116, 19 2008-02-06 22:17 pcmC1D1p
crw-rw-rw-+  1 tim  audio 116, 11 2008-02-06 22:17 pcmC2D0c
crw-rw-rw-+  1 tim  audio 116, 10 2008-02-06 22:17 pcmC2D0p
crw-rw-rw-+  1 tim  audio 116,  9 2008-02-06 22:17 pcmC2D1c
crw-rw-rw-+  1 tim  audio 116,  8 2008-02-06 22:17 pcmC2D2c
crw-rw-rw-+  1 tim  audio 116,  7 2008-02-06 22:17 pcmC2D3c
crw-rw-rw-+  1 tim  audio 116,  6 2008-02-06 22:17 pcmC2D4p
crw-rw-rw-+  1 tim  audio 116,  5 2008-02-06 22:17 seq
crw-rw-rw-+  1 tim  audio 116,  2 2008-02-06 22:17 timer
[mpd2@servy tim]$ cat /dev/snd/pcmC0D0c
cat: /dev/snd/pcmC0D0c: Permission denied [mpd2@servy tim]$ exit exit
[tim@servy ~]$ cat /dev/snd/pcmC0D0c
cat: /dev/snd/pcmC0D0c: File descriptor in bad state

An interesting observation is that when the sound devices were owned
by root:root, when I add mpd2 user to root group, mpd2 can access the
sound devices. But when I change the sound device to be owned by
root:audio, adding the mpd2 user to audio group doesn't allow mpd2 to
access the devices! This tells me that there's more to this than the
device permissions. Any ideas?

Tim

-----Original Message-----
From: linux-audio-user-bounces@... on behalf of Clemens Ladisch
Sent: Thu 2/7/2008 12:18 AM
Cc: linux-audio-user@...
Subject: Re: [LAU] ALSA device not found by some users... why?

Tim Black wrote:
> User mpd2 needs access to ALSA devices bc I'm running MPD (music
> player daemon) as this user. When this daemon tries to access ALSA
> device hw:0,0, it gets an "Error opening ALSA device: hw:0,0 No such
> device" error.  (But if I run the daemon as 'tim' or root there are no
> such errors.)

When the device nodes in /dev/snd/ are created dynamically (with
udev), it's possible that their permissions are set by the udev rules
and do not come from the directory.

When you log in as mpd2, what are the permissions of the files in
/dev/snd/?  Do you get the expected result when doing "cat
/dev/snd/pcmC0D0c"?  (The expected result is "file descriptor in bad
state".)

Regards,
Clemens
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@...
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@...
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user