Hifi Zine
The enthusiast's audio webzine

PiDisk – adding the music services

This is the second part of a short series on PiDisk – an inexpensive music server based on the Raspberry Pi.

  • Part 1: An inexpensive music server – introduces the concept of the PiDisk and sets it up as a basic file server.
  • Part 2: Adding the music services (this article) – adds MinimServer and BubbleUPnP Server to the PiDisk so that it is a functioning music server (including streaming TIDAL and/or Qobuz).
  • Part 3: Syncing the music library – explains how to automatically synchronize your music library to the PiDisk over the network, and concludes with a few additional tips.

This article continues right where Part 1 left off.

PiDisk on left, PiStreamer on right - Raspberry Pi music server

PiDisk on left, PiStreamer with HifiBerry DIGI+ output card on right

As before (in Part 1), there will be an occasional reference to doing something on a Mac. The server itself has nothing to do with the Mac, but you do have to do various things on a regular computer and I’ve assumed in these articles that it’s an Apple Mac. It’s just a pragmatic decision.

Sections in Part 2:

7. Install Java

Java will be used by both MinimServer and BubbleUPnP Server. Install it with the following command, and type “Y”when prompted. This may take a few minutes:

pi@pidisk:~ $ sudo apt-get install oracle-java8-jdk

Confirm successful Java installation:

pi@pidisk:~ $ which java
pi@pidisk:~ $ java -version
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) Client VM (build 25.65-b01, mixed mode)

(A reminder: most of the commands in this article can simply be copied and pasted from this article into your Terminal window. You don’t have to re-type them.)

8. Install Minimserver

The following is largely based on http://minimserver.com/install-raspbian.html.

Go to http://minimserver.com/downloads/index.html and click on the MinimServer download next to “Linux ARM hard float:” – as of this writing it is named MinimServer-0.8.4-linux-armhf.tar.gz. You will get a “nagware” message asking for a donation – please do send a few quid to the developers to thank them for their efforts!

Open a new window in Terminal on your Mac. Copy the downloaded file to the Pi using the following command. You don’t have to type the full file name, but just the first few characters and then the Tab key for auto-completion. Make sure you have the command syntax correct! The colon and tilde at the end of this command are important. When prompted for a password, enter “raspberry”:

mymac:~ myname$ scp Downloads/MinimServer-0.8.4-linux-armhf.tar.gz pi@pidisk.local:~

Go back to the Terminal window that you are using to connect to the Pi. Unzip the download (you don’t have to type the full name of the file, just enter the first few characters and then press the Tab key for auto-completion):

pi@pidisk:~ $ tar xf MinimServer-0.8.4-linux-armhf.tar.gz 

Install MinimServer – note that this is being done as the “pi” user – no “sudo”:

pi@pidisk:~ $ minimserver/bin/setup 

Migrating autostart configuration
Acquiring root privilege for system configuration update...

MinimServer desktop integration is not available
MinimServer automatic startup is enabled

Do you want to change these settings (y/n)?

pi@pidisk:~ $ minimserver/bin/startc

MinimServer 0.8.4, Copyright (c) 2012-2016 Simon Nash. All rights reserved.
autoUpdate: installed package 'minimserver-0.8-update-87'
Enter command (? for help):
autoUpdate: relaunching runtime
>MinimServer 0.8.4 update 87, Copyright (c) 2012-2016 Simon Nash. All rights reserved.
starting MinimServer[pidisk]
Enter command (? for help):
>Enter content directory, or null to continue:
MinimServer[pidisk] is running
stopping MinimServer[pidisk]
MinimServer[pidisk] is stopped
pi@pidisk:~ $ sudo reboot

Wait a minute and then check that MinimServer has started up:

mymac:~ myname$ ssh pi@pidisk.local ps -ef | grep minim
pi         564     1  0 06:59 ?        00:00:00 tail -n 1 -f /home/pi/minimserver/data/minimserver.pipe
pi         565     1  0 06:59 ?        00:00:00 /bin/sh /home/pi/minimserver/bin/startd minimexec
pi         566   565  1 06:59 ?        00:00:05 java -jar /home/pi/minimserver/lib/mserver.jar --set watch.view=console --noprompt --nohup

And that’s it! Open a UPnP controller (BubbleUPnP or Kinsky). You should be able to select “MinimServer[pidisk]” as the library and play music from it.

9. Install MinimWatch

To configure and control MinimServer from your Mac, use the MinimWatch program. Go to the MinimServer downloads page again, download MinimWatch for OS X, open the .dmg file, and drag the MinimWatch application to your Applications folder. (Although I have not tried it, I expect the procedure will be similar for Windows or Linux.)

Before running MinimWatch, quit the instance of MinimServer running on your Mac (if there is one). Then run MinimWatch – you will get a minim in the menu bar with the same dropdown menu as when you ran MinimServer before:

MinimWatch menu

This time, however, the menu remotely controls the MinimServer running on the Raspberry Pi. If you add files to the PiDisk, for example, you can select Rescan to have MinimServer re-index the library. If you have trouble with MinimServer not finding the drive when it boots, open Properties and set a value for the DelayStart parameter.

You can see what happens on a reboot by forcing one now:

mymac:~ myname$ ssh pi@pidisk.local sudo reboot

The MinimWatch icon will go grey, then come back white. If it stays red, there is a problem.

MinimWatch red

10. Install BubbleUPnP Server

Log into the PiDisk:

mymac:~ myname$ ssh pi@pidisk.local

Create a directory for the download and change to it:

pi@pidisk:~ $ mkdir bubbleserver
pi@pidisk:~ $ cd bubbleserver

Download and unzip BubbleUPnP Server:

pi@pidisk:~/bubbleserver $ wget http://www.bubblesoftapps.com/bubbleupnpserver/BubbleUPnPServer-distrib.zip
2016-06-18 15:19:50 (288 KB/s) - ‘BubbleUPnPServer-distrib.zip’ saved [2867985/2867985]

pi@pidisk:~/bubbleserver $ unzip BubbleUPnPServer-distrib.zip
Archive:  BubbleUPnPServer-distrib.zip
  inflating: BubbleUPnPServerLauncher.jar  
  inflating: LICENCE.txt             
  inflating: bcprov-jdk16-146.jar    
  inflating: launch.bat              
  inflating: launch.sh  

Launch it for the first time. This will make it download the “real” server program:

pi@pidisk:~/bubbleserver $ sh launch.sh

Jun 18, 2016 3:22:16 PM com.bubblesoft.bubbleupnpserver.launcher.Main main
INFO: data dir: /home/pi/bubbleserver
Jun 18, 2016 3:22:17 PM com.bubblesoft.bubbleupnpserver.launcher.Main main
INFO: first time setup: downloading BubbleUPnPServer.jar, please wait...
Jun 18, 2016 3:22:40 PM com.bubblesoft.bubbleupnpserver.launcher.Main main
INFO: downloaded BubbleUPnPServer.jar successfully
Jun 18, 2016 3:22:42 PM com.bubblesoft.bubbleupnpserver.server.Main initDataDir
INFO: data directory: /home/pi/bubbleserver
Jun 18, 2016 3:22:42 PM com.bubblesoft.bubbleupnpserver.server.Main run
INFO: starting BubbleUPnP Server 0.9-update19...
logging to file enabled
[main (1)                    ] INFO     - 24:00:00.59  - Main                        : starting BubbleUPnP Server 0.9-update19...

Now press Ctrl-C on the keyboard to kill the process. What’s needed now is to start the BubbleUPnP server as a daemon aka a server process. To do this, create and edit a new script file, /etc/init.d/bubbleserver:

pi@raspberrypi:~ $ sudo nano /etc/init.d/bubbleserver

Paste the whole of the following into the script file, then press Ctrl-O to write the file, hit Return at the confirmation prompt, and press Ctrl-X to exit the editor.


# Provides:          bubbleserver
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: BubbleUPnP Server
# Description:       SImple start-stop script for BubbleUPnP server.
set -e

DAEMON_OPTS="-Xss256k -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dfile.encoding=UTF-8 -classpath /home/pi/bubbleserver -jar /home/pi/bubbleserver/BubbleUPnPServerLauncher.jar -logLevel OFF"

export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"

case "$1" in
        echo -n "Starting daemon: "$NAME
	start-stop-daemon --start --quiet --background --make-pidfile --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS
        echo "."
        echo -n "Stopping daemon: "$NAME
	# start-stop-daemon --stop --user 1000 --quiet --oknodo --make-pidfile --pidfile $PIDFILE
	kill -9 `cat $PIDFILE`; rm $PIDFILE
        echo "."
	echo "Usage: "$1" {start|stop}"
	exit 1

Make it executable:

pi@pidisk:~ $ sudo chmod a+x /etc/init.d/bubbleserver

Check that it starts:

pi@pidisk:~ $ sudo /etc/init.d/bubbleserver start
Starting daemon: bubbleserver.
pi@pidisk:~ $ ps -ef | grep bubble
root      1036     1 30 15:32 ?        00:00:09 /usr/bin/java ... -jar /home/pi/bubbleserver/BubbleUPnPServerLauncher.jar
root      1048  1015  0 15:32 pts/0    00:00:00 grep bubble

Install it so that it starts when you boot:

pi@pidisk:~ $ sudo update-rc.d bubbleserver defaults

Now reboot:

pi@pidisk:~ $ sudo reboot

Wait a minute, then open Safari on the address http://pidisk.local:58050. You can now configure BubbleUPnP Server as described in my earlier article How to Stream TIDAL to the Raspberry Pi, and use one of the controllers listed in that article to access your library and TIDAL (or Qobuz).

11. Back up your image

An SD card is not generally considered a very reliable storage medium, it’s probably a good idea to back it up at this point. Shut down your Pi:

mymac:~ myname$ ssh pi@pidisk.local sudo shutdown now

Then unplug the power, remove the SD card, and insert it into your Mac. Use the same program that you used to write it in the first place to make a backup copy. For example, in ApplePi Baker on the Mac, press the “Create Backup” button.

ApplePi Baker create backup

Once that’s done, eject it from your Mac, put it back in the Raspberry Pi, and reapply power. In future, you will be able to restore the backup image to another SD card that is the same size or larger.

Wrapping up (Part 2)

At this point, you have a functioning music server!  With the help of a controller app (some of my favorite choices weere given in this article), you can play back audio from your music library on the PiDisk to the Raspberry Pi streamer, as well as stream Tidal and play it on the streamer.

However, the method of loading files onto the PiDisk (dragging and dropping from the Finder) is not very good for a lot of large files. What we really want is an automated and network-aware method of doing so.

Until the next installment then.

Readers' comments

    Great article John, thanks for sharing.
    As BubbleUpnp is an openhome renderer, you can use the truly excellent Lumin app (iOS, andriod) as the control point, which is far the best app I have come across for this function.
    Looking forward to your last article.


    • Hi Milan, thank you for the comment, indeed Lumin app is my preferred controller choice on my iPad, I should perhaps add some links to the article.

Leave a Comment