[Pianod] Problem with RasPi sound card access as user nobody

Peter Li chinasaurli at gmail.com
Thu May 30 23:05:22 PDT 2013


If I hack settings.c, drop_root_privs to set gid to the audio gid 
instead of the nobody user gid (nogroup) it also works.

So even though nobody is now set to be a member of the audio group, and 
pianod is getting setuid to nobody, it needs to have setgid audio 
instead of setgid nogroup to work.

Now I notice that if I add root to the audio group and hack settings.c 
back to dropping to gid nogroup it also seems to work. So apparently 
after pianod drops to nobody, it has:
     1) uid of nobody
     2) gid of nogroup
     3) additional groups of /root/ not groups of /nobody/

So I guess this is the expected behavior and I just didn't understand 
it.  Should the fix just be to put root in the audio group?  Or should 
we try to change drop_root_privs so that it will take on the additional 
groups of nobody?



On 05/30/2013 10:34 PM, Peter Li wrote:
> Hi guys, having trouble debugging this.  Basically on RasPi I've 
> started having trouble running pianod as a service, similar to the 
> issues that GoneWest was having.
>
> When running as a service it gets called as root and then drops to 
> user nobody (I'm pretty sure?).  Then when I try to play a station if 
> has this:
>
>     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
>     2013-05-30 22:29:12: Cannot open audio device
>
> And in netcat I get the Internal server error message.  I don't have 
> the problem if I set the service to run as "-nroot" or "-nuser".
>
> So I've been messing around trying to get user nobody access to the 
> sound card.  I thought I could debug this from a terminal by running 
> "sudo su nobody" to get a command line as user nobody.  As expected, 
> running pianod from this terminal gives the same set of errors.  If I 
> add user nobody to the "audio" group then running from pianod from the 
> "nobody terminal" works.  So I thought I had figured it out.  But 
> running pianod as sudo either with no "-n" or with "-nnobody" still 
> gives the errors.  So somehow the debugging terminal as user nobody is 
> not giving me the same run environment as if pianod is run by root and 
> then drops to nobody.
>
> This is all a bit oblique, but anyone have any suggestions?
> Thanks!
> P

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.deviousfish.com/pipermail/pianod-deviousfish.com/attachments/20130530/9f1dac0b/attachment-0003.htm>


More information about the Pianod mailing list