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

Shairport-sync doesn't work after system startup #471

Closed
aac-1981 opened this issue Feb 7, 2017 · 14 comments
Closed

Shairport-sync doesn't work after system startup #471

aac-1981 opened this issue Feb 7, 2017 · 14 comments

Comments

@aac-1981
Copy link

aac-1981 commented Feb 7, 2017

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.

@faxm0dem
Copy link

faxm0dem commented Feb 7, 2017

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

@aac-1981
Copy link
Author

aac-1981 commented Feb 7, 2017

Restarting doesn't help.

@mikebrady
Copy link
Owner

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.

@aac-1981
Copy link
Author

aac-1981 commented Feb 8, 2017

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.

@aac-1981
Copy link
Author

aac-1981 commented Feb 8, 2017

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?

@mikebrady
Copy link
Owner

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.

@aac-1981
Copy link
Author

aac-1981 commented Feb 9, 2017

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]: �[1;39m[pulseaudio] authkey.c: Failed to open cookie file '/home/shairport-sync/.config/pulse/cookie': No such file or directory
pulseaudio[589]: �[1;39m[pulseaudio] authkey.c: Failed to load authorization key '/home/shairport-sync/.config/pulse/cookie': No such file or directory
pulseaudio[589]: �[1;39m[pulseaudio] authkey.c: Failed to open cookie file '/home/shairport-sync/.pulse-cookie': No such file or directory
pulseaudio[589]: �[1;39m[pulseaudio] authkey.c: Failed to load authorization key '/home/shairport-sync/.pulse-cookie': No such file or directory
pulseaudio[589]: �[1;39m[pulseaudio] authkey.c: Failed to open cookie file '/home/shairport-sync/.config/pulse/cookie': No such file or directory
pulseaudio[589]: �[1;39m[pulseaudio] authkey.c: Failed to load authorization key '/home/shairport-sync/.config/pulse/cookie': No such file or directory
pulseaudio[589]: �[1;31m[autospawn] core-util.c: Failed to create secure directory (/home/shairport-sync/.config/pulse): No such file or directory
pulseaudio[589]: �[1;39m[autospawn] lock-autospawn.c: Kan geen toegang krijgen tot autospawn blokkade.
pulseaudio[589]: �[1;31m[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]: �[1;31morg.bluez.Manager.GetProperties() failed: org.freedesktop.DBus.Error.UnknownMethod: Method "GetProperties" with signature "" on interface "org.bluez.Manager" doesn't exist

@mikebrady
Copy link
Owner

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.

@BaReinhard
Copy link

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

@dikkedimi
Copy link

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

@mikebrady
Copy link
Owner

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.

@mikebrady
Copy link
Owner

mikebrady commented Jun 2, 2018

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.

@mikebrady
Copy link
Owner

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

@wvengen
Copy link

wvengen commented Dec 21, 2020

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.

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

6 participants