Listen Spotify on Raspberry Headless

Posted on

Two weeks ago I see an interesting project shared on Twitter Spotifyd. Tweet talk about the move from C to Rust for spotify daemon. Good to know, one project on Rust. As many people Spotify is my main music source (phone, car, home …), in my home office I use a Raspberry Pi to have an AirPlay audio (shairplay) but it doesn’t fit my needs so I decide to move on “spotifyd”.


As explained on their github wiki repository it’s very easy and quick (if you use released binaries).

sudo mv spotifyd /usr/bin/


I take sometime to understand what is the device required by Spotifyd and answer is easy hw:0 (audio jack on raspberrypi) or hw:1 (hdmi output). The ID can change and there are a lot of command to help you but at the end it will be hw:XXX.

I have also set volume-control to softvol, Spotify sound level is linked to mixer sound card; I found it more easy to have only one sound slider (else you need to manage it on Spotify and Raspberry Pi).

If you have multiple Spotify Connect device in your home you should update device_name to understable name.

You need to set your username and password. To get it open Spotify on your computer click on your profile image and “Account” you will be redireted on Spotify account directly; now click “Set a device password” you can see your username (set of numbers). Ask to receive your password by email and set it !

In my case the page is on

My configuration (~/.config/spotifyd/spotifyd.conf) look’s like this:

username = 1122334455
password = it's-a_terrible_password
backend = alsa
device = hw:0
# Given by `aplay -L`
mixer = PCM
volume-control = softvol
device_name = office
bitrate = 96|160|320
cache_path = cache_directory
volume-normalisation = true
normalisation-pregain = -10

Start on boot (Systemd can be love …)

With official Spotifyd documentation I got some error like:

Failed to get D-Bus connection: Connection refused

To fix this I have set systemd service in my home directory

mkdir ~/.config/systemd/user/
nano ~/.config/systemd/user/spotifyd.service
systemctl --user daemon-reload

file spotifyd.service:

Description=A spotify playing daemon

ExecStart=/usr/bin/spotifyd --no-daemon


P.S.: I have suggested to Spotifyd wiki my solution may be it will be accepted

Run some systemd actions as user (no sudo no root) - reload systemd configuration systemctl --user daemon-reload - verify the status: systemctl --user status spotifyd - start the service: systemctl --user start spotifyd - check it again: systemctl --user status spotifyd - enable the autostart: systemctl --user enable spotifyd

If your service is Active: active (running) you can chek your Spotify application on your phone or computer and you will see a new Spotify Connect device available.

Else if you have problems you can see errors with: - status: systemctl --user status spotifyd - logs : journactl -u spotifyd -eax

You can also try to debug by running spotifyd on console (run with your username and not root)

~ $ whoami
~ $ spotifyd --no-daemon -v --config ~/.config/spotifyd/spotifyd.conf

Let’s music play

Now I can play Spotify on my connected speakers over Raspberry Pi and also use my computer speakers to listen call / videos / notifications without problem (no more outpout sound switching)