I can get Aplay to play a wav file, but only if I use :
sudo aplay <file>
without sudo, I get :
aplay: main:788: audio open error: Device or resource busy.
Any suggestions on how I get aplay to work without sudo (the wav file is owned by the pi user).
I'm running Stretch on a Pi 3
Thanks
Adrian
Didn't find your answer? Ask the community — no account required.
T
The Natural Philosopher
Ah. I remember this one. If I remember its a permissions issue on the audio device. I think you can solve it by making the user and the devices groups overlap
here is my pi's /etc/group entry....
audio:x:29:me,www-data,pulse,root
I seemed to need all that to get audio to work OK for all the users needing to invoke it
A
Adrian
Thanks, but that doesn't seem to have solved the problem. My pi user already had the audio group amongst many others.
Adrian
C
Chris Elvidge
What do these say? aplay -l amixer contents
C
Chris Elvidge
Also: ls -l /dev/snd/
A
Adrian
In message <sqagcb$t4d$ snipped-for-privacy@dont-email.me, Chris Elvidge snipped-for-privacy@mshome.net writes
total 0 drwxr-xr-x 2 root root 60 Dec 26 14:00 by-path crw-rw----+ 1 root audio 116, 0 Dec 26 14:00 controlC0 crw-rw----+ 1 root audio 116, 16 Dec 26 14:00 pcmC0D0p crw-rw----+ 1 root audio 116, 1 Dec 26 14:00 seq crw-rw----+ 1 root audio 116, 33 Dec 26 14:00 timer
Thanks
Adrian
C
Chris Elvidge
Sorry: card 0: sndrpihifiberry [snd_rpi_hifiberry_dac], device 0: HifiBerry DAC Can't help - no experience with this, only with on-board HDMI/Headphones
A
Adrian
In message <sqapij$lh2$ snipped-for-privacy@dont-email.me, Chris Elvidge snipped-for-privacy@mshome.net writes
So you need to disable onboard and use hifiberry-dac for that card
But I suspect you have done this..or aplay -l wouldnt show the device....Hmm...
Does the *file* you are trying to play have the right permissions?
A
A. Dumas
This is almost certainly not the cause of your problem but I think you should bite the bullet anyway and make a new sd card with the latest RaspiOS Bullseye. Stretch is now 2 versions out of date and the Raspberry Pi Foundation (or is it the Inc.?) only supports the latest release. So that should cover you in case anything else pops up.
A
Adrian
In message <sqaucr$ftp$ snipped-for-privacy@dont-email.me, The Natural Philosopher snipped-for-privacy@invalid.invalid writes
Not sure, but I installed using the instructions here :
formatting link
tinyurl.com/2p8apjvx if the wrapping mangles the URL
Thanks
Adrian
A
Adrian
In message <sqavff$ldq$ snipped-for-privacy@dont-email.me, The Natural Philosopher snipped-for-privacy@invalid.invalid writes
Already done
I've added the first, the second was already there.
Having made that change, I've rebooted, and still Device or resource busy, but works fine if I use sudo.
Yes, I'm running as "pi", and the file is owned/group by pi with rw-r--r--
Thanks
Adrian
T
The Natural Philosopher
That does not appear to be for your hardware.
A
A. Dumas
I think that was just another line from his config file, not relevant to this issue.
T
The Natural Philosopher
So there is no fundamental issue with missing drivers.
Hmm.
It looks like somehow the /dev/snd perms are wrong, but I am struggling to see what difference your setup is from mine
I tested it and I can play with myself as the user.
$ ls -l /dev | grep snd drwxr-xr-x 3 root root 140 Dec 9 13:42 snd
$ ls -l /dev/snd total 0 drwxr-xr-x 2 root root 60 Dec 9 13:42 by-path crw-rw---- 1 root audio 116, 0 Dec 9 13:42 controlC0 crw-rw---- 1 root audio 116, 16 Dec 9 13:42 pcmC0D0p crw-rw---- 1 root audio 116, 1 Dec 9 13:17 seq crw-rw---- 1 root audio 116, 33 Dec 9 13:42 timer
$ grep audio /etc/group
audio:x:29:me,www-data,pulse,root
that's my setup that works.
I think I had to add myself to get it to work from my user command line, and www-data to get it to work when invoked by the apache webserver, which is how I control the sound system...or else write a setuid program...
See if yours differs at all.
T
The Natural Philosopher
I think it is...
but can't find out why.. oh it disables bluetooth and is recommended somewhere for better wifi, which I had issues with.
My bad.
formatting link
is I think how I got mine working BUT I am fairly sure I wouldn't have stuck myself and www-data into the audio group without good reasons. In short I think I had this problem and that is how I fixed it.
Anyway if I can get Adrian to a working config by duping mine, it's a result.
A
Adrian
In message <sqcgns$740$ snipped-for-privacy@dont-email.me, The Natural Philosopher snipped-for-privacy@invalid.invalid writes
Times and dates aside, my /dev/snd appears to be the same as yours. Oh hang on, there is a difference. The four entries with permissions starting "c" all have permissions of crw-rw----+
The audio group is :
audio:x:29:pi
I only need it to work for the pi user, so that should be OK.
Thanks
Adrian
A
Adrian
Curious. I got the hardware from PiHut, and that was the site that they gave for the setup.
Adrian
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required
Report Content
You are reporting this content to the moderators. They will look at it
ASAP.