{"id":925,"date":"2017-08-05T13:04:59","date_gmt":"2017-08-05T11:04:59","guid":{"rendered":"http:\/\/hannes.enjoys.it\/blog\/?p=925"},"modified":"2017-08-05T13:04:59","modified_gmt":"2017-08-05T11:04:59","slug":"turn-a-raspberry-into-a-no-fancyshmancy-mpd-server-with-archlinux-arm","status":"publish","type":"post","link":"https:\/\/hannes.enjoys.it\/blog\/2017\/08\/turn-a-raspberry-into-a-no-fancyshmancy-mpd-server-with-archlinux-arm\/","title":{"rendered":"Turn a Raspberry into a no-fancyshmancy mpd server with Archlinux ARM"},"content":{"rendered":"<p>Because my SD card keeps getting corrupted and I always start from scratch, here are my notes on how to turn a Raspberry Pi 2 with an always connected USB disk full of audio media into a nice little mpd server outputting via the 3.5mm jack. Probably works <i>somewhat<\/i> the same on a Raspberry Pi 3.<\/p>\n<h3>Install Archlinux ARM<\/h3>\n<p>Install <a href=\"https:\/\/archlinuxarm.org\/platforms\/armv7\/broadcom\/raspberry-pi-2#installation\">https:\/\/archlinuxarm.org\/platforms\/armv7\/broadcom\/raspberry-pi-2#installation<\/a><br \/>\nAnd obviously update it right after, add your ssh key, whatever. Then:<\/p>\n<p>Add packages to build a special mpd, sound stuff and common utils:<br \/>\n<code># pacman -Syu screen wget zip base-devel libmikmod unzip zziplib git doxygen boost alsa-utils hdparm ffmpeg htop libao audiofile libshout libmad faad2 libupnp libmms wavpack avahi libid3tag yajl libmpdclient<\/code><\/p>\n<h3>Get sound working<\/h3>\n<p>Add to \/boot\/config.cfg:<\/p>\n<blockquote>\n<pre>dtparam=audio=on  # https:\/\/archlinuxarm.org\/platforms\/armv7\/broadcom\/raspberry-pi-2#wiki\r\ndisable_audio_dither=1  # if you get white noise on low volume, https:\/\/www.raspberrypi.org\/documentation\/configuration\/config-txt\/audio.md\r\naudio_pwm_mode=2  # better audio driver, https:\/\/www.raspberrypi.org\/forums\/viewtopic.php?f=29&t=136445<\/pre>\n<\/blockquote>\n<p>Make sure audio output is enabled, not muted, in <code># alsamixer<\/code>.<br \/>\n<code># speaker-test -c6 -twav<\/code><\/p>\n<h3>Connect and mount external disk with all your media<\/h3>\n<p>Connect USB disk. Check UUID using <code>ls -l \/dev\/disk\/by-uuid\/<\/code> or <code>lsblk -f<\/code>, add it to \/etc\/fstab at a mount point of your choice:<br \/>\n<code>UUID=12341234-1234-1234-1234-123412341234        \/media\/egon    ext4    defaults,nofail,x-systemd.device-timeout=1    0  2<\/code><br \/>\nand made sure that it can spin down by adding \/etc\/udev\/rules.d\/50-hdparm.rules (you might want to verify the hdparm call works first):<br \/>\n<code>ACTION==\"add|change\", KERNEL==\"sd[a-z]\", ATTR{queue\/rotational}==\"1\", RUN+=\"\/usr\/bin\/hdparm -B 1 -S 60 -M \/dev\/%k\"<\/code><br \/>\nThen check if things work with <code># mount -a<\/code><\/p>\n<h3>Compile mpd with zip and curl support (optional, if not wanted, just install mpd from the repos)<\/h3>\n<p>I compiled my own mpd because I wanted zip support and Archlinux&#8217;s does not ship with that.<br \/>\n<code>$ wget <a href=\"https:\/\/aur.archlinux.org\/cgit\/aur.git\/snapshot\/mpd-git.tar.gz\">https:\/\/aur.archlinux.org\/cgit\/aur.git\/snapshot\/mpd-git.tar.gz<\/a><br \/>\n$ tar xfvz mpd-git.tar.gz<br \/>\n$ cd mpd-git<br \/>\n$ nano PKGBUILD<\/code><br \/>\nAdd &#8216;armv7h&#8217; to the archs<\/p>\n<p>and add some fancy configure options:<\/p>\n<blockquote>\n<pre>\r\n      --enable-zzip \\\r\n      --enable-mikmod \\\r\n      --enable-modplug \\\r\n      --enable-curl <\/pre>\n<\/blockquote>\n<p><code>$ makepkg<br \/>\n# pacman -U <strong>the resulting package<\/strong><\/code><br \/>\nTakes about 30 minutes.<\/p>\n<h3>Configure mpd<\/h3>\n<p>\/etc\/mpd.conf:<\/p>\n<blockquote>\n<pre>user \"mpd\"\r\npid_file \"\/run\/mpd\/mpd.pid\"\r\ndb_file \"\/var\/lib\/mpd\/mpd.db\"\r\nstate_file \"\/var\/lib\/mpd\/mpdstate\"\r\nplaylist_directory \"\/var\/lib\/mpd\/playlists\"\r\nmusic_directory    \"\/media\/egon\"\r\n\r\naudio_output {\r\n  type            \"alsa\"\r\n  name            \"default\"\r\n  mixer_type      \"software\"      # optional\r\n}<\/pre>\n<\/blockquote>\n<p><code># systemctl enable mpd<br \/>\n# systemctl start mpd<\/code><\/p>\n<h3>WLAN<\/h3>\n<p>TODO ;)<\/p>\n<p>Once it all works, make an image of it so that next time installation is just dd.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Because my SD card keeps getting corrupted and I always start from scratch, here are my notes on how to turn a Raspberry Pi 2 with an always connected USB disk full of audio media into a nice little mpd server outputting via the 3.5mm jack. Probably works somewhat the same on a Raspberry Pi [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,13,36],"tags":[],"class_list":["post-925","post","type-post","status-publish","format-standard","hentry","category-linux","category-mpd","category-raspberry-pi"],"_links":{"self":[{"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/posts\/925","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/comments?post=925"}],"version-history":[{"count":15,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/posts\/925\/revisions"}],"predecessor-version":[{"id":940,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/posts\/925\/revisions\/940"}],"wp:attachment":[{"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/media?parent=925"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/categories?post=925"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hannes.enjoys.it\/blog\/wp-json\/wp\/v2\/tags?post=925"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}