shairport-sync-docker
shairport-sync-docker copied to clipboard
user `shairport-sync` not in group `audio` in docker image
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
Thanks for the post. This is not a problem that has arisen before. Can you tell us something about the host, please?
@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
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...
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.
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 $@
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.
Thanks. Yeah, we may change the setup to execute shairport-sync as root. It's certainly simpler.
Haven't forgotten this!