Arch, Raspberry PI, MPD, DAC = Hi-Fi

Arch, Raspberry PI, MPD, DAC = Hi-Fi

Yesterday I setup a headless Raspberry PI Arch based MPD server. It was a breeze (for me) and I thought I’d like to share the procedure with you guys. If you intend to use a Debian image the guide below will not work without adapting the configuration for Debian – other guides cover this.

96Khz and 192Khz 24bit files work flawlessly.






  1. Get Arch linux image here:
  2. Write image to SD card:
  3. Before booting the Pi the first time it will be helpful to configure wireless using netctl so the machine can be accessed via ssh.
    sudo mount /dev/mmcblk0p5 /mnt
    cd /mnt/etc/netctl
    sudo vi wlan0-pi-conf

    Paste and adapt the following configuration to fit your needs:
    Description='Wireless network for my MPD Pi'

    Save file and cd away from dir.
    Activate profile:
    sudo ln -s /usr/lib/systemd/system/netctl-auto@.service /mnt/etc/systemd/system/
    sudo umount /mnt
  4. Transfer SD card to you PI and turn on power. Watch the wireless dongle to check for activity.
  5. Scan your network to identify with nmap (adjust ip-range to match your local network):
    nmap -sP
  6. ssh to the alarmpi.
    ssh -l root <alarmpi ip>

    password is root.
  7. Update system:
    Adjust /etc/pacman.d/mirrorlist to a country near you.
    Update system:
    pacman -Syu

    ssh back in to system after reboot.
  8. Install mpd and mpc:
    pacman -S mpd mpc alsa-utils

    Edit mpd.conf so it looks like this:
    user "mpd"
    pid_file "/run/mpd/"
    db_file "/var/lib/mpd/mpd.db"
    state_file "/var/lib/mpd/mpdstate"
    playlist_directory "/var/lib/mpd/playlists"
    music_directory "/media"
    mixer_type                   "software"
    audio_output {
        type            "alsa"
        name            "Cambridge Audio USB Audio 2.0"
        device          "hw:1,0"

    Create media dir
    mkdir /media

    You need to adjust audio_output variables to fit your external DAC and adjust music_directory to where you store your music.
    Read mpd.conf man page for more information on the variables.
    Since mpd will run as mpd change ownership of the mpd dirs:
    chown -R mpd /var/lib/mpd
    systemctl enable mpd
    systemctl start mpd

    Check for errors:
    journalctl -xn
  9. I've found that autofs is the most reliable solution for removable storage:
    pacman -S autofs
    echo "automount: files" >> /etc/nsswitch.conf
    echo "/-     /etc/autofs/auto.rpi" >> /etc/autofs/auto.master
    echo "/media/musik -fstype=ext4,async,nodev,nosuid :/dev/sda1" >> /etc/autofs/auto.rpi

    Enable autofs and cd to dir:
    systemctl enable autofs && systemctl start autofs
    cd /media/musik
    df -h
  10. Set /etc/localtime and setup ntpd (adjust zoneinfo link to your needs):
    rm /etc/localtime && ln -s /usr/share/zoneinfo/Europe/Copenhagen /etc/localtime
    systemctl enable systemd-timesyncd && systemctl start systemd-timesyncd
  11. Install mpdroid or similar app on your phone. Point the app to the ip of your rpi. Bonus info:
    You can add radio channel streams to mpd’s playlists. I’ve only tried m3u links.
    Example for Danish Radio’s Jazz station:
    wget && mpc load A22H.mp3.m3u

    Enjoy. If you have any questions please ask.