Shairport-sync: Shairport-sync doesn't work after system startup

Created on 7 Feb 2017  Â·  14Comments  Â·  Source: mikebrady/shairport-sync

On my iPad i see my raspberry in Airplay after i manual started shairport-sync.
I used the commands to enable the shairport-sync as a service.
After reboot, my raspberry doens't show up in Airplay.
I use the command "systemctl status shairport-sync" and this ones tell me that the service is active (running). But why can't i see this on my iPad?
I have Raspbian Jessie as OS.

Most helpful comment

Note that I've succeeded in using shairport-sync's pa backend with Pulseaudio in the system-wide mode. Most important thing to remember is to add the shairport-sync user to the pulse-access group. In my case shairport-sync and pulseaudio are on the same host.

All 14 comments

Maybe it started too early in the boot process. What happens when restarting the service?

Restarting doesn't help.

Thanks for the post. Shairport-sync as a service runs well on a Raspberry Pi, so If I was you, I'd check that every step of the installation has been done correctly, including the $sudo make install. The runtime environment in which a service runs is different from that of a logged-in user, which might account for why it doesn't work properly if not properly installed. So it's important that each step of the README.md guide is followed precisely. If you want to log the operation of Shairport Sync, set the log_verbosity to, say, 2, and reboot.

I first used following commando:
getent passwd shairport-sync &> /dev/null || sudo useradd -r -M -g shairport-sync -s /usr/bin/nologin

That gave me an error and i placed "shairport-sync" after that commando.
I saw later that i was missing the full commando (iPad didn't show the full commando).

I tried with the correct commando:
getent passwd shairport-sync &> /dev/null || sudo useradd -r -M -g shairport-sync -s /usr/bin/nologin -G audio shairport-sync >/dev/null
That didn't work also.

Could that be the problem? Because i don't know a lot of user rights on Linux.

I did each step of the installation again but it still the same problem.
I also added now --sysconfdir=/etc but it still looking at /usr/local/etc when i manually start shairport-sync from the shairport-sync directory.

I changed log_verbosity to 2 on '/etc' and '/usr/local/etc location'.
Where can i find the log for the service?

Thanks for the posts. It does look as if there are some issues alright.

The log can be read using, for example, $sudo journalctl -n 100 to read the last 100 entries.

Thanks, i read the log and found some problems.
The shairport-sync folder is under the subfolder pi (/home/pi/shairport-sync). And under shairport-sync folder i can't find the .config folder.
If i do ".ls -al" under the shairport-sync folder, i don't see the .config folder.
I don't understand whats wrong.

Here's what i found in the log:

shairport-sync[559]: Output device name is "hw:0".
shairport-sync[559]: Open Mixer
shairport-sync[559]: Failed to create secure directory (/home/shairport-sync/.config/pulse): No such file or directory
pulseaudio[589]: [pulseaudio] authkey.c: Failed to open cookie file '/home/shairport-sync/.config/pulse/cookie': No such file or directory
pulseaudio[589]: [pulseaudio] authkey.c: Failed to load authorization key '/home/shairport-sync/.config/pulse/cookie': No such file or directory
pulseaudio[589]: [pulseaudio] authkey.c: Failed to open cookie file '/home/shairport-sync/.pulse-cookie': No such file or directory
pulseaudio[589]: [pulseaudio] authkey.c: Failed to load authorization key '/home/shairport-sync/.pulse-cookie': No such file or directory
pulseaudio[589]: [pulseaudio] authkey.c: Failed to open cookie file '/home/shairport-sync/.config/pulse/cookie': No such file or directory
pulseaudio[589]: [pulseaudio] authkey.c: Failed to load authorization key '/home/shairport-sync/.config/pulse/cookie': No such file or directory
pulseaudio[589]: [autospawn] core-util.c: Failed to create secure directory (/home/shairport-sync/.config/pulse): No such file or directory
pulseaudio[589]: [autospawn] lock-autospawn.c: Kan geen toegang krijgen tot autospawn blokkade.
pulseaudio[589]: [pulseaudio] main.c: Failed to acquire autospawn lock
shairport-sync[559]: Failed to attach mixer
shairport-sync[559]: Request to shut down all rtsp conversation threads
shairport-sync[559]: asking playing threads to stop
pulseaudio[993]: org.bluez.Manager.GetProperties() failed: org.freedesktop.DBus.Error.UnknownMethod: Method "GetProperties" with signature "" on interface "org.bluez.Manager" doesn't exist

Thanks for that. Unfortunately, it does look as if the ibuild and installation process is messsed up. I'd suggest that you start again on a clean version of Raspian and follow the installation instructions exactly.

Depending on what you are looking for I have recently created a project that installs shairport-sync,kodi and a few other things that is used as a Audio Receiver for a car installation. The install is easy and works on the latest version of raspbian jessie. If you don't want kodi or any other installation you can comment out the lines in the runall.sh

I haven't had an issue whatsoever with shairport-sync in this setup:
https://github.com/BaReinhard/Raspberry-Pi-Audio-Receiver-Install-Car-Install

happens to me too on a fresh google voice kit image (19-05-2018). I followed these instructions (https://pimylifeup.com/raspberry-pi-airplay-receiver/).
I'm using the google HAT with the following options in my

general =
{
output_backend = "alsa";
}
alsa =
{
output_device="sysdefault";
}

and this is my log output:

raspberrypi systemd[1]: Started Shairport Sync - AirPlay Audio Receiver.
raspberrypi shairport-sync[1447]: Failed to create secure directory (/home/shairport-sync/.config/pulse): No such file or directory
raspberrypi pulseaudio[1460]: [autospawn] core-util.c: Failed to create secure directory (/home/shairport-sync/.config/pulse): No such file or directory
raspberrypi pulseaudio[1460]: [autospawn] lock-autospawn.c: Cannot access autospawn lock.
raspberrypi pulseaudio[1460]: [pulseaudio] main.c: Failed to acquire autospawn lock
raspberrypi CRON[1468]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)

I've tried this:

pi@raspberrypi:~ $ sudo mkdir -p /home/shairport-sync/.config/pulse
pi@raspberrypi:~ $ sudo chown shairport-sync /home/shairport-sync/.config/pulse
pi@raspberrypi:~ $ sudo service shairport-sync restart

with result

raspberrypi systemd[1]: Started Shairport Sync - AirPlay Audio Receiver.
raspberrypi shairport-sync[1580]: Home directory not accessible: Permission denied
raspberrypi pulseaudio[1593]: [autospawn] core-util.c: Home directory not accessible: Permission denied
raspberrypi pulseaudio[1593]: [autospawn] lock-autospawn.c: Cannot access autospawn lock.
raspberrypi pulseaudio[1593]: [pulseaudio] main.c: Failed to acquire autospawn lock

Thanks for these posts. I haven't tried the Google Voice Kit, but my guess is that the "sysdefault" you are outputting to is actually not a real ALSA device but is instead a virtual device powered by pulseaudio. Pulseaudio is then getting into trouble because it hasn't been initialised for the shairport-sync user. If this is the case, then the solution is to find a real hardware audio card, using something like alsamixer, and trying to output directly to it. This might not be feasible, as Shairport Sync needs exclusive access to the device, possible causing problems to pulseaudio.

An alternative is to build Shairport Sync with the pulseaudio back end (--with-pa). The problem with this (see README.md) is that it can't be started as a system service, due to the way pulseaudio is normally configured.

Closing the issue – please open a new one if necessary.

Note that I've succeeded in using shairport-sync's pa backend with Pulseaudio in the system-wide mode. Most important thing to remember is to add the shairport-sync user to the pulse-access group. In my case shairport-sync and pulseaudio are on the same host.

Was this page helpful?
0 / 5 - 0 ratings