raspotify: [0.31.1] librespot Audio Sink Error Connection Refused after update

On raspberry pi 3B+ with hifiberry Dac+ and running raspberry pi os buster.

I am running pulseaudio as a system instance (yes, I know it’s not recommended), so I can send audio from my laptop to the raspi, which is connected to my amplifier. I chose this solution as no user is constantly logged in to the raspi, and other people also use it as a Spotify Connect speaker.

After updating to the new version, I get the following error:

Nov 20 13:57:38 raspberrypi librespot[3670]: socket(): Address family not supported by protocol
Nov 20 13:57:38 raspberrypi librespot[3670]: [2021-11-20T12:57:38Z ERROR librespot_playback::player] Audio Sink Error Connection Refused: <AlsaSink> Device default May be Invalid, Busy, or Already in Use, ALSA function 'snd_pcm_open' failed with error 'EBUSY: Device or resource busy'
Nov 20 13:57:38 raspberrypi systemd[1]: raspotify.service: Main process exited, code=exited, status=1/FAILURE
Nov 20 13:57:38 raspberrypi systemd[1]: raspotify.service: Failed with result 'exit-code'.

After purging the new version and manually installing the previous package, everything works with the default configuration, without any --backend or --device options

Running librespot -n raspi on its own gets me the same error.

I have seen this issue , but can’t figure out what I could change in my pulseaudio configuration for it to work. I tried commenting out the DevicePolicy lines in the raspotify.service file, but that didn’t help.

Any chance of a suggestion or fix for this, as I don’t think that this is a very niche use case?

Should I just switch to spotifyd, as mentioned in the README?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 29

Most upvoted comments

I think I fixed it:

In the raspotify.service file, I added AF_UNIX to the RestrictAddressFamilies=AF_INET AF_INET6 AF_NETLINK option, so now it works without any other changes.

According to this, AF_UNIX should be included for local communication.

All of this was done on my current installation (Buster), with pulseaudio running as a system instance.

Regarding your last suggestion to run Pulseaudio as a pipe to ALSA, I don’t think it would work in my case, as I need the server running and advertising on the local network so my laptop can see it available as a sink.

I had similar issue with error Audio Sink Error Connection Refused: <AlsaSink> Device default May be Invalid, Busy, or Already in Use, ALSA function 'snd_pcm_open' failed with error 'ENOMEM: Out of memory' I have pi-btaudio installed. It works fine with 0.31.2-beta-2 installed on my side.

According to this, AF_UNIX should be included for local communication.

I will add that for the sake of backwards compatibility. It was not included originally because it’s not necessary without PulseAudio.

Regarding your last suggestion to run Pulseaudio as a pipe to ALSA, I don’t think it would work in my case, as I need the server running and advertising on the local network so my laptop can see it available as a sink.

Yep I wasn’t sure what the issue was. If adding AF_UNIX solves your problem then yeah not really a point to that,lol!!!

Sorry about the breakage and thanks for helping debug it. I’ll add AF_UNIX and keep this open until a new version is released.

I know this sounds weird but could you purge again and then reinstall. I also fixed a bug where purging the package didn’t actually purge everything. It left the the old systemd service file and then when you install after a purge the old unit file still exists and so isn’t over written.

puged, checked /lib/systemd/system/ and /etc/defaults/, no raspotify files left.

after install, I can connect and it plays normally.

can’t test more at this moment, I’m off to work.

Can you test against https://github.com/dtcooper/raspotify/releases/tag/0.31.2-beta-1

purged installed release, downloaded & installed the beta, playback works OK with no extra configuration.