I am making an internet radio using a raspberry pi B+. I am using Music Player Daemon (MPD) and MPC. I have it mostly working as expected but I can not figure out how to get MPD to autostart when I turn on the pi. If I have MPD running and I do

sudo shutdown -h now

the pi will restart with it playing but if it turns off when MPD is not playing then I will have to remote into it and

mpc play

to get the music to start. I have tried using rc.local with

 /etc/init.d/mpd start

but that didn't work.

I am using the latest version of rasbian released in November 2018. The MPD service is enabled and running when it is powered on.

  • Have you checked this raspberry forums thread? – GramThanos Mar 2 at 0:26
  • @GramThanos maybe not the best link to share. It's from 2016 and I see references to Wheezy and other fairly old stuff – Dirk Mar 2 at 7:12
  • @Dirk I don't think it is a rasbian problem, and some debugging suggestions on that thread looks solid. – GramThanos Mar 2 at 13:05
  • I did read that thread but there were things it talked about which were over my head. Symlinks. Although I did check the status using 'service mpd status' and the service is running. I think that thread was more about the MPD service not running. – GreyHippo Mar 4 at 18:29

Use systemd instead of rc.local

$ sudo systemctl enable mpd
$ sudo systemctl start mpd  

This will cause mpd to start immediately, and be started during the boot process on each successive reboot.

  • That needs Raspbian Stretch - which includes /lib/systemd/system/mpd.service to get mpd started. Not sure that was in Jessie (and I don't have any system left running Jessie). – Dougie Mar 2 at 14:02
  • @Dougie: ? Huh? OP said, "I am using the latest version of rasbian released in November 2018" – Seamus Mar 2 at 21:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.