dtcooper/raspotify

"Address already in use (os error 98)" -> "Authentication is not possible."

khink opened this issue · 4 comments

khink commented

Due Diligence

  • I have done my due diligence

What can we help you with?

After i updated /etc/raspotify/conf (uncommented LIBRESPOT_VOLUME_CTRL= to linear) and restarted (sudo systemctl start raspotify), raspotify started crashing: Not available on form Spotify apps on the network (laptop, phone) and ps ax | grep raspotify only lists /bin/bash /usr/bin/raspotify-crash-report-generator.sh.

  • The error message (see below) is "Discovery is unavailable and no credentials provided. Authentication is not possible."
  • But I think this is not the mdns issue from #571, as i don't see that libmdns panic (see below)
  • I undid my change to /etc/raspotify/conf, but raspotify still crashes.
  • I use the same router as before.
  • I upgraded to bullseye some 3 weeks ago. In the first days after the upgrade i've restarted raspotify a lot to toy with the settings. The last couple weeks not so much, it's just been running.
  • About a week ago i replaced the DAC with a new one. Both are USB devices, the new one was picked up instantly. I don't think it's related, as the error message is about "authentication".
  • I've rebooted the pi, to no avail

My question is, how could i get more info on what is going wrong here?

Some information (logs, software used, similar issues here) is below.

$ tail -f /var/log/syslog
Jan 25 22:00:24 raspberrypi librespot[6579]: [2023-01-25T21:00:24Z WARN  librespot] Without a `--cache` / `-c` path, and/or if the `--disable-audio-cache` / `-G` flag is set, `--cache-size-limit` / `-M` has no effect.
Jan 25 22:00:24 raspberrypi librespot[6579]: [2023-01-25T21:00:24Z WARN  librespot] Could not initialise discovery: Setting up dns-sd failed: Address already in use (os error 98)
Jan 25 22:00:24 raspberrypi librespot[6579]: [2023-01-25T21:00:24Z ERROR librespot] Discovery is unavailable and no credentials provided. Authentication is not possible.
Jan 25 22:00:24 raspberrypi systemd[1]: raspotify.service: Main process exited, code=exited, status=1/FAILURE
Jan 25 22:00:24 raspberrypi systemd[1]: raspotify.service: Failed with result 'exit-code'.
Jan 25 22:00:24 raspberrypi systemd[1]: raspotify.service: Triggering OnFailure= dependencies.
Jan 25 22:00:25 raspberrypi systemd[1]: Starting Raspotify Crash Report Generator...
Jan 25 22:00:36 raspberrypi systemd[1]: Started Raspotify (Spotify Connect Client).
Jan 25 22:00:36 raspberrypi systemd[1]: raspotify-crash-report-generator.service: Succeeded.
Jan 25 22:00:36 raspberrypi systemd[1]: Finished Raspotify Crash Report Generator.
Jan 25 22:00:36 raspberrypi systemd[1]: raspotify-crash-report-generator.service: Consumed 1.551s CPU time.
pi@raspberrypi:~ $ librespot -v
[2023-01-25T21:03:13Z INFO  librespot] librespot 0.4.2 a56a567 (Built on 2023-01-23, Build ID: EuYVFs2i, Profile: release)
[2023-01-25T21:03:13Z TRACE librespot] Command line argument(s):
[2023-01-25T21:03:13Z TRACE librespot] 		v
[2023-01-25T21:03:13Z DEBUG librespot_discovery::server] Zeroconf server listening on 0.0.0.0:36017
[2023-01-25T21:03:13Z DEBUG librespot] System uptime: 1610 secs
[2023-01-25T21:03:13Z DEBUG librespot] System uptime >= 60 secs, not retrying to initialise discovery
[2023-01-25T21:03:13Z WARN  librespot] Could not initialise discovery: Setting up dns-sd failed: Address already in use (os error 98)
[2023-01-25T21:03:13Z ERROR librespot] Discovery is unavailable and no credentials provided. Authentication is not possible.
pi@raspberrypi:~ $ journalctl
...
Jan 25 22:01:11 raspberrypi librespot[8216]: [2023-01-25T21:01:11Z WARN  librespot] Without a `--cache` / `-c` path, and/or if the `--disable-audio-cache` / `-G` flag is set, `--cache-size-limit` / `-M` has no >
Jan 25 22:01:11 raspberrypi librespot[8216]: [2023-01-25T21:01:11Z WARN  librespot] Could not initialise discovery: Setting up dns-sd failed: Address already in use (os error 98)
Jan 25 22:01:11 raspberrypi librespot[8216]: [2023-01-25T21:01:11Z ERROR librespot] Discovery is unavailable and no credentials provided. Authentication is not possible.
Jan 25 22:01:11 raspberrypi systemd[1]: raspotify.service: Main process exited, code=exited, status=1/FAILURE
Jan 25 22:01:11 raspberrypi systemd[1]: raspotify.service: Failed with result 'exit-code'.
Jan 25 22:01:11 raspberrypi systemd[1]: raspotify.service: Triggering OnFailure= dependencies.
Jan 25 22:01:11 raspberrypi systemd[1]: Starting Raspotify Crash Report Generator...
Jan 25 22:01:12 raspberrypi systemd[1]: raspotify-crash-report-generator.service: Succeeded.
Jan 25 22:01:12 raspberrypi systemd[1]: Finished Raspotify Crash Report Generator.
Jan 25 22:01:12 raspberrypi systemd[1]: raspotify-crash-report-generator.service: Consumed 1.509s CPU time.

(Interestingly, but off topic: i did see a libmdns issue here, last one was from January 8th, this must've been the day i upgraded to bullseye: Jan 08 22:54:16 raspberrypi librespot[12842]: [2023-01-08T21:54:16Z WARN libmdns::fsm] error sending packet Os { code: 99, kind: AddrNotAvailable, message: "Cannot assign requested address" } )

I didn't see any issue on that "address in use" here: https://github.com/dtcooper/raspotify/issues?q=is%3Aissue+%22Address+already+in+use%22

There are some other issues for "Discovery is unavailable and no credentials provided. Authentication is not possible": https://github.com/dtcooper/raspotify/issues?q=is%3Aissue+%22Discovery+is+unavailable+and+no+credentials+provided.+Authentication+is+not+possible.%22
One of those i've already mentioned, the others don't seem to relate to this issue (but i may be wrong). I did try to include answers to some of the questions in those issues in the information presented here.

I'm running a standard raspotify on bullseye on a Pi 3. It's running without a monitor (only SSH access), although lxde is installed (i think from when i first set it up a year or two ago).

pi@raspberrypi:~ $ sudo apt show raspotify
Package: raspotify
Version: 0.43.26~librespot.v0.4.2-a56a567
...

pi@raspberrypi:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
...

pi@raspberrypi:~ $ cat /proc/cpuinfo
processor	: 0
model name	: ARMv7 Processor rev 4 (v7l)
...
Hardware	: BCM2835
Revision	: a02082
Serial		: 00000000e6a3a0de
Model		: Raspberry Pi 3 Model B Rev 1.2
khink commented

The error comes from librespot.

I see no issue for "Address already in use" in there: https://github.com/librespot-org/librespot/issues?q=is%3Aissue+%22Address+already+in+use%22+, maybe i should file this one there.

I tried entering a value for LIBRESPOT_ZEROCONF_PORT which is currently commented out, but to no avail.

For now, disabling zeroconf discovery mode wit LIBRESPOT_DISABLE_DISCOVERY= is good enough for me.

khink commented

In librespot-org/librespot#1111, it was suggested that avahi-daemon is the package that runs another zeroconf server. I removed the avahi-daemon package and rebooted the pi, and now it works again.

That's a known issue that effects some people (I have personally never had an issue though?). Unfortunately there is currently no good solution. There is a compile flag that uses a long since deprecated avahi-daemon compatability interface/API(?) but being as though it's deprecated ofc that's a no-go. It's also a no-go to make the package conflict with the avahi-daemon package since so many things can potentially depend on it. The ideal solution would be to use the avahi-daemon DBus interface as advised in the avahi-daemon docs and then just make avahi-daemon a dependency and everything should play nice, but someone would have to get that merged into librespot and they aren't to keen on platform specific things so you'd also prob have to write an implementation that worked with Windows and Mac's native mdns interfaces also.

khink commented

Just did a complete fresh install of Raspberry Pi OS Lite (no desktop). It still installs avahi-daemon:

pi@raspberrypi:~ $ sudo apt list avahi-daemon
Listing... Done
avahi-daemon/stable,now 0.8-5+deb11u1 armhf [installed]

but now it's not a problem. Strange.