Running Spotify Connect on a Raspberry Pi Zero W

By  •  Updated: 19/07/26 • 

The original Pi Zero W (and Zero WH) uses an ARMv6 chip. Both raspotify and prebuilt spotifyd dropped ARMv6 support years ago, and the old legacy binaries that still float around the internet are unreliable — cross-compiled versions can crash or fail to load, and stale versions eventually get rejected by Spotify’s servers. The only durable fix is compiling librespot from source, directly on the Pi. It’s slow (multiple hours on a single ARM11 core) but it’s a one-time cost and gives you a client that actually stays compatible.


1. Flash the SD card

Use Raspberry Pi Imager:

  1. Choose Raspberry Pi OS Lite (32-bit) — no desktop needed for a headless audio device.
  2. Click the gear icon (or Ctrl+Shift+X) for advanced options and set:
    • Hostname (e.g. spotifypi)
    • Enable SSH, set a username/password
    • Wi-Fi SSID/password + correct country code
  3. Flash, then boot the Pi.

2. Find it and SSH in

ping spotifypi.local
ssh <username>@spotifypi.local

(If .local resolution doesn’t work, check your router’s DHCP client list for the IP instead.)

3. Update the system

sudo apt update && sudo apt full-upgrade -y
sudo reboot

4. Connect and configure the USB sound card

Plug in your USB audio dongle, then confirm it’s detected:

lsusb
cat /proc/asound/cards

Note the card index (usually 0 on a fresh boot, but the Pi’s own HDMI/headphone output can sometimes claim index 0 instead — check the output rather than assuming).

Set it as the ALSA default. Using dmix here (rather than a raw hw device) means multiple programs — like this Spotify client and any other script that plays sounds — can use the sound card at the same time without fighting over exclusive access:

sudo nano /etc/asound.conf
pcm.dmixer {
    type dmix
    ipc_key 1024
    slave {
        pcm "hw:0,0"
        period_time 0
        period_size 1024
        buffer_size 4096
        rate 44100
    }
}

pcm.!default {
    type plug
    slave.pcm "dmixer"
}

ctl.!default {
    type hw
    card 0
}

(Swap hw:0,0 / card 0 for whatever index cat /proc/asound/cards actually showed.)

Test it:

speaker-test -D default -c2 -t wav

5. Rule out power issues before you start a long compile

Pi Zero power budgets are tight, and a flaky USB connection or undervoltage can cause the sound card to silently drop mid-stream. Check now, so you’re not debugging it later:

vcgencmd get_throttled

0x0 = clean. Anything else means the Pi has hit undervoltage — use a proper 5V/2.5A+ power supply and a short, decent-quality USB cable if so.

6. Add swap before compiling

The Pi Zero has 512MB RAM, and compiling Rust (especially the linking stage) can exceed that. Check what you’ve got and add more if needed:

free -h

If swap is small or absent:

sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

7. Install the build toolchain

sudo apt install -y cargo rustc pkg-config libssl-dev libasound2-dev build-essential tmux

8. Point cargo’s temp/build directory away from /tmp

On many Raspberry Pi OS builds /tmp is a small RAM-backed tmpfs (often ~200MB), which is nowhere near enough for a Rust build. Redirect it to the SD card:

mkdir -p ~/cargo-build-tmp

9. Compile librespot inside tmux

Check first whether your terminal is already inside a tmux session (some SSH clients/terminal apps do this automatically):

echo $TMUX

Then run the actual build:

TMPDIR=$HOME/cargo-build-tmp cargo install librespot --locked --features alsa-backend

This will take several hours (in testing, ~13 hours on a Pi Zero W). It’ll sit quietly for long stretches — that’s normal, not a hang. If you want to double check it’s alive rather than stuck:

ps aux | grep rustc
vmstat 1 5

If rustc shows real CPU usage, it’s working. Once you’re confident it’s progressing, detach (Ctrl+B then D) and it’ll keep running in the background, surviving SSH disconnects. Reattach anytime with tmux attach -t librespot-build.

When it finishes, confirm:

~/.cargo/bin/librespot --version

10. Set up the systemd service

Create a cache directory (stores the paired session so you don’t have to reconnect from Spotify every restart):

mkdir -p ~/.cache/librespot

Create the service file:

sudo nano /etc/systemd/system/librespot.service
[Unit]
Description=Librespot Spotify Connect Client
Wants=sound.target
After=sound.target network-online.target
Wants=network-online.target

[Service]
Type=simple
User=<your-username>
ExecStart=/home/<your-username>/.cargo/bin/librespot --name "Your Device Name" --backend alsa --device default --cache /home/<your-username>/.cache/librespot --system-cache /home/<your-username>/.cache/librespot --initial-volume 70
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

Replace <your-username> and the --name value. Save and exit.

Enable and start it:

sudo systemctl daemon-reload
sudo systemctl enable --now librespot
sudo systemctl status librespot

It’s enabled (not just started), so it’ll come back automatically on every reboot.

11. Test it

Open Spotify on your phone or laptop (same Wi-Fi network — Zeroconf discovery relies on mDNS, which requires both devices on the same subnet with AP isolation off on your router). Tap the devices/cast icon, select your Pi by name, and hit play.


Troubleshooting notes

Try Running Spotify Connect on a Raspberry Pi Zero W

Steve Pratley

I build email lists, that grow into businesses.

The Conversion Co.