spotifyd
spotifyd copied to clipboard
Mpris does not work: Unhandled DBus message
Description I am trying to setup mpris support on a RasPi 4 running nixos, however I have no success in doing so. Playback is working fine and the process does not crash, but there are some error messages hinting at a DBus problem:
Jan 23 03:52:41 bemmer dbus-launch[42171]: Unhandled DBus message: (Signal, Some("/org/freedesktop/DBus"), Some("org.freedesktop.DBus"), Some("NameAcquired"))
Jan 23 03:52:41 bemmer dbus-launch[42171]: Unhandled DBus message: (Signal, Some("/org/freedesktop/DBus"), Some("org.freedesktop.DBus"), Some("NameAcquired"))
Lots of these steps are probably unnecessary. I just wanted to give a full description of what I am trying to do.
I believe the problem lies with spotifyd failing to connect to DBus correctly, however it does connect to it, because running it outside of dbus-launch fails with a different error message.
However, I have no idea how to debug this. I have thrown about 4 hours at the different solutions provided in #271 , #434 and #668
The service does not show up in any dbus-send output.
How can I debug this further?
To Reproduce
- Install NixOs on a rasperry pi 4
- Overlay the
spotifydpackage to compile with mpris support:
nixpkgs.overlays = [(self: super: {
spotifyd = super.spotifyd.override (old: {
withMpris = true;
});
})];
- Enable the spotifyd service using the following config:
services.spotifyd = {
enable = true;
settings.global = {
bitrate = 320;
zeroconf_port = 18572;
initial_volume = "30";
device_type = "computer";
use_mpris = true;
};
};
- Override the service config to run the
spotifydservice insidedbus-launchwith the same user as the desktop env:
systemd.services.spotifyd.serviceConfig = {
DynamicUser = lib.mkForce false;
User = "c3h";
ExecStart = lib.mkForce "${pkgs.dbus}/bin/dbus-launch ${pkgs.spotifyd}/bin/spotifyd --no-daemon --config-path ${ (pkgs.formats.toml {}).generate "spotify.conf" config.services.spotifyd.settings }";
};
- Allow the necessary ports through the firewall:
networking.firewall.allowedTCPPorts = [ 4070 config.services.spotifyd.settings.global.zeroconf_port ];
networking.firewall.allowedUDPPorts = [ 5353 ];
Full config can be found here (does not contain mpris feature overlay):
https://git.neulandlabor.de/Yuka/c3h-nixfiles
Expected behavior spotifyd connects to DBus allowing it to be controlled via mpris, i.e. using playerctl
Logs
Click to show logs
https://gist.github.com/busti/62b65728143f1f83ffe765c2c0f0b8d4
Jan 23 04:38:37 bemmer dbus-launch[45708]: shut down IO
Jan 23 04:38:37 bemmer dbus-launch[45708]: deregistering handle with poller
Jan 23 04:38:37 bemmer dbus-launch[45708]: dropping I/O source: 6
Jan 23 04:38:37 bemmer dbus-launch[45708]: loop poll - 52.435342ms
Jan 23 04:38:37 bemmer dbus-launch[45708]: loop time - Instant { tv_sec: 108257, tv_nsec: 995358833 }
Jan 23 04:38:37 bemmer dbus-launch[45708]: loop process, 15.333µs
Jan 23 04:38:56 bemmer systemd[1]: Stopping spotifyd, a Spotify playing daemon...
Jan 23 04:38:56 bemmer systemd[1]: spotifyd.service: Deactivated successfully.
Jan 23 04:38:56 bemmer systemd[1]: Stopped spotifyd, a Spotify playing daemon.
Jan 23 04:38:56 bemmer systemd[1]: spotifyd.service: Consumed 1.262s CPU time, received 9.0M IP traffic, sent 244.0K IP traffic.
Jan 23 04:38:58 bemmer systemd[1]: Started spotifyd, a Spotify playing daemon.
Jan 23 04:38:58 bemmer dbus-launch[46512]: Loading config from "/nix/store/wk5dxnsg8lnyiblbgz0mp0pzd8c9rym3-spotify.conf"
Jan 23 04:38:58 bemmer dbus-launch[46512]: No username specified. Checking username_cmd
Jan 23 04:38:58 bemmer dbus-launch[46512]: No username_cmd specified
Jan 23 04:38:58 bemmer dbus-launch[46512]: No password specified. Checking password_cmd
Jan 23 04:38:58 bemmer dbus-launch[46512]: No password_cmd specified
Jan 23 04:38:58 bemmer dbus-launch[46512]: No proxy specified
Jan 23 04:38:58 bemmer dbus-launch[46512]: Using software volume controller.
Jan 23 04:39:08 bemmer dbus-launch[46512]: Connecting to AP "ap-gew1.spotify.com:443"
Jan 23 04:39:08 bemmer dbus-launch[46512]: Authenticated as "6ug8p3g1e02rq9ywxuvyjpnnh" !
Jan 23 04:39:08 bemmer dbus-launch[46512]: Using alsa sink
Jan 23 04:39:08 bemmer dbus-launch[46512]: Country: "DE"
Jan 23 04:39:08 bemmer dbus-launch[46512]: Unhandled DBus message: (Signal, Some("/org/freedesktop/DBus"), Some("org.freedesktop.DBus"), Some("NameAcquired"))
Jan 23 04:39:08 bemmer dbus-launch[46512]: Unhandled DBus message: (Signal, Some("/org/freedesktop/DBus"), Some("org.freedesktop.DBus"), Some("NameAcquired"))
Jan 23 04:39:08 bemmer dbus-launch[46512]: Loading <Bad Blood> with Spotify URI <spotify:track:273dCMFseLcVsoSWx59IoE>
Jan 23 04:39:09 bemmer dbus-launch[46512]: <Bad Blood> (211933 ms) loaded
Jan 23 04:39:14 bemmer dbus-launch[46512]: Loading <Getaway Car> with Spotify URI <spotify:track:5YPTYLMdNEgk7CPNPqqFyA>
Jan 23 04:39:14 bemmer dbus-launch[46512]: <Getaway Car> (233626 ms) loaded
Compilation flags
- [x] dbus_mpris
- [ ] dbus_keyring
- [x] alsa_backend
- [ ] portaudio_backend
- [ ] pulseaudio_backend
- [ ] rodio_backend
Versions (please complete the following information):
- OS: nixos-unstable; aarch64; 22.05pre-git (Quokka); rev: 581d2d6c9cd5c289002203581d8aa0861963a933
- Spotifyd: 0.3.2
- cargo: 1.57.0
Hi and thanks for the detailed report!
The Unhandled DBus message: ... NameAcquired are quite normal as they only tell us that spotifyd received signals that it does not care about (in this case that services appeared on the bus).
I think that the real problem is the dbus-launch thing. I have never used that before, but as far as I understand (source), it creates a new session bus for this project, which you could connect to and does not use the existing session. So I assume that, when you use dbus-send from your normal environment, it uses a different session bus and not the one that was specifically created for spotifyd.
Thus, you should try to start spotifyd from within your session (e.g. through systemctl --user) or somehow provide it with the $DBUS_SESSION_BUS_ADDRESS environment variable to be able to reach it with dbus-send.
Hope this helps you get further!
Mpris issue with gnome40/41/42 and playerctld as well. Only the first song is updated. After that mpris controller is UN-responsive. The buttons do work, but state is not updated.
.
@aniketfuryrocks That is probably not related to this issue, but rather the missing implementation of the org.freedesktop.DBus.Properties.PropertiesChanged signal. There is #1025 that aims to fix that.
Sorry for not replying immediately btw. I am having finals right now, I will get back to this once they are over.
@aniketfuryrocks That is probably not related to this issue, but rather the missing implementation of the
org.freedesktop.DBus.Properties.PropertiesChangedsignal. There is #1025 that aims to fix that.
#1025 is merged now, so hopefully that's cleared up.