Thursday, November 8, 2012

Automatic TV, Music, (and possibly Movies) Download Server on Raspberry Pi

I have been playing with the raspberry pi rev.1 for a few days now, and I have decided that it has just enough power to run a SABnzbd+, Sickbeard, Couchpotato, Headphones server.

With the extra memory on the rev.2 board I figure I can allocate it to the CPU and probably squeeze out a little more speed in the unrar process for SABnzbd.

So... I ordered a new board from modmypi and am awaiting shipment at the moment.
I have made some progress on the rev.1 pi, but have run into lots, and lots of permissions issues with my nas4free 7.2 file server. Hopefully as time goes on I will be able to compile a nice easy guide to setting up a PiServer for all of you.

Lets get started:

Alright, to start out I want to lay down some ground rules for this guide. After doing a lot of homework on raspbian and SABnzbd+/sickbeard/headphones/couchpotato, I ran into some serious snags with file permissions.

I use services on several different machines and everything modifies files on shared drives over cifs/smb and NFS. There were really only a few situations where other internet denizens had similar issues and none of theme were able to find solutions that made me happy. There was a lot of unhelpful nonsense from forum users who didn't even seem to read the issue before responding. Okay, rant over.

I have no need to make things super secure. I have no need to assign special users and groups and file permissions to each and every service. So I am not going to. If you want to set everything up with super top secret special users and groups, go for it. No one has access to my network but myself...

This guide will help you to install several services on the raspberry pi, making it a headless server for downloading and automatically organizing TV, Movies, and Music.

In my case I already have a NAS running nas4free. My shares are visible over cifs/smb and NFS. If you want to use a USB drive or the internal SD memory you still can. The differences will only be the path to the storage location.

Preparing your Raspberry Pi

The instructions for flashing your SD card are available on the Raspberry Pi website.
Once your SD card has been flashed then you are ready to start here.

I used the Raspbian image.

Insert your SD card into the Pi, connect ethernet, video, and power. Once the Pi boots up it will automatically start the configuration script.
Go through each option carefully as follows:
  • expand the root file system to fill the SD card.
  • You can ignore the overscan options since this is going to be a headless server.
  • You can ignore the keyboard too, the generics will work fine.
  • I left my password unchanged because I am unconcerned with security.
    • I suggest leaving the Pi password alone and simply creating a new user. That is unless you are concerned about hackers breaking into your Pi and changing the shows that you are downloading... ?
  • Set your locale. Mine is of course en_us because I speak english and live in the US.
  • Set your timezone. Mine is US Pacific for the obvious reason of that's where I live.
  • Next is the memory split. This is dicey...
    • I can find absolutely NO anecdotal evidence to suggest a memory split on the Pi when in headless mode.
    • I am currently using a 496mb/16mb split for the CPU/GPU
      • I am occasionally experiencing kernel panics, but I haven't had a chance to figure out why. It may maybe possibly be due to the memory split. If you are having lots of trouble try allocating more memory to the GPU. Since we are not using the display at all I cannot see any reason why it needs any more than the minimal memory.
  • Overclocking is also a dicey subject.
    • Much of your experience will depend on three factors.
      • The power output of your power supply.
      • The individual personality of your board.
      • The temperament of the SD card that you are using.
  • Enable SSH
  • Boot Behavior should be set NOT to boot to the desktop.
  • Update just runs "apt-get update && upgrade" so it is up to you if you want to run it now or by SSH later.
    • I suggest running it now.
  • Click Finish and the Pi will reboot.


So here is the deal with SABnzbd+
I originally ran the python scripts from the tar.gz on the website and that is totally fine for you to do, but if you want to do that then you are probably not interested in this blog. Instead you want the easy way out. You want the nice simple method...

So here it is.

The Ubuntu repositories contain a super duper old and outdated version of SABnzbd+...
... and it will work just fine for you... seriously.

sudo apt-get install sabnzbdplus

sudo nano /etc/default/sabnzdbplus

Add the correct information to the text
USER= value to your raspberry pi username. 

sudo service sabnzbdplus start

This will run the startup script which is in your startup services at /etc/init.d/sabnzbdplus
You should be returned to a normal bash command line and the web interface will now be available on your local network. To access it simply point a web browser to the pi's ip address and sabnzbdplus' port. ie "" The default port is 8080.

If that has trouble check your raspberry pi's ip address again by running


Verified ip in hand try again.
If you still have trouble try "ipaddress:8080/sabnzbd/"
You should be greeted by the SAB web gui.

So now you can pop into the settings within the SAB gui to change your settings like download locations.

We will set up the minutia of each program later. First lets get Sickbeard and Headphones installed. It will bea easier that way for us to make everything play well together.

Installing Sickbeard

Various Sickbeard Guides
Installing Sickbeard - Debian based OS's [Hobo-Geek Guide]

Alright, so this one is a cop out, but the process for setting up sickbeard is really pretty simple if you just do what the guides say. I run mine as the default pi:raspberry user:password and added the user to my nas4free users so that file permissions are all cool on the NAS. You can check out the short guide I wrote on installing sickbeard to debian based OS's if you like. It is not tailored to the RasPi, but it should work. Comments if there is any trouble and I'll change the instructions!


After a massive amount of trial and error, homework, testing, pleading on forums, and generally sifting through the useless waist high swamp of conflicting information I was able to get my Raspberry Pi to automount network shares at boot.

Step #1 - Forget any ideas you may have about using SMB/CIFS.
Step #2 - Use NFS! Just enable it in your nas4free configuration window.
Step #3 - Build the mount points on your Pi.

To mount a share in linux, you need to create a folder for the data to go inside of. Typically drives are mounted into the /mnt directory. 

Open up a terminal:

sudo mkdir /mnt/some folder name that corresponds to the drive

Open up a terminal:

sudo nano /etc/fstab

This should open up your fstab in a terminal based text editor called nano.
I prefer to work in fullscreen when using nano... that sort of thing is your call.

What you see in the printout will be confusing. I suggest copying everything to an empty text file and saving it as a backup. That way you don't mess things up too bad...

Spaces in fstab really don't make a difference. One space between characters is the same as ten spaces or twelve or a million...

Here is the standard Raspbian fstab by default

# /etc/fstab: static file system information.
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sda1 during installation
UUID=104e21f5-22a9-4d53-8225-975cfd634ccd /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda5 during installation
UUID=867a0a88-75dd-486b-9f95-f98d6cd93eb6 none            swap    sw              0       0

Here is my modified fstab with the NFS shares set to mount at boot AFTER the network card has come online...

# /etc/fstab: static file system information.
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sda1 during installation
UUID=104e21f5-22a9-4d53-8225-975cfd634ccd /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda5 during installation
UUID=867a0a88-75dd-486b-9f95-f98d6cd93eb6 none            swap    sw              0       0
# NFS shares on nas4free server   /mnt/0.4tbsshdd1      nfs     defaults,_netdev        0       0   /mnt/0.5tbwdhdd1      nfs     defaults,_netdev        0       0   /mnt/1.5tbsghdd2      nfs     defaults,_netdev        0       0   /mnt/1.0tbsghdd1      nfs     defaults,_netdev        0       0   /mnt/2.0tbsghdd1      nfs     defaults,_netdev        0       0   /mnt/2.0tbsshdd1      nfs     defaults,_netdev        0       0   /mnt/2.0tbsshdd2      nfs     defaults,_netdev        0       0   /mnt/2.0tbwdhdd1      nfs     defaults,_netdev        0       0   /mnt/3.0tbsghdd1      nfs     defaults,_netdev        0       0

As you can see I have like a zillion separate drives mounted to my Pi.
I am too broke for a proper raid array so I just go for the single drive method.
It Isn't redundant but that 400gb drive has been under almost constant read write stress 24/7 for over six years without failing. Same goes for every drive I have ever bought to put inside a NAS. Someday I'll lose a 3TB drive and cry for a week, but until then I will stick to single drives.

Anyways, just add your NAS ip and share information in place of mine. My NAS mount points and shares are identical to my Pi mount points... that way they are easy to remember. nfs is the type of protocol. the rest is just about permissions and startup times and stuff and junk and wikipedia will help you out if you need more than just the template to use.

be sure to save alt+x and yes to overwrite.

Then test the fstab by typing: 

sudo mount -a

This invokes the fstab and mounts all the shares listed within.
You should have NO errors after inputting this command.
Check the mounted file systems

df -a

You should see stuff mounted in your new directories! If you don't then something is wrong and you probably got an error when you typed the mount command.
Leave comments and I will try to help you!

Configuring some directories

I already had download directories in place before I moved to the ras pi server, so once my nfs shares were mounted all I needed to do was input those folders into the program settings.


In progress... Having issues with CP on raspi

UPDATE: I spent months playing with couchpotato and am 100% convinced that it is designed to make me want to jump off a cliff. I cannot for the life of me get CP to work consistently. This is not a problem with the software running on the RasPi, but with Couchpotato itself. Having used sickbeard I was expecting more from couchpotato. No matter what OS (linux, windows, osx) I run the program from I have issues. Sometimes it will find a movie and download it, but tell you that it hasnt found it yet... this stops CP from post processing. Sometimes it just downloads 50 copies of one film. Sometimes it refuses to rename the file it downloaded. Sometimes it does everything perfectly. Sometimes it forgets that it already has a copy of a movie.

Basically, I am fed up with it... I have admitted to failure until such a time that the software is in better working order. I hope that you have better luck than I did.


In progress... Working well now, will add instructions asap!

UPDATE: Headphones runs beautifully on the RasPi! But... there are almost no index sites that list music downloads. After adding hundreds of artists and dozens upon dozens of index sites to Headphones, I still only have a few albums to show for it. I have to hand my head in defeat and say that torrents are still a better option for music than Usenet... There is torrent integration in headphones, but I have not yet had the time to try that route.


  1. My NAS uses a username and password - how do I cater to this is fstab? I get a 'access denied by server while mounting 192.19...'

  2. all good - here are the answers:


Blogger won't auto-notify the author of your comment, but he does reads through them every few days to post replies.