[GH-ISSUE #231] zeroconf name collision when using librespot as a service #155

Closed
opened 2026-02-27 19:29:08 +03:00 by kerem · 2 comments
Owner

Originally created by @jorritsmit on GitHub (Jun 7, 2018).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/231

When i start librespot from the terminal everything works fine, but when i start it as a service i get the following errors and no sound:

jorrit@pine64:~/Programs/libs/librespot/target/release$ sudo systemctl status librespot.service 
● librespot.service - Librespot
   Loaded: loaded (/etc/systemd/system/librespot.service; enabled; vendor preset: enabled)
   Active: active (running) since do 2018-06-07 12:57:59 CEST; 13s ago
 Main PID: 13890 (librespot)
   CGroup: /system.slice/librespot.service
           ├─13890 /usr/bin/librespot -n HomeHub --backend pulseaudio --cache /home/jorrit/.cache/librespot/ --bitrate 320
           ├─13903 /usr/bin/pulseaudio --start --log-target=syslog
           └─13910 /usr/lib/pulseaudio/pulse/gconf-helper

jun 07 12:58:08 pine64 librespot[13890]: INFO:librespot_playback::player: Track "Hungry - Remix" loaded
jun 07 12:58:12 pine64 pulseaudio[13903]: [pulseaudio] server-lookup.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-d
jun 07 12:58:12 pine64 pulseaudio[13903]: [pulseaudio] main.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon wit
jun 07 12:58:12 pine64 pulseaudio[13903]: [avahi-ml] module-zeroconf-publish.c: avahi_entry_group_add_service_strlst(): Local name collision
jun 07 12:58:12 pine64 pulseaudio[13903]: [avahi-ml] module-zeroconf-publish.c: avahi_entry_group_add_service_strlst(): Local name collision
jun 07 12:58:12 pine64 pulseaudio[13903]: [avahi-ml] module-zeroconf-publish.c: avahi_entry_group_add_service_strlst(): Local name collision
jun 07 12:58:12 pine64 pulseaudio[13903]: [pulseaudio] module-zeroconf-publish.c: avahi_entry_group_add_service_strlst() failed: Local name collision
jun 07 12:58:12 pine64 pulseaudio[13903]: [alsa-sink-SUNXI-CODEC codec-aif1-0] alsa-sink.c: ALSA woke us up to write new data to the device, but there was actually not
jun 07 12:58:12 pine64 pulseaudio[13903]: [alsa-sink-SUNXI-CODEC codec-aif1-0] alsa-sink.c: Most likely this is a bug in the ALSA driver 'sunxi_sndcodec'. Please repor
jun 07 12:58:12 pine64 pulseaudio[13903]: [alsa-sink-SUNXI-CODEC codec-aif1-0] alsa-sink.c: We were woken up with POLLOUT set -- however a subsequent snd_pcm_avail() r

On occasion it does work, don´t know why, but what i see then is that the backend is not pulseaudio but alsa. Anyone got any idea what this could be?

my service file looks like this

[Unit]
Description=Librespot
Requires=network-online.target
After=network-online.target

[Service]
User=jorrit
Group=audio
Restart=always
RestartSec=10
ExecStart=/usr/bin/librespot -n "HomeHub" --backend pulseaudio --cache /home/jorrit/.cache/librespot/ --bitrate 320

[Install]
WantedBy=multi-user.target
Originally created by @jorritsmit on GitHub (Jun 7, 2018). Original GitHub issue: https://github.com/librespot-org/librespot/issues/231 When i start librespot from the terminal everything works fine, but when i start it as a service i get the following errors and no sound: ``` jorrit@pine64:~/Programs/libs/librespot/target/release$ sudo systemctl status librespot.service ● librespot.service - Librespot Loaded: loaded (/etc/systemd/system/librespot.service; enabled; vendor preset: enabled) Active: active (running) since do 2018-06-07 12:57:59 CEST; 13s ago Main PID: 13890 (librespot) CGroup: /system.slice/librespot.service ├─13890 /usr/bin/librespot -n HomeHub --backend pulseaudio --cache /home/jorrit/.cache/librespot/ --bitrate 320 ├─13903 /usr/bin/pulseaudio --start --log-target=syslog └─13910 /usr/lib/pulseaudio/pulse/gconf-helper jun 07 12:58:08 pine64 librespot[13890]: INFO:librespot_playback::player: Track "Hungry - Remix" loaded jun 07 12:58:12 pine64 pulseaudio[13903]: [pulseaudio] server-lookup.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-d jun 07 12:58:12 pine64 pulseaudio[13903]: [pulseaudio] main.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon wit jun 07 12:58:12 pine64 pulseaudio[13903]: [avahi-ml] module-zeroconf-publish.c: avahi_entry_group_add_service_strlst(): Local name collision jun 07 12:58:12 pine64 pulseaudio[13903]: [avahi-ml] module-zeroconf-publish.c: avahi_entry_group_add_service_strlst(): Local name collision jun 07 12:58:12 pine64 pulseaudio[13903]: [avahi-ml] module-zeroconf-publish.c: avahi_entry_group_add_service_strlst(): Local name collision jun 07 12:58:12 pine64 pulseaudio[13903]: [pulseaudio] module-zeroconf-publish.c: avahi_entry_group_add_service_strlst() failed: Local name collision jun 07 12:58:12 pine64 pulseaudio[13903]: [alsa-sink-SUNXI-CODEC codec-aif1-0] alsa-sink.c: ALSA woke us up to write new data to the device, but there was actually not jun 07 12:58:12 pine64 pulseaudio[13903]: [alsa-sink-SUNXI-CODEC codec-aif1-0] alsa-sink.c: Most likely this is a bug in the ALSA driver 'sunxi_sndcodec'. Please repor jun 07 12:58:12 pine64 pulseaudio[13903]: [alsa-sink-SUNXI-CODEC codec-aif1-0] alsa-sink.c: We were woken up with POLLOUT set -- however a subsequent snd_pcm_avail() r ``` On occasion it does work, don´t know why, but what i see then is that the backend is not pulseaudio but alsa. Anyone got any idea what this could be? my service file looks like this ``` [Unit] Description=Librespot Requires=network-online.target After=network-online.target [Service] User=jorrit Group=audio Restart=always RestartSec=10 ExecStart=/usr/bin/librespot -n "HomeHub" --backend pulseaudio --cache /home/jorrit/.cache/librespot/ --bitrate 320 [Install] WantedBy=multi-user.target ```
kerem closed this issue 2026-02-27 19:29:08 +03:00
Author
Owner

@QJKX commented on GitHub (Jun 13, 2018):

There's a pulseaudio process in the output of systemctl - instead what you probably wanted was for librespot to connect to the pulseaudio you already had running.

https://blog.louiz.org/pulseaudio_mpd looks relevant

MPD could not find the already-running pulseaudio instance because the environment variable XDG_RUNTIME_DIR was not set, and that’s where pulseaudio stores its files (the socket, the process pid, etc).

<!-- gh-comment-id:397118343 --> @QJKX commented on GitHub (Jun 13, 2018): There's a pulseaudio process in the output of systemctl - instead what you probably wanted was for librespot to connect to the pulseaudio you already had running. https://blog.louiz.org/pulseaudio_mpd looks relevant > MPD could not find the already-running pulseaudio instance because the environment variable XDG_RUNTIME_DIR was not set, and that’s where pulseaudio stores its files (the socket, the process pid, etc).
Author
Owner

@jorritsmit commented on GitHub (Jun 14, 2018):

you are correct, adding Environment=XDG_RUNTIME_DIR=/run/user/1000 fixed it. Thanks!

<!-- gh-comment-id:397276827 --> @jorritsmit commented on GitHub (Jun 14, 2018): you are correct, adding Environment=XDG_RUNTIME_DIR=/run/user/1000 fixed it. Thanks!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/librespot#155
No description provided.