While I created my first snap for the shairport-sync Apple Airplay daemon I ran into some trouble with audio playback. In the documentation it is recommended to use the new audio-playback interface which deprecates the old pulseaudio interface with some searching on Google and GitHub I managed to get the snap up and running after adding
# Make PulseAudio socket available inside the snap-specific $XDG_RUNTIME_DIR
if [ -n "$XDG_RUNTIME_DIR" ]; then
pulsenative="pulse/native"
pulseaudio_sockpath="$XDG_RUNTIME_DIR/../$pulsenative"
if [ -S "$pulseaudio_sockpath" ]; then
export PULSE_SERVER="unix:${pulseaudio_sockpath}"
fi
fi
To the wrapper script which I am using to launch the shairport-sync executable in the snap. If I do run the executable in the daemon: simple configuration I do get the following messages in the logs:
Mai 03 11:11:02 sauron shairport-sync[11234]: failed to connect to the pulseaudio context -- the error message is "Connection refused".
Mai 03 11:11:02 sauron audit[11234]: ANOM_ABEND auid=4294967295 uid=0 gid=0 ses=4294967295 pid=11234 comm="shairport-sync" exe="/snap/shairport-sync/x19/bin/shairport-sync" sig=6 res=1
Mai 03 11:11:02 sauron systemd[1]: snap.shairport-sync.shairport-sync.service: Main process exited, code=dumped, status=6/ABRT
Mai 03 11:11:02 sauron systemd[1]: snap.shairport-sync.shairport-sync.service: Failed with result 'core-dump'.
Mai 03 11:11:02 sauron audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=snap.shairport-sync.shairport-sync comm="systemd" exe="/lib/systemd/systemd" hostname=? add
r=? terminal=? res=failed'
Mai 03 11:11:02 sauron systemd[1]: snap.shairport-sync.shairport-sync.service: Service hold-off time over, scheduling restart.
Mai 03 11:11:02 sauron systemd[1]: snap.shairport-sync.shairport-sync.service: Scheduled restart job, restart counter is at 1.
Unfortunately I was not able to find any snap which uses the audio-playback interface and run in daemon mode. The only documentation I could find was the usage of the pulseaudio interface in Ubuntu core Pulseaudio access from others snaps
Which seems to take advantage from the Pulseaudio server running in system mode and not user mode which is the typical case on a desktop.
Anyway, my goal is to have a running shairport-sync which can be installed both on the desktop and on a core device for example an Raspberry PI which can be used as an Airplay Backend.