# Headless Raspberry + Plexamp paired with Snapcast

**URL:** <https://forums.plex.tv/t/headless-raspberry-plexamp-paired-with-snapcast/374263>\
**Category:** Plex Labs\
**Tags:** plexamp\
**Created:** [February 10, 2019, 10:08pm UTC](https://forums.plex.tv/t/headless-raspberry-plexamp-paired-with-snapcast/374263 "2019-02-10T22:08:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chewyf5](https://avatars.discourse-cdn.com/v4/letter/c/3d9bf3/32.png) [@chewyf5](https://forums.plex.tv/u/chewyf5)\
**Post date:** [February 10, 2019, 10:08pm UTC](https://forums.plex.tv/t/headless-raspberry-plexamp-paired-with-snapcast/374263/1 "2019-02-10T22:08:36Z")

</div>

Hello Community,  
At home, I run Snapcast as my main audio distribution system. My Problem - i was not able to “pair” my plex sound output on a headless Raspberry (and have a cool remote feature). Now Plexamp solved my problem. Its a little complicated but the result is - from my point of view - awesome.

First of all, this is a hack based on [plexamp-v1.0.5-pi.tar.gz](https://files.plexapp.com/elan/plexamp-v1.0.5-pi.tar.gz) and a running snapcast setup. Why, because it is using my favorite audio player mpd 🙂 . I don’t know if modern versions still use mpd.

Second - I use a raspberry pi 3 with the latest raspbian in my setup

My long Way … ( if you don’t like to read this scolle down to the HowTo)

At the beginning I followed the install instructions of elan in his [post](https://forums.plex.tv/t/suggestions-for-the-future-headless-rpi-support/218187/56). Spoiler: It was not running as expected. Reason: the bundled mpd was not started correctly. After getting it running ( LD\_LIBRARY\_PATH=/home/pi/plexamp/resources/helpers/linux-arm ./mpd mpd.conf) I found out that the bundled mpd has no support for fifo output.  
So I tried to use the regular mpd from the debian/raspbian-repos. I used the bundled mpd config - changed the audio output to a pipe - and started the the repo-mpd with the config - success - the node server was able to connect - time for music right now …  
Not.  
Next Problem - no music at all - f\*\*\*. Thanks to the user StalkerSVR - he describes in his [post](https://forums.plex.tv/t/suggestions-for-the-future-headless-rpi-support/218187/104) how to get around the problem.  
Again fire-ing up the node server and - drum roll - it works.  
After some cleanup i can present the following HowTo

HowTo:

1. Configure Plexamp and MPD

- Login to your Raspberry and install all the necessary things (nodejs and repo-mpd)

> curl -sL [https://deb.nodesource.com/setup\_9.x](https://deb.nodesource.com/setup_9.x) | sudo -E bash -  
> sudo apt install -y nodejs mpd

- Download Plexamp and extract it

> wget [https://files.plexapp.com/elan/plexamp-v1.0.5-pi.tar.gz](https://files.plexapp.com/elan/plexamp-v1.0.5-pi.tar.gz)  
> tar -xzvf plexamp-v1.0.5-pi.tar.gz

- Change the the bundled mpd.conf for the use with snapcast

> nano plexamp/resources/helpers/linux-arm/mpd.conf .

- change audio output in the mpd.conf to a pipe and leave the rest _unchanged!!!_

> audio\_output {  
> type “fifo”  
> name “my pipe”  
> path “/tmp/plexfifo”  
> format “48000:16:2”  
> mixer\_type “software”  
> }

- copy it to /etc/ and correct the permissions

> sudo cp mpd.conf /etc/  
> sudo chown mpd:audio /etc/mpd.conf

- for some systemd-foobar _deactivate_ the mpd.service and the mpd.socket in systemd - otherwise the setup will not survive a restart … we will reactivate it later via rc.local

> sudo systemctl disable mpd.service  
> sudo systemctl disable mpd.socket

- patch the server.prod.js in /home/pi/plexamp/server/ as mentioned in the [post](https://forums.plex.tv/t/suggestions-for-the-future-headless-rpi-support/218187/104) of StalkerSVR (I uploaded an already patched version: [server.prod.js.patched.tar.gz](https://forums.plex.tv/uploads/default/original/3X/f/2/f2a8da16ce58934152ad2c860783663ee665c73c.gz) (693.4 KB))

> tar -xzvf server.prod.js.patched.tar.gz  
> cp server.prod.js.patched /home/pi/plexamp/server/server.prod.js

- Move everything to /opt/plexamp (I like my system cleaned up 😉 )

> sudo mkdir /opt/plexamp  
> sudo cp /home/pi/plexamp /opt/plexamp

yes - this results in /opt/plexamp/plexamp/ … for reason - I like to have my files on one place were i find them again

- create a directory for the server.json and link it to the directory /home/pi/.config/Plexamp

> sudo mkdir /opt/plexamp/config  
> mkdir /home/pi/.config  
> ln -s /opt/plexamp/config /home/pi/.config/Plexamp  
> chown -R pi:pi /opt/plexamp

- copy your server.json from an existing Plexamp Setup to the created directory

> scp :~/.config/server.json /opt/plexamp/config/

- edit the systemd service plexamp.service to use the new directory

> nano /opt/plexamp/plexamp/plexamp.service

change the ExecStart parameter to "/usr/bin/node /opt/plexamp/plexamp/server/server.prod.js

> ExecStart=/usr/bin/node /opt/plexamp/plexamp/server/server.prod.js

- copy the systemd service plexamp.service to your systemd directory

> sudo cp /opt/plexamp/plexamp/plexamp.service /lib/systemd/system

1. Configure the server of SnapCast

- For the first run we create the fifo and the permissions by hand - later (the history command is your friend) we copy the same commands to /etc/rc.local

> mkfifo /tmp/plexfifo  
> chown snapserver:snapserver /tmp/plexfifo  
> chmod 777 /tmp/plexfifo

- now we copy the same commands to the /etc/rc.local

> nano /etc/rc.local

- add the following commands

> mkfifo /tmp/plexfifo  
> chown snapserver:snapserver /tmp/plexfifo  
> chmod 777 /tmp/plexfifo  
> systemctl start mpd # mpd is started here for some systemd foobar  
> systemctl start plexamp # plexamp is started here for some systemd foobar

- open the snapserver config …

> nano /etc/default/snapserver

- … and add the the plexfifo to the server options

> -s pipe:///tmp/plexfifo?name=Plex&sampleformat=48000:16:2&mode=read

1. Start the beast

> sudo systemctl daemon-reload  
> sudo systemctl start mpd  
> sudo systemctl start plexamp  
> sudo systemctl restart snapserver

1. Pray 😉

2. If you have done everything right you can fire up a plexamp on your desktop or the plexapp on your phone - start a song, change the output to the plexamp player on your raspberry and enjoy the feeling of having the music everywhere

3. **Troubleshooting**  
As always the are minimal mistakes done by everyone (that includes me!). At first - start every service on a seperate console and check for errors

- for plexamp use the following command as the user pi

> /usr/bin/node /opt/plexamp/plexamp/server/server.prod.js

Check for errors like

> error: [MPD] Error connecting:Error: connect ECONNREFUSED 127.0.0.1:36600  
> If thats the case - mpd is not reachable

check you mpd config / disable mpd socket and service

- for mpd use the command as user pi

> mpd --no-deamon /etc/mpd.conf

- A good hint that something is going wrong is when mpd is not running on localhost:36600 - in that case check if you disabled mpd via systemd (this error costs me 1-2 h)

> systemctl stop mpd.service  
> systemctl stop mpd.socket  
> systemctl disable mpd.service  
> systemctl disable mpd.socket  
> systemctl start mpd.service

If ss -pant tells you that mpd is listening on localhost:36600 mpd is not the show stopper

> ss -pant  
> LISTEN 0 5 127.0.0.1:36600 _:_ users:((“mpd”,pid=487,fd=9))

- Check your rc.local - is the snapfifo create - are the permissions ok - ist mpd started in the rc.local ?

- Everything Ok - but I still don’t hear anything - CHeck if you changed to the right output in snapcast 😉

Kind Regards  
ChewyF5

P.S.:  
Files i created / used in this HowTo

- [server.prod.js.patched.tar.gz](https://forums.plex.tv/uploads/default/original/3X/f/2/f2a8da16ce58934152ad2c860783663ee665c73c.gz) (693.4 KB)
- [mpd.conf.tar.gz](https://forums.plex.tv/uploads/default/original/3X/f/7/f7e935cc6c199a5c66ee6474582414d04e885a5f.gz) (343 Bytes)
- [rc.local.tar.gz](https://forums.plex.tv/uploads/default/original/3X/9/c/9ce288c0750ea863446309d80d134da0299db108.gz) (452 Bytes)

.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [May 11, 2019, 10:08pm UTC](https://forums.plex.tv/t/headless-raspberry-plexamp-paired-with-snapcast/374263/2 "2019-05-11T22:08:39Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
