26 June
2014

chmod solution included

When I tried to play audio on the Raspberrypi using mpg123, I could only do so as the superuser. Unless I was root, I got the following errors:

mpg123 -l 6 -g 200 18000.mp3
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layer 1, 2, and 3.
Version 0.3.2-1 (2012/03/25). Written and copyrights by Joe Drew,
...
ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
ALSA lib conf.c:4241:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4241:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4241:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4720:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM default
Can't find a suitable libao driver. (Is device in use?)


Well, I used strace to find the problem. I was a lack on the correct access priveliges on the audio device (of course). I had suspected this, but it was hard to find. The solution is to gain root access then then type:

chmod o+rw /dev/snd/controlC0

one might also try the more drastic

chmod o+rw /dev/snd/*


By Gregory Dudek at | Read (2) or Leave a comment |    
Comments
Re: mpg123 won't play on raspberry pi due to permission problem

Or rather, add yourself to the "audio" group. Most distros have those device files set to be writable by this group.

In fact, I did try to add myself to the audio group, but surprisingly that did not turn out to be sufficient. Perhaps there is some other weirdness in my system, but this fix was still required. Thanks for the suggestion though, and maybe that will be enough for some other people; it is surely a cleaner more standard approach. [-gd]

Posted by: Anonymous at June 26,2014 03:07
Re: mpg123 won't play on raspberry pi due to permission problem

Thanks a lot !

I had the same problem, trying to play an mp3 file in Raspberry from python script.
From my web site, with this code:

os.system('/usr/bin/mpg321 -q mp3/DriveMeCrazy.mp3 ')

I get the error in /var/log/apache2/errror.log

"Can't find a suitable libao driver. (Is device in use?)"

The command: chmod o+rw /dev/snd/*
Fixed the problem !!!

[ Bravo!]

Posted by: anonymous at October 16,2015 01:13
Post your own response

Each comment is manually screened for the presence of appropriate and substantive content, due to a constant onslaught of comment-spam. This means there may be a delay before your comment appears.


(Some kind of name is required, will be visible)

Required, whatever you enter will be visible to other users.


(Optional, used for "mailto" link)

Your email address is not required, but if you insert it it will be displayed so people can contact you.

Answer this question correctly to demonstrate that you are not a dumb spambot.



The title for your comment.



Your comment goes here. All relevant comments are welcome, except for those that simply promote an irrelevant product or else are used to fraudulently inflate the link count to an irrelevant web page. They appear after moderation. Don't forget to also fill in the captcha below or your text will be rejected automatically!

You must answer this question to prove you are human
What kind of restaurant has waiters, napkins, and pizza (enter a number): 1:Seafood, 2:Drive-through, 3:Pizzeria, 4:Reform school, 5:Roadside hot-dog stand?

Answer this question correctly to demonstrate that you are not a dumb spambot.