My last AirPi post has been popular – and still is – but part of why of like Arch linux is that it is constantly updating so you must be hands on, learning a new part of the OS the hard way!
Since my post a year ago, Shairport has some new features and dependencies, and Arch has moved to the systemd service manager, changing the tutorial process somewhat. In order to update it, I have run through the process with the current build (2013-02-11).
Next you'll need to install the tools required to compile in Arch.
Then git to clone the Shairport repo.
Shairport has a number of dependencies so we'll install them and there dependencies too.
A new dependency for Shairport is perl-net-sdp. This isn't a package yet in the pacman repos so must be installed from the AUR.
Finally, alsa is required to get sound output in Arch on the RPi.
Now clone the repo, cd into it and make.
All being well, Shairport should have built and you can now run it with the name 'AirPi'.
The biggest change is dropping rc.conf in favour of systemd. The sound module snd-bcm2835 now autoloads but Avahi must be enabled as a service.
I recently created another 'AirPi' for my sister so went through these steps. As before, ArchPi has changed a few things. The main problem I came across was ivp6 being disabled, preventing Shairport binding to the socket. To enable it, change ipv6.disable=1 in /boot/cmdline.txt to false (0).
Copy extract the perl package from the AUR here then sudo -u nobody makepkg to make the package.
I also had issues with my file system becoming read only. To fix this edit '/boot/cmdline.txt' and add 'rw' at the end of the line before 'rootwait', reboot.
But I'm unable to connect to it when it has been started automatically as a service (it is visible but I can't connect to it).
Seems to be the issue you are having? You could try compiling the old build that the original poster links at the end of his post or the dev build, which I believe fixes this.
nice guide, im looking to set a few up around the house into differnt speakers and have like a "sonos" wireless music setup around the house setup but if i name them all the same will it play through them all or will they be listed as different speakers on the idevice? and only be able to play through one speaker?
No, they will be listed as different AirPlay devices and you can only connect to one at a time so only one speaker at a time.
The only way to achieve that would be to have a central amp with speaker wire laid into each room; not completely wireless but it's what I have done.
Hi, If you name each AirPi differently then using TuneBlade you can stream to all of them at once and in Sync and free for non apple AirPlay like the Pi. I am using cheap computer speakers which are fine for the kitchen, bathroom etc and have their own amp and volume control. All I need to do now is find out how to switch off the Pi simply without destroying the SD card and without having to log in with Putty and issue the sudo halt command.
Sounds like you want a 'power' button to issue the halt command. I imagine it's something you could design with GPIO – a shutdown script that runs when a button is pressed.
Let me know if you create a solution.
Great tutorial! Got my system up and running in 10 min.
By any chance do you know if shairport passes (or logs) any information about users connected or the music being passed?
Thanks, glad you got up and running quickly.
The first method that came to my head for seeing users connected was to use lsof. You can see just connections using lsof -i and just shairport using lsof -c shairport -i. The only problem with this is that lsof isn't included in ArchPi. You could install it using pacman -Syu lsof but an inbuilt (but rougher) solution is to use netstat -at. You will see the ip of the connected user, bound to the default shairport port (63242) (it will only show the connection when music is playing). Hope this helps.
Great tutorial and finally it works for me.
But using ExecStart=/usr/local/bin/shairport -a AirPi -b 256 -d in shairport.service for startup didn' t work for me. The stream was always breaking down after a minute or so.
But if I start the Pearl file it works: ExecStart=/usr/local/bin/shairport.pl -a AirPi -b 256 -d. Any idea what' s the reason for this?
Thanks and glad you got it working. Not sure about the problem though. Do you get any errors if you run shairport manually in the foreground or does it only cut out using the start up?
What build of shairport did you use? I did this recently and had a problem where it would connect then drop after a few seconds. I had to use the '1.0 dev' branch but I think they've moved to 1.0 now anyway.
Anyway, if it works using calling the pearl file I guess just leave it like that!
systemd: Failed to open private bus connection: Failed to connect to socket /run/user/1000/dbus/user_bus_socket: No such file or directory.
I am connecting over ssh, so I use journalctl to get the error.
I don't know why I a getting this error, any ideas for fixes?
Fixed the problem. I'm not sure what was happening, but following the instructions to enable dbus on the Arch Wiki Systemd page seemed to fix the error, and AirPlay works at boot now.
Glad to hear you fixed it. I was away so couldn't comment but sounded like some sort of permissions/install problem.
On latest Arch Linux I was getting some pretty poor sound quality.
Ah thanks for posting this. When I created the latest update, I didn't check the audio playback but got complaints from my sister after delivering it a couple of days ago regarding poor sound! Nice to have a quick solution now.
Just wanted to say thanks for the excellent step-by-step tutorial. One suggestion: for non-root users, shairport does not run properly (lack of privileges). This isn't a problem for you, as I think you're running all these commands as root. Took me a few minutes to figure out where I was going wrong. Thanks again!