Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

user shairport-sync not in group audio in docker image #15

Open
yrzr opened this issue Aug 30, 2021 · 8 comments
Open

user shairport-sync not in group audio in docker image #15

yrzr opened this issue Aug 30, 2021 · 8 comments

Comments

@yrzr
Copy link

yrzr commented Aug 30, 2021

As described, which causes problems like

ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4745:(_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:4745:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM sysdefault

Fixed by simply add the user to the group and restart the container.

The docker commands I am using:

docker run \
  --detach \
  --net host \
  --restart always \
  --name shairport-sync \
  --device /dev/snd \
  mikebrady/shairport-sync:3.3.8
@mikebrady mikebrady transferred this issue from mikebrady/shairport-sync Aug 30, 2021
@mikebrady
Copy link
Owner

mikebrady commented Aug 30, 2021

Thanks for the post. This is not a problem that has arisen before. Can you tell us something about the host, please?

@yrzr
Copy link
Author

yrzr commented Sep 1, 2021

@mikebrady hi, I am running it on Gentoo Linux from an RPi4

% uname -a
Linux rpi4-de 5.10.60-v8-yrzr-ge4cb65cf23c7 #10 SMP Sat Aug 28 13:30:19 HKT 2021 aarch64 GNU/Linux
% cat /proc/asound/cards 
 0 [ALSA           ]: bcm2835_alsa - bcm2835 ALSA
                      bcm2835 ALSA
 1 [vc4hdmi0       ]: vc4-hdmi - vc4-hdmi-0
                      vc4-hdmi-0
 2 [vc4hdmi1       ]: vc4-hdmi - vc4-hdmi-1
                      vc4-hdmi-1
%  aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 7/7
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 IEC958/HDMI [bcm2835 IEC958/HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: ALSA [bcm2835 ALSA], device 2: bcm2835 IEC958/HDMI1 [bcm2835 IEC958/HDMI1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: vc4hdmi0 [vc4-hdmi-0], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: vc4hdmi1 [vc4-hdmi-1], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

@mikebrady
Copy link
Owner

Thanks. Haven't tried Gentoo Linux on an RPi4. The container works when the host is Raspberry Pi OS. It might be quite a while before this gets looked at...

@nettnikl
Copy link

Hi, facing the same issue, using Manjaro on a Rpi4. Have been trying things for quite a while now,
The card is however seen when i "docker exec" as root into the container and execute "aplay -l" - executing "su shairport-sync -c "aplay -l"" however results in no cards found.

@nettnikl
Copy link

Ah, forgot how i "solved" it in the end:
Quick (after hours of trying) and dirty fix: Adjust the runscript to execute the shairport-sync as root instead of as shairport-sync, and then rebuilding the image.
su-exec root shairport-sync $@

@nettnikl
Copy link

Would be very interested how to get it to work without this security issue waiting to blow up. Could be that the audio group is somehow at fault here, however running as root works, and i manually added the shairport-sync user to all groups root is in, also to a group with the same gid as the audio group on the host.

@mikebrady
Copy link
Owner

Thanks. Yeah, we may change the setup to execute shairport-sync as root. It's certainly simpler.

@mikebrady
Copy link
Owner

Haven't forgotten this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants