Shairport-sync: Sound only running as sudo

Created on 13 Jul 2019  ·  7Comments  ·  Source: mikebrady/shairport-sync

Hi Mike (also hi to the others who might can help ;-)),

at first thank you very much for your great efforts for shairport-sync. Great tool.
I installed shairport-sync as described in the manual. Did this already for two other devices which runs without any issue. On my third device i wanted to enable Alsa-equalizer which is also running good. The issue what i currently have is that i don't get any sound out of shairport-sync if i have started it via systemctl. I can connect to the shairport-device but i can't hear anything. Also the slider on the phone is moving and is playing music but nothing to hear. If i stop shairport-sync via systemctl and starting it with "sudo shairport-sync" it plays directly the music.

I have added the user shairport-sync also to the group "sudo" and to "audio". Nothing changed.

Following the output by systemctl status:

pi@airplay-kueche:~ $ sudo systemctl status shairport-sync
● shairport-sync.service - Shairport Sync - AirPlay Audio Receiver
   Loaded: loaded (/lib/systemd/system/shairport-sync.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2019-07-13 18:13:32 CEST; 34min ago
 Main PID: 1326 (shairport-sync)
    Tasks: 5 (limit: 2200)
   Memory: 6.0M
   CGroup: /system.slice/shairport-sync.service
           └─1326 /usr/local/bin/shairport-sync

Jul 13 18:13:58 airplay-kueche shairport-sync[1326]: ALSA lib pcm_dmix.c:1165:(snd_pcm_dmix_open) unable to open slave
Jul 13 18:13:58 airplay-kueche shairport-sync[1326]: alsa: error -24 ("Too many open files") opening alsa device "default".
Jul 13 18:13:58 airplay-kueche shairport-sync[1326]: ALSA lib pcm_dmix.c:1165:(snd_pcm_dmix_open) unable to open slave
Jul 13 18:13:58 airplay-kueche shairport-sync[1326]: alsa: error -24 ("Too many open files") opening alsa device "default".
Jul 13 18:13:58 airplay-kueche shairport-sync[1326]: ALSA lib pcm_dmix.c:1165:(snd_pcm_dmix_open) unable to open slave
Jul 13 18:13:58 airplay-kueche shairport-sync[1326]: alsa: error -24 ("Too many open files") opening alsa device "default".
Jul 13 18:13:58 airplay-kueche shairport-sync[1326]: ALSA lib pcm_dmix.c:1165:(snd_pcm_dmix_open) unable to open slave
Jul 13 18:13:58 airplay-kueche shairport-sync[1326]: alsa: error -24 ("Too many open files") opening alsa device "default".
Jul 13 18:13:58 airplay-kueche shairport-sync[1326]: ALSA lib pcm_dmix.c:1165:(snd_pcm_dmix_open) unable to open slave
Jul 13 18:13:58 airplay-kueche shairport-sync[1326]: alsa: error -24 ("Too many open files") opening alsa device "default".

This is my asound.conf:

pcm.dmixer {
  type dmix
  ipc_key 1024
slave {
pcm {
  type hw
  card 1
  device 0
}
  period_time 0
  period_size 1024
  buffer_size 4096
}
}

ctl.equal {
  type equal;
}

pcm.plugequal {
  type equal
  slave.pcm "plug:dmixer"
}

ctl.!default {
  type hw
  card 1
}

pcm.!default {
  type plug
  slave.pcm plugequal
}

Current group membership of shairport-sync user:

pi@airplay-kueche:~ $ groups shairport-sync
shairport-sync : shairport-sync sudo audio

ls -l for asound.conf:

-rw-r--r--  1 root root     322 Jul 13 17:14 asound.conf

I really have no clue anymore what to change or to test and after one week of searching internet and testing i feel really to be at the end of my knowledge. Highly appreciate if you can find time to have a look at this issue.

thanks a lot and cheers
ContraVarus

troubleshooting

Most helpful comment

On Raspbian Buster Lite on a Pi Zero: as a hacky "solution" to the same problem here of no audio output and not saving of alsaequal settings here & here, I got things working by running shairport under the root user:

cp /lib/systemd/system/shairport-sync.service /etc/systemd/system/shairport-sync.service

and:

#User=shairport-sync
User=root
#Group=shairport-sync
Group=root

Then reboot!

All 7 comments

I am afraid I do not have expertise in this area — Maybe some other users can help.

Nevertheless thank you. I'm still investigating and if i find the issue i will post it here.

Sorry if this is an obvious point. By default, the shairport-sync user has no home directory, hence no .asoundrc. Is it possible that this might be the cause of any problem?

Thanks for the hint but i configured it from start with only asound.conf for all users. Also checked this in the home-dir's of the others. No .asoundrcanywhere around.
I'm currently thinking of that maybe there's another default audio-output for user shairport-sync. Just wanted to check but what is the password for this user?

The shairport-sync user has no password — it is not allowed to log in.

Just to follow up on this – did you figure out what the problem is? Also, BTW, when you do $ shairport-sync -h on recent versions, it will list the hardware output devices it can find. E.g. towards the end:

...

Settings and options for the audio backend "alsa":
    -d output-device    set the output device, default is "default".
    -c mixer-control    set the mixer control name, default is to use no mixer.
    -m mixer-device     set the mixer device, default is the output device.
    -i mixer-index      set the mixer index, default is 0.
    hardware output devices:
      "hw:ALSA"
      "hw:Device"

On Raspbian Buster Lite on a Pi Zero: as a hacky "solution" to the same problem here of no audio output and not saving of alsaequal settings here & here, I got things working by running shairport under the root user:

cp /lib/systemd/system/shairport-sync.service /etc/systemd/system/shairport-sync.service

and:

#User=shairport-sync
User=root
#Group=shairport-sync
Group=root

Then reboot!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

moritzmhmk picture moritzmhmk  ·  6Comments

vasilisvg picture vasilisvg  ·  8Comments

rockrabbit picture rockrabbit  ·  6Comments

fundix picture fundix  ·  3Comments

PaulWieland picture PaulWieland  ·  8Comments