librespot icon indicating copy to clipboard operation
librespot copied to clipboard

librespot_discovery] dns_sd error

Open onokje opened this issue 3 months ago • 5 comments

Description

Librespot does not run and exits with an error. I installed it using homebrew on an Ubuntu LXC. The error: ERROR librespot_discovery] dns_sd error: Setting up dns-sd failed: DNS-SD Error: Unknown [2025-08-29T09:46:02Z ERROR librespot] Discovery stopped unexpectedly

See logs further down below. I want to use it with snapcast.

Version

0.7.0

How to reproduce

Steps to reproduce the behavior in librespot e.g.

  1. Launch librespot with librespot --name onoktest

Log

root@musicserver-ubuntu:~# librespot --name onoktest --verbose
[2025-08-29T09:50:29Z INFO  librespot] librespot 0.7.0 VERGEN_IDEMPOTENT_OUTPUT (Built on 2025-08-24, Build ID: 1756047825, Profile: release)
[2025-08-29T09:50:29Z TRACE librespot] Command line argument(s):
[2025-08-29T09:50:29Z TRACE librespot]          name "onoktest"
[2025-08-29T09:50:29Z TRACE librespot]          verbose
[2025-08-29T09:50:29Z DEBUG librespot_core::session] new Session
[2025-08-29T09:50:29Z DEBUG librespot_discovery::server] Zeroconf server listening on 0.0.0.0:35463
[2025-08-29T09:50:29Z INFO  librespot_playback::mixer::softmixer] Mixing with softvol and volume control: Log(60.0)
*** WARNING *** The program 'librespot' uses the Apple Bonjour compatibility layer of Avahi.
[2025-08-29T09:50:29Z DEBUG librespot_playback::player] new Player [0]
[2025-08-29T09:50:29Z INFO  librespot_playback::convert] Converting with ditherer: tpdf
[2025-08-29T09:50:29Z INFO  librespot_playback::audio_backend::rodio] Using Rodio sink with format S16 and cpal host: ALSA
[2025-08-29T09:50:29Z INFO  librespot_playback::audio_backend::rodio] Using audio device: default
ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5205:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5205:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1342:(snd_func_refer) error evaluating name
ALSA lib conf.c:5205:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5728:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2722:(snd_pcm_open_noupdate) Unknown PCM default

thread '<unnamed>' panicked at playback/src/audio_backend/rodio.rs:219:61:
called `Result::unwrap()` on an `Err` value: NoDeviceAvailable
stack backtrace:
   0:     0x58b761d7548b - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h88bd944a2e33171c
   1:     0x58b761dc95e3 - *** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
[2025-08-29T09:50:29Z ERROR librespot_discovery] dns_sd error: Setting up dns-sd failed: DNS-SD Error: Unknown
[2025-08-29T09:50:29Z ERROR librespot] Discovery stopped unexpectedly

Host (what you are running librespot on):

  • OS: Ubuntu 22 LXC on Proxmox (also tried with debian, same problem)
  • Platform: Intel core i5 14th gen

onokje avatar Aug 29 '25 09:08 onokje

The problem is not dns_sd, it's this:

[2025-08-29T09:50:29Z INFO  librespot_playback::audio_backend::rodio] Using audio device: default
ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib pcm.c:2722:(snd_pcm_open_noupdate) Unknown PCM default

Something seems up with your sound configuration. That's likely not a librespot bug, so closing for now, but feel free to reopen if you think it is.

roderickvd avatar Aug 30 '25 20:08 roderickvd

I am pretty sure this is not the issue. I have been running librespot in this configuration for over a year without problems. As I stated in my opening post: I am using librespot with snapcast, so the machine librespot is running on will not be playing any audio. I just posted the output when I run librespot standalone to make sure nobody is confused that is is a problem with snapcast. On snapcast, the output looks like this:

2025-08-31 10-19-12.067 [Info] (Watchdog) Starting watchdog, timeout: 7800s
2025-08-31 10-19-12.067 [Info] (librespot) librespot 0.7.0 VERGEN_IDEMPOTENT_OUTPUT (Built on 2025-08-24, Build ID: 1756047825, Profile: release)
2025-08-31 10-19-12.068 [Info] (librespot_playback::mixer::softmixer) Mixing with softvol and volume control: Log(60.0)
2025-08-31 10-19-12.069 [Info] (librespot_playback::convert) Converting with ditherer: tpdf
2025-08-31 10-19-12.069 [Info] (librespot_playback::audio_backend::pipe) Using StdoutSink (pipe) with format: S16
2025-08-31 10-19-12.069 [Error] (librespot_discovery) dns_sd error: Setting up dns-sd failed: DNS-SD Error: Unknown
2025-08-31 10-19-12.070 [Error] (librespot) Discovery stopped unexpectedly
2025-08-31 10-19-12.070 [Error] (ProcessStream) Error while reading from stderr: End of file

onokje avatar Aug 31 '25 08:08 onokje

I see, that indeed changes matters. When running librespot vanilla, please select that "pipe" backend also so it's fully reproducible.

  • Is avahi-daemon running?
  • Which was the latest version of librespot that with-dns-sd worked with this same system configuration?
  • Does with-avahi work instead of with-dns-sd?
  • Does with-libmdns?
  • Does with-libmdns when you stop avahi-daemon?

roderickvd avatar Aug 31 '25 08:08 roderickvd

The avahi-daemon was in fact not running. I installed it with apt install -y avahi-daemon and verified it:

systemctl status avahi-daemon
● avahi-daemon.service - Avahi mDNS/DNS-SD Stack
     Loaded: loaded (/usr/lib/systemd/system/avahi-daemon.service; enabled; preset: enabled)
     Active: active (running) since Sun 2025-08-31 17:15:16 CEST; 15min ago

However, It didn't change anything. When I try to use a different --zeroconf-backend open it says:

Valid `--zeroconf-backend` values: dns-sd
Default: dns-sd

How to I change the build options when installing with homebrew? I am not really too familiar with it to be honest.

So for completeness sake, this is where I'm at:

librespot -B pipe --verbose --name=test --zeroconf-backend avahi
[2025-08-31T15:36:45Z INFO  librespot] librespot 0.7.0 VERGEN_IDEMPOTENT_OUTPUT (Built on 2025-08-24, Build ID: 1756047825, Profile: release)
[2025-08-31T15:36:45Z TRACE librespot] Command line argument(s):
[2025-08-31T15:36:45Z TRACE librespot]          B "pipe"
[2025-08-31T15:36:45Z TRACE librespot]          verbose
[2025-08-31T15:36:45Z TRACE librespot]          name "test"
[2025-08-31T15:36:45Z TRACE librespot]          zeroconf-backend "avahi"
[2025-08-31T15:36:45Z ERROR librespot] Invalid `--zeroconf-backend`: "avahi"
Valid `--zeroconf-backend` values: dns-sd
Default: dns-sd

or:

librespot -B pipe --verbose --name=test --zeroconf-backend dns-sd
[2025-08-31T15:37:31Z INFO  librespot] librespot 0.7.0 VERGEN_IDEMPOTENT_OUTPUT (Built on 2025-08-24, Build ID: 1756047825, Profile: release)
[2025-08-31T15:37:31Z TRACE librespot] Command line argument(s):
[2025-08-31T15:37:31Z TRACE librespot]          B "pipe"
[2025-08-31T15:37:31Z TRACE librespot]          verbose
[2025-08-31T15:37:31Z TRACE librespot]          name "test"
[2025-08-31T15:37:31Z TRACE librespot]          zeroconf-backend "dns-sd"
[2025-08-31T15:37:31Z DEBUG librespot_core::session] new Session
[2025-08-31T15:37:31Z DEBUG librespot_discovery::server] Zeroconf server listening on 0.0.0.0:42799
[2025-08-31T15:37:31Z INFO  librespot_playback::mixer::softmixer] Mixing with softvol and volume control: Log(60.0)
*** WARNING *** The program 'librespot' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
[2025-08-31T15:37:31Z DEBUG librespot_playback::player] new Player [0]
[2025-08-31T15:37:31Z INFO  librespot_playback::convert] Converting with ditherer: tpdf
[2025-08-31T15:37:31Z INFO  librespot_playback::audio_backend::pipe] Using StdoutSink (pipe) with format: S16
[2025-08-31T15:37:31Z ERROR librespot_discovery] dns_sd error: Setting up dns-sd failed: DNS-SD Error: Unknown
[2025-08-31T15:37:31Z ERROR librespot] Discovery stopped unexpectedly

onokje avatar Aug 31 '25 15:08 onokje

Possibly this should fix your problem: https://github.com/librespot-org/librespot/issues/1133#issuecomment-2041229773

I don’t know how Homebrew works with options. You can compile librespot yourself following the instructions in COMPILING.md.

roderickvd avatar Aug 31 '25 16:08 roderickvd