RaspberryPi – rPiDownloader Part 2 – Adding SABnzbd, Sick Beard and Couch Potato

This is part two of a series showing how to get a Raspberry Pi working as a great little unified downloader-appliance. The aim is to get a system that will provide an easy way of monitoring a collection of TV series for new or old episodes using Sick Beard, grab new movies using Couch Potato, and download them all seamlessly using SABnzbd. The end-result will be a completely web-based easy-to-use appliance!

In this second part, we’ll be adding SABnzbd, Sick Beard and Couch Potato to our Pi…

We’re going to be installing the apps into the /usr/local directory.  The data will be in /var We’ll also create users for each service to keep things nice and safe.

There are some pre-requisites we need first:

sudo apt-get -y install python2.6 python-cheetah python-openssl par2

Some of the apps we’ll be using, especially SABnzbd, are particular about the version of unrar they use, so we should install the non-free ‘official’ version. We need to build that from source (thanks to Anonymous for the steps):

sudo sh -c "echo \"deb-src http://mirrordirector.raspbian.org/raspbian/ wheezy main contrib non-free rpi\" >> /etc/apt/sources.list"
sudo apt-get update
sudo apt-get -y build-dep unrar-nonfree
sudo apt-get source -b unrar-nonfree
sudo dpkg -i unrar*.deb

You’re going to need to know your IP address, and wherever you see the address “172.29.14.110”, replace that with your IP address.

We’re going to use a usergroup for each of the service users, so set that up first:

sudo addgroup nzb

SABnzbd

Now we are ready to grab SABnzbd. Rather than use the full wget URL I’ve used here, go to the SABnzbd SourceForge site and copy the “download now” link from there, to make sure you get the latest “source” version.

Create the user for SABnzbd:

sudo useradd --system --user-group --no-create-home --groups nzb sabnzbd

Download SABnzbd, extract it and move it to the correct location, and set the permissions required:

wget http://downloads.sourceforge.net/project/sabnzbdplus/sabnzbdplus/0.7.3/SABnzbd-0.7.3-src.tar.gz
tar xzf SABnzbd-0.7.3-src.tar.gz
sudo mv SABnzbd-0.7.3 /usr/local/sabnzbd
sudo chown -R sabnzbd:nzb /usr/local/sabnzbd

Create a directory to hold the data:

sudo mkdir /var/sabnzbd
sudo chown sabnzbd:nzb /var/sabnzbd

Try it out (replace the ip address with yours!), this will also create the necessary config files:

sudo su sabnzbd -c "/usr/local/sabnzbd/SABnzbd.py -f /var/sabnzbd -s 172.29.14.110:8080"

You should now be able to point your browser to the SABnzbd address, and complete the wizard. I would strongly recomment You must set a username and password on Step Two, to restrict access. Bear in mind that the rPi has limited resources, so don’t max out the NNTP server connections. For example, my provider allows 50 connections, but just put 5 for the rPi.

Now that all works, press [Ctrl]+[C] to kill the server for now.

Sick Beard

sudo useradd --system --user-group --no-create-home sickbeard
git clone git://github.com/midgetspy/Sick-Beard.git
sudo mv Sick-Beard /usr/local/sickbeard
sudo chown -R sickbeard:nzb /usr/local/sickbeard
sudo chmod ug+rw /usr/local/sickbeard/autoProcessTV/
sudo mkdir /var/sickbeard
sudo chown sickbeard:nzb /var/sickbeard

Fire it up to create the config files and try it:

sudo su sickbeard -c "/usr/local/sickbeard/SickBeard.py --datadir /var/sickbeard --config /var/sickbeard/sickbeard.ini"

Test it! http://172.29.14.110:8081

CouchPotato

sudo useradd --system --user-group --no-create-home couchpotato
git clone git://github.com/RuudBurger/CouchPotatoServer.git
sudo mv CouchPotatoServer /usr/local/couchpotato
sudo chown -R couchpotato:couchpotato /usr/local/couchpotato
sudo mkdir /var/couchpotato
sudo chown -R couchpotato:couchpotato /var/couchpotato
sudo su couchpotato -c "/usr/local/couchpotato/CouchPotato.py --data_dir=/var/couchpotato --config_file=/var/couchpotato/couchpotato.ini"

Test at http://172.29.14.110:5050. Again, [Ctrl]+[C] will terminate it.

Auto-Start

To enable all three services to run automatically at startup, we need to create three init scripts and register them.

SABnzbd

Create an init file by typing the next command, and then copying the following text:

sudo nano /etc/init.d/sabnzbd
#!/bin/sh
### BEGIN INIT INFO
# Provides:          SABnzbd
# Required-Start:    $network $remote_fs $syslog
# Required-Stop:     $network $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start SABnzd at boot time
# Description:       Start SABnzbd.
### END INIT INFO

case "$1" in
start)
  echo "Starting SABnzbd."
  /usr/bin/sudo -u sabnzbd -H /usr/local/sabnzbd/SABnzbd.py -d -f /var/sabnzbd/sabnzbd.ini
;;
stop)
  echo "Shutting down SABnzbd."
  p=`ps aux | grep -v grep | grep SABnzbd.py | tr -s \ | cut -d ' ' -f 2`
  if [ -n "$p" ]; then
    kill -2 $p > /dev/null
    while ps -p $p > /dev/null; do sleep 1; done
  fi
;;
*)
  echo "Usage: $0 {start|stop}"
  exit 1
esac
exit 0
sudo chmod 755 /etc/init.d/sabnzbd
sudo update-rc.d sabnzbd defaults
sudo /etc/init.d/sabnzbd start

Sick Beard

sudo nano /etc/init.d/sickbeard
#!/bin/sh
### BEGIN INIT INFO
# Provides:          SickBeard
# Required-Start:    $network $remote_fs $syslog
# Required-Stop:     $network $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start SickBeard at boot time
# Description:       Start SickBeard.
### END INIT INFO

case "$1" in
start)
  echo "Starting SickBeard."
  /usr/bin/sudo -u sickbeard -H /usr/local/sickbeard/SickBeard.py -d --datadir /var/sickbeard --config /var/sickbeard/sickbeard.ini
;;
stop)
  echo "Shutting down SickBeard."
  p=`ps aux | grep -v grep | grep SickBeard.py | tr -s \ | cut -d ' ' -f 2`
  if [ -n "$p" ]; then
    sb_api_key=`grep -m 1 api_key ${sb_config} | cut -d ' ' -f 3`;
    sb_port=`grep -m 1 web_port ${sb_config} | cut -d ' ' -f 3`;
    wget -q --delete-after http://localhost:${sb_port}/api/${sb_api_key}/\?cmd=sb.shutdown
    while ps -p $p > /dev/null; do sleep 1; done
  fi
;;
*)
  echo "Usage: $0 {start|stop}"
  exit 1
esac

exit 0
sudo chmod 755 /etc/init.d/sickbeard
sudo update-rc.d sickbeard defaults
sudo /etc/init.d/sickbeard start

Couch Potato

sudo nano /etc/init.d/couchpotato
#!/bin/sh
### BEGIN INIT INFO
# Provides: CouchPotato
# Required-Start: $network $remote_fs $syslog
# Required-Stop: $network $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start CouchPotato at boot time
# Description: Start CouchPotato.
### END INIT INFO
case "$1" in
start)
 echo "Starting CouchPotato."
 /usr/bin/sudo -u couchpotato -H /usr/local/couchpotato/CouchPotato.py --daemon --data_dirdir=/var/couchpotato --config_file=/var/couchpotato/couchpotato.ini
;;
stop)
 echo "Shutting down CouchPotato."
  p=`ps aux | grep -v grep | grep CouchPotato.py | tr -s \ | cut -d ' ' -f 2`
  couch_api_key=`grep -m 1 api_key /var/couchpotato/couchpotato.ini | cut -d ' ' -f 3`;
  couch_port=`grep -m 1 port /var/couchpotato/couchpotato.ini | cut -d ' ' -f 3`;
 wget -q --delete-after http://localhost:${couch_port}/api/${couch_api_key}/app.shutdown
 while ps -p $p > /dev/null; do sleep 1; done
;;
*)
 echo "Usage: $0 {start|stop}"
 exit 1
esac
exit 0
sudo chmod 755 /etc/init.d/couchpotato
sudo update-rc.d couchpotato defaults
sudo /etc/init.d/couchpotato start

That’s it. That’s the basics sorted. Everything should now be running and working, but nothing is configured specifically for being integrated, or for saving the files to the network. That’s next…

Special thanks to NASDestruction for getting me going, and comments below correcting my mistakes :)

(Edit 27/08/2012: completely changed the Couch Potato section to use the latest version)

Leave a comment ?

81 Comments.

  1. Great tutorial. I would add “apt-get install git-core” just before the sickbeard install as git is not installed from default build.

  2. thanks for the guide!

    two typos:
    1.
    sabnzbd autos tart script has wrong config file path

    2.
    autostart couch patato should read
    sudo nano /etc/init.d/couchpotato

  3. Thanks for sharing!

    sabnzbd seems fairy picky about its unrar though. Here’s how to install the non-free version. Maybe add this rather than suppressing the warning:
    add in /etc/apt/sources.list
    deb-src http://mirrordirector.raspbian.org/raspbian/ wheezy main contrib non-free rpi
    sudo apt-get update
    sudo apt-get build-dep unrar-nonfree
    sudo apt-get source -b unrar-nonfree
    sudo dpkg -i unrar*.deb

  4. Hey mate thanks for the tut.

    But i think you Sabnzbd auto start script doesnt work. You say i have to change the api key in the auto start script but can find that.

    • Ah, sorry about that. I’m still in the process of finalising the scripts. I actually found a way of not needing to enter the API key manually, so use the new script that’s there now.

  5. CouchPotato autostart script

    –data_dirdir=… gives an error. Changed to –data_dir=… and it sorted the situation. Great tutorial. Thanks

  6. Would be nice to also include Headphones in this guide :) although with SickBeard & Couchpotato examples it’s pretty self explanatory.

    sudo useradd –system –user-group –no-create-home headphones
    git clone git://github.com/rembo10/headphones.git
    sudo mv headphones /usr/local/headphones
    sudo chown -R headphones:headphones /usr/local/headphones
    sudo chmod ug+x /usr/local/headphones/Headphones.py
    sudo mkdir /var/headphones
    sudo chown -R headphones:headphones /var/headphones

    sudo su headphones -c “/usr/local/headphones/Headphones.py –datadir=/var/headphones –config=/var/headphones/headphones.ini”

    Test: http://:8181

  7. Thanks for the headphones guide – works great!!
    Can someone please assist with the script / init file to auto start headphones at boot??
    Greatly appreciated

  8. Hello!

    For Headphones auto start:


    cd /usr/local/headphones/
    sudo cp init.ubuntu /etc/init.d/headphones
    sudo chmod +x /etc/init.d/headphones
    sudo update-rc.d headphones defaults

    Hope it helps!
    /Arky

  9. Actually, there is a little change in the script:
    Change

    APP_PATH=/usr/local/sbin/headphones

    To

    APP_PATH=/usr/local/headphones

    Then it will work.

  10. Actually scratch that.

    Here is the script:

    sudo nano /etc/init.d/headphones


    ### BEGIN INIT INFO
    # Provides: headphones
    # Required-Start: $local_fs $network $remote_fs
    # Required-Stop: $local_fs $network $remote_fs
    # Should-Start: $NetworkManager
    # Should-Stop: $NetworkManager
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Short-Description: starts and stops headphones
    # Description: Automatic music downloader for SABnzbd. For more information see:
    # http://http://headphones.codeshy.com/forum/
    ### END INIT INFO

    #Required -- Must Be Changed!
    USER="xxxxxxx" #Set Linux Mint, Ubuntu, or Debian user name here.

    #Required -- Defaults Provided (only change if you know you need to).
    HOST="XXX.XXX.X.XX" #Set headphones address here.
    PORT="XXXX" #Set headphones port here.

    #Optional -- Unneeded unless you have added a user name and password to Headphones.
    SBUSR="XXXXXX" #Set Headphones user name (if you use one) here.
    SBPWD="XXXXXX" #Set Headphones password (if you use one) here.

    #Script -- No changes needed below.
    case "$1" in
    start)
    #Start Headphones and send all messages to /dev/null.
    cd /usr/local/headphones
    echo "Starting Headphones"
    sudo su headphones -c "/usr/local/headphones/Headphones.py --datadir=/var/headphones --config=/var/headphones/headphones.ini" > /dev/null 2>&1 &
    ;;
    stop)
    #Shutdown Headphones and delete the index.html files that wget generates.
    echo "Stopping Headphones"
    wget -q --user=$SBUSR --password=$SBPWD "http://$HOST:$PORT/shutdown/" --delete-after
    sleep 6s
    ;;
    *)
    echo "Usage: $0 {start|stop}"
    exit 1
    esac

    exit 0

  11. Sorry to intrude, but i seem to get the following:
    sudo apt-get update
    Err http://mirrordirector.raspbian.org whezzy/main Sources
    404 Not Found
    Err http://mirrordirector.raspbian.org whezzy/contrib Sources
    404 Not Found
    Err http://mirrordirector.raspbian.org whezzy/non-free Sources
    404 Not Found
    Err http://mirrordirector.raspbian.org whezzy/rpi Sources
    404 Not Found
    W: Failed to fetch http://mirrordirector.raspbian.org/raspbian/dists/whezzy/main/source/Sources 404 Not Found

    W: Failed to fetch http://mirrordirector.raspbian.org/raspbian/dists/whezzy/contrib/source/Sources 404 Not Found

    W: Failed to fetch http://mirrordirector.raspbian.org/raspbian/dists/whezzy/non-free/source/Sources 404 Not Found

    W: Failed to fetch http://mirrordirector.raspbian.org/raspbian/dists/whezzy/rpi/source/Sources 404 Not Found

    &

    [email protected] ~ $ sudo apt-get build-dep unrar-nonfree
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    E: You must put some ‘source’ URIs in your sources.list
    [email protected] ~ $ sudo apt-get source -b unrar-nonfree
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    E: You must put some ‘source’ URIs in your sources.list
    [email protected] ~ $ sudo dpkg -i unrar*.deb
    dpkg: error processing unrar*.deb (–install):
    cannot access archive: No such file or directory
    Errors were encountered while processing:
    unrar*.deb

    Can you help
    Thanks

  12. One change to the Couch Potato start script. the line

    /usr/bin/sudo -u couchpotato -H /usr/local/couchpotato/CouchPotato.py –daemon –data_dirdir=/var/couchpotato –config_file=/var/couchpotato/couchpotato.ini
    ;;

    the –data_dirdir=/var/couchpotato should be changed to

    –data_dir /var/couchpotato
    as there is an extra dir and the = is not needed. cheers.

  13. Nice tutorial, i changed your init.d scripts slightly to start everything with a nice value of 19, just so it doesn’t slow everything down when they are running.

    e.g.


    /usr/bin/sudo -u sabnzbd -H nice -n 19 /usr/local/sabnzbd/SABnzbd.py -d -f /var/sabnzbd/sabnzbd.ini

  14. For some reason couchpotato is no longer working. when trying to start couchpotato, i get these errors (can anyone help?):

    Starting CouchPotato.
    Traceback (most recent call last):
    File “/usr/local/couchpotato/CouchPotato.py”, line 127, in
    l = Loader()
    File “/usr/local/couchpotato/CouchPotato.py”, line 35, in __init__
    settings.setFile(self.options.config_file)
    File “/usr/local/couchpotato/couchpotato/core/settings/__init__.py”, line 61, in setFile
    self.p.read(config_file)
    File “/usr/lib/python2.7/ConfigParser.py”, line 305, in read
    self._read(fp, filename)
    File “/usr/lib/python2.7/ConfigParser.py”, line 546, in _read
    raise e
    ParsingError: File contains parsing errors: /var/couchpotato/couchpotato.ini
    [line 299]: ‘enab’

    Traceback (most recent call last):
    File “/usr/local/couchpotato/CouchPotato.py”, line 127, in
    l = Loader()
    File “/usr/local/couchpotato/CouchPotato.py”, line 35, in __init__
    settings.setFile(self.options.config_file)
    File “/usr/local/couchpotato/couchpotato/core/settings/__init__.py”, line 61, in setFile
    self.p.read(config_file)
    File “/usr/lib/python2.7/ConfigParser.py”, line 305, in read
    self._read(fp, filename)
    File “/usr/lib/python2.7/ConfigParser.py”, line 546, in _read
    raise e
    ConfigParser.ParsingError: File contains parsing errors: /var/couchpotato/couchpotato.ini
    [line 299]: ‘enab’

    • I had my CP set to send messages to my phone (via Pushover) – got a message the other morning telling my CouchPotato had updated itself to the latest version. Since the update I can’t access it and trying to start it manually gives me similar error messages.

      Log here: http://pastebin.com/tB3YVr9G

    • Sorted.

      SSH into your Pi
      Navigate to /etc/init.d/ and remove the couchpotato file (sudo rm couchpotato)
      Reboot
      Follow the CouchPotato instructions again (ie, create a new, fresh couchpotato file in the /etc/init.d/ directory) – remember to modify the “–data_dirdir=” to “–data_dir=” (remove the extra ‘dir’)

      Worked for me…

    • Hello,
      I am getting the same error on a clean install.

      Everything else worked well. Any ideas?

      Many Thanks

  15. In the Sickbeard autostart, sb_config is used but is is never declared?

    At least I can’t find it and the shutdown part of the script gets in an endless loop.
    I replaced it with kill -9 $p;

  16. :?:

    Is SABnzbd also slow on your raspberry pi? When using SSL connections I can only download with ~500kb/s. :-(

    • I Had the same problem, try to increase your server connections to more than 8, and update to latest version

      I have 10mbps and Im downloading with ssl at 948KB/s sysload 1.68 which is great for me.

  17. Hello,

    Im a complete noob on RPI, just got it yesterday but I was wondering, would it be possible to have this setup AND xbmc in the same RPI?

    • You’d be pushing it running it on the same Pi. The best idea would be to setup two and use one for XBMC and one for this.

  18. Having an issue with installing unrar-nonfree. First it was something to do with my public key missing so I ran:

    wget http://archive.raspbian.org/raspbian.public.key -O – | sudo apt-key add –

    That fixed that issue although I seem to be missing the debhelper package required for unrar-nonfree.

    I tried getting this from another repository although I don’t really know what I’m doing.

    Can someone help me with this section please?
    Thanks in advance.

  19. Thank you very much for the tutorial. I’ve followed it to the letter and so far I’ve had good results.

    I think I’ve found a small error while trying to start Couchpotato.

    CouchPotato.py: error: unrecognized arguments: –data_dirdir=/var/couchpotato

    The tutorial has the following:
    –data_dirdir=/var/couchpotato. I think it should be –data_dir=/var/couchpotato.

    • Thank you for this, I read the code and didn’t even notice such a small typo. I hope the poster can update the original script to prevent further frustration :)

  20. Hi, afterI get to the try it out part of sabnzb it stops doing anything after the ::INFO::[urlgrabber:77] URLGrabber starting up. Pi isn’t frozen (i can still type) just not doing anything it seems

    Tried both latest and your version from clean SD card

    • Never mind, I was working in the start up screen, instead of running startx and then open a bash shell. Working fine now.

  21. The init script for SickBeard didn’t work for me, resulted in a deadlock.

    Slight adaption made it work however. Please exchange for your own SickBeard API key.

    Thank you very much for these excellent blog posts Mark!

    #!/bin/sh
    ### BEGIN INIT INFO
    # Provides: SickBeard
    # Required-Start: $network $remote_fs $syslog
    # Required-Stop: $network $remote_fs $syslog
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Short-Description: Start SickBeard at boot time
    # Description: Start SickBeard.
    ### END INIT INFO

    case “$1″ in
    start)
    echo “Starting SickBeard.”
    /usr/bin/sudo -u sickbeard -H /usr/local/sickbeard/SickBeard.py -d –datadir /var/sickbeard –config /var/sickbeard/sickbeard.ini
    ;;
    stop)
    echo “Shutting down SickBeard.”
    p=`ps aux | grep -v grep | grep SickBeard.py | tr -s \ | cut -d ‘ ‘ -f 2`
    if [ -n “$p” ]; then
    wget -q –delete-after http://localhost:8081/api//\?cmd=sb.shutdown
    while ps -p $p > /dev/null; do sleep 1; done
    fi
    ;;
    *)
    echo “Usage: $0 {start|stop}”
    exit 1
    esac

    exit 0

  22. Looks like some of my strings were eaten by the comments engine… :D

    So… init script as provided in this tutorial hung up my system in a deadlock. sudo /etc/init.d/sickbeard start was perfectly OK, but the stop wouldn’t work. Works perfectly with my modified init-script however. Please fill inn your own SB API key after (…):8081/api/ and before the ?.

  23. Hey anyone else having trouble with couch potato?

    • Im having trouble with couchpotato as well. I used to have it all running perfectly a few weeks ago but I’ve had to reinstall everything and now it wont work!
      I’m getting a lot of this type of thing:
      Traceback (most recent call last):
      File “/usr/local/couchpotato/CouchPotato.py”, line 128, in
      l.run()

      a lot of people mention the dirdir error that needs editing, I’ve done that but it’s still not working.
      Anyone got any ideas?
      Thanks!

  24. Hello
    I am getting the couchpotato error that is shown above.

    Also SickBeard doesn’t stop. Haven’t yet changed the script but any ideas would be good.

    Thanks

    • Sounds exactly the same as me, same error and sickbeard doesn’t stop either, I don’t really know what I’m doing but followed all the instructions exactly and its not working so good to know i’m not the only one!

  25. On all 3 scripts I have now done the stop in the same way.

    if [ -n “$p” ]; then
    kill -2 $p > /dev/null
    while ps -p $p > /dev/null; do sleep 1; done
    fi

    All 3 now start and stop as expected. The first SABnzbd should download tonight. I will tell you if it is all OK.
    Thanks for a great guide.

    • Hello
      All is working as expected. All good.

      Another question my Raspbmc can see the files which couchpotato has got.
      But it doesn’t use that metadata but looks up the metadata again.
      Any ideas?

  26. Great tutorial on how to get this working on a raspberry. I have slow speeds on Sabnzbd (around 1 MB/s) but it suffices.

    There is one spelling error though in the couchpotato startup script. It should be “data_dir=” in stead of “data_dirdir=”

  27. Hello,
    For information this is what I did to update SABnzb to the latest version (in this case 0.7.11):

    wget http://downloads.sourceforge.net/project/sabnzbdplus/sabnzbdplus/0.7.11/SABnzbd-0.7.11-src.tar.gz
    tar xzf SABnzbd-0.7.11-src.tar.gz
    sudo /etc/init.d/sabnzbd stop
    sudo rm -R /usr/local/sabnzbd
    sudo mv SABnzbd-0.7.11 /usr/local/sabnzbd
    sudo chown -R sabnzbd:nzb /usr/local/sabnzbd
    sudo /etc/init.d/sabnzbd start

    Iain

  28. Hi, I followed the instruction for sickbeard but used this specific branch instead (supporting Torrent)

    git://github.com/mr-orange/Sick-Beard.git

    and get this error messge
    [email protected]:~$ sudo su sickbeard -c “/usr/local/sickbeard/SickBeard.py –datadir /var/sickbeard –config /var/sickbeard/sickbeard.ini”
    sh: 1: /usr/local/sickbeard/SickBeard.py: Permission denied
    [email protected]:~$

    Was wondering if anyone figured this out?

  29. =Having a Problem with Couchpotato Post-Processing=

    Hi – Thanks so much for the excellent tutorial! I have everything up and pretty much working.

    I have set it up so that all applications run on the Raspberry Pi and all my data is stored on my NAS. I have set up mounts such as NASmusic NASmovies etc and used these as the file locations for my applications

    I’m having an issue with Couchpotato. It has scanned my media folders and added the content, it has also searched for a specific file to download and successfully sent this to SABnzbd. Once SABnzbd has completed, it has put the folder into my temporary watched folder on my NAS. When Couchpotato comes to run the post processing I get the following errors:

    [tato.core.plugins.renamer] Failed removing /media/NASusb/ZZSabnzbd/Completed/[Name Of Folder].cp(tt1790885)/130972.nzb: Traceback (most recent call last):
    File “/usr/local/couchpotato/couchpotato/core/plugins/renamer/main.py”, line 350, in scan
    os.remove(src)
    OSError: [Errno 13] Permission denied: ‘/media/NASusb/ZZSabnzbd/Completed/[NameOf Folder].cp(tt1790885)/130972.nzb’

    [tato.core.plugins.renamer] Renaming “/media/NASusb/ZZSabnzbd/Completed/[Name Of Folder].cp(tt1790885)” to “/media/NASusb/ZZSabnzbd/Completed/_FAILED_REMOVE_[Name Of Folder].cp(tt1790885)”

    [tato.core.plugins.renamer] Failed setting permissions for file: /media/NASusb/ZZSabnzbd/Completed/_FAILED_REMOVE_[Name of Folder].cp(tt1790885), Traceback (most recent call last):
    File “/usr/local/couchpotato/couchpotato/core/plugins/renamer/main.py”, line 461, in moveFile
    os.chmod(dest, Env.getPermission(‘file’))
    OSError: [Errno 1] Operation not permitted: ‘/media/NASusb/ZZSabnzbd/Completed/_FAILED_REMOVE_[Name Of Folder].cp(tt1790885)’

    I then get a series of file not found errors due to the renaming of the folder it would seem.

    So Couchpotato has permissions to change the folder name, but can’t remove or set permissions. I am also getting the following error, but I think this is not connected:

    [chpotato.core.plugins.log] API log: {‘page': u’http://HOST/manage/’, ‘t': u’D1nVe7VZ’, ‘file': u’http://HOST/api/API_KEY/file.cache/minified_front.js?1363869618′, ‘line': u’97’, ‘type': u’error’, ‘message': u”chrome 25: \nUncaught TypeError: Cannot read property ‘parentNode’ of null”}

    I’m guessing this is something to do with permissions or the file renamer/main.py. In terms of the share, all the drives on the NAS have been granted the same privileges and all have read and write. I’m just surprised that it can rename but fails permissions.

    For Reference, this is the /etc/init.d/couchpotato file that starts the application:

    #!/bin/sh
    ### BEGIN INIT INFO
    # Provides: CouchPotato
    # Required-Start: $network $remote_fs $syslog
    # Required-Stop: $network $remote_fs $syslog
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Short-Description: Start CouchPotato at boot time
    # Description: Start CouchPotato.
    ### END INIT INFO
    case “$1″ in
    start)
    echo “Starting CouchPotato.”
    /usr/bin/sudo -u couchpotato -H /usr/local/couchpotato/CouchPotato.py –daemon –data_dir=/var/couchpotato –config_file=/var/couchpot$
    ;;
    stop)
    echo “Shutting down CouchPotato.”
    p=`ps aux | grep -v grep | grep CouchPotato.py | tr -s \ | cut -d ‘ ‘ -f 2`
    couch_api_key=`grep -m 1 api_key /var/couchpotato/couchpotato.ini | cut -d ‘ ‘ -f 3`;
    couch_port=`grep -m 1 port /var/couchpotato/couchpotato.ini | cut -d ‘ ‘ -f 3`;
    wget -q –delete-after http://localhost:${couch_port}/api/${couch_api_key}/app.shutdown
    while ps -p $p > /dev/null; do sleep 1; done
    ;;
    *)
    echo “Usage: $0 {start|stop}”
    exit 1
    esac
    exit 0

    Any help or suggestions are greatly appreciated

    • Also – getting this showing up in the logs:
      [tato.core.plugins.renamer] Renamer is already running, if you see this often, check the logs above for errors.

      • Managed to solve issue – it’s the permissions on the NAS that cause it – FTP’s into the NAS and changed to CHMOD 777. Also, went and checked the permission in the control panel to make sure everything was Read / Write – appears to have worked.

        Thanks again for a great tutorial

  30. How do you change the default ports for each.

    ie…
    SABnzbd to use 5051 (instead of 8080)
    Sick Beard to use 5052 (instead of 8081)

    I already have other things running on those two ports

  31. Hi!

    Really nice tutorial, just one thing:
    The sickbeard script fails when launched with stop. Enters on an endless loop as it tries to find the api key in the config file but the variable is not set.
    Below is how I fix’d it, hope it helps. Remember to activate the API!!!
    #!/bin/sh
    ### BEGIN INIT INFO
    # Provides: SickBeard
    # Required-Start: $network $remote_fs $syslog
    # Required-Stop: $network $remote_fs $syslog
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Short-Description: Start SickBeard at boot time
    # Description: Start SickBeard.
    ### END INIT INFO
    ### BEGIN CONFIG SECTION
    sb_datadir=/var/sickbeard
    sb_config=${sb_datadir}/sickbeard.ini
    ### END CONFIG SECTION
    case “$1″ in
    start)
    echo “Starting SickBeard.”
    /usr/bin/sudo -u sickbeard -H /usr/local/sickbeard/SickBeard.py -d –datadir ${sb_datadir} –config ${sb_config}
    ;;
    stop)
    echo “Shutting down SickBeard.”
    p=`ps aux | grep -v grep | grep SickBeard.py | tr -s \ | cut -d ‘ ‘ -f 2`
    if [ -n “$p” ]; then
    sb_api_key=`grep -m 1 api_key ${sb_config} | cut -d ‘ ‘ -f 3`;
    sb_port=`grep -m 1 web_port ${sb_config} | cut -d ‘ ‘ -f 3`;
    wget -q –delete-after http://localhost:${sb_port}/api/${sb_api_key}/\?cmd=sb.shutdown
    while ps -p $p > /dev/null; do sleep 1; done
    fi
    ;;
    *)
    echo “Usage: $0 {start|stop}”
    exit 1
    esac

    exit 0

  32. After I made the auto start for couchpotato I get this error.

    What to do?

    Starting CouchPotato.
    usage: CouchPotato.py [-h] [–data_dir DATA_DIR] [–config_file CONFIG_FILE]
    [–debug] [–console_log] [–quiet] [–daemon]
    [–pid_file PID_FILE]

  33. There’s an error in the Couchpotato autostart script:

    This line:
    /usr/bin/sudo -u couchpotato -H /usr/local/couchpotato/CouchPotato.py –daemon –data_dirdir=/var/couchpotato –config_file=/var/couchpotato/couchpotato.ini
    ;;

    should be changed to this:
    /usr/bin/sudo -u couchpotato -H /usr/local/couchpotato/CouchPotato.py –daemon –data_dir=/var/couchpotato –config_file=/var/couchpotato/couchpotato.ini
    ;;

  34. I am having issues with installing CouchPotato.

    When I try to run

    su couchpotato -c "/usr/local/couchpotato/CouchPotato.py --data_dir=/var/couchpotato --config_file=/var/couchpotato/couchpotato.ini"

    My terminal just hangs and nothing runs.

    There must be something obvious that I am missing, but I just can’t see it!

    • *Edit*

      The line I am actually using is:

      sudo su couchpotato -c "/usr/local/couchpotato/CouchPotato.py --data_dir=/var/couchpotato --config_file=/var/couchpotato/couchpotato.ini"

  35. Yep, I’ve encountered the same issue as t4mar1n. Haven’t had the time to troubleshoot it further just yet.

    Anyone else had the same issue?

  36. Update – found the problem. Known issue with Python 2.7.4:

    “If you used this guide for Pyton 2.7.4 – Python – How to install Couchpotato won’t start. It is a bug with pysqlite and i have not fixed it yet. Using the slots included python 2.6 works.”

    https://github.com/feralhosting/feralfilehosting/tree/master/Feral%20Wiki/Software/CouchPotato%20-%20An%20automatic%20NZB%20and%20torrent%20downloader%20for%20Films

  37. New question.

    I have noticed that the version of SABnzbd installed using this tutorial is only 0.7.3 and the latest stable release appears to be 0.7.4.

    I just can’t handle the “Update Available!” message staring at me.

    Using the tutorial outlined on the SABnzbd forum appears to work successfully (no error messages) but when I try to restart, 0.7.3 carries on running and no changes appear to have been made.

    Would this have anything to do with the software being installed twice in different folders? and the /etc/init.d/sabnzbd file only points to the original 0.7.3 instance of SABnzbd?

    • Never mind!

      I just did the obvious thing and repeated the steps above but changed the release number in ‘wget’ to the latest release!


      sudo wget http://downloads.sourceforge.net/project/sabnzbdplus/sabnzbdplus/0.7.14/SABnzbd-0.7.14-src.tar.gz
      sudo tar xzf SABnzbd-0.7.14-src.tar.gz
      sudo mv SABnzbd-0.7.14 /usr/local/sabnzbd
      sudo chown -R sabnzbd:nzb /usr/local/sabnzbd
      sudo mkdir /var/sabnzbd
      sudo chown sabnzbd:nzb /var/sabnzbd
      sudo su sabnzbd -c "/usr/local/sabnzbd/SABnzbd.py -f /var/sabnzbd -s 127.0.0.1:8080"

  38. heres the script i modified to autostart couchpotato, this enabled be to move the config file and database to the external USB HDD, doing this for Couchpotato and sickbeard made a huge performance increase, NOTE the varibles now for the data Dir and config files and i also removed the duplicate dirdir issue

    #!/bin/sh
    ### BEGIN INIT INFO
    # Provides: CouchPotato
    # Required-Start: $network $remote_fs $syslog
    # Required-Stop: $network $remote_fs $syslog
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Short-Description: Start CouchPotato at boot time
    # Description: Start CouchPotato.
    ### END INIT INFO
    ### BEGIN CONFIG SECTION
    cp_datadir=/mnt/USBHDD1/couchpotato
    cp_config=${cp_datadir}/couchpotato.ini
    ### END CONFIG SECTION
    case “$1″ in
    start)
    echo “Starting CouchPotato.”
    /usr/bin/sudo -u couchpotato -H /usr/local/couchpotato/CouchPotato.py –daemon –data_dir ${cp_datadir} –config_file ${cp_config}
    ;;
    stop)
    echo “Shutting down CouchPotato.”
    p=`ps aux | grep -v grep | grep CouchPotato.py | tr -s \ | cut -d ‘ ‘ -f 2`
    couch_api_key=`grep -m 1 api_key ${cp_config} | cut -d ‘ ‘ -f 3`;
    couch_port=`grep -m 1 port ${cp_config} | cut -d ‘ ‘ -f 3`;
    wget -q –delete-after http://localhost:${couch_port}/api/${couch_api_key}/app.shutdown
    while ps -p $p > /dev/null; do sleep 1; done
    ;;
    *)
    echo “Usage: $0 {start|stop}”
    exit 1
    esac
    exit 0

  39. Hello !
    Thanks for this tutorial.

    I have got an error with sickbeard:

    sudo su sickbeard -c “/usr/local/sickbeard/SickBeard.py –datadir /var/sickbeard –config /var/sickbeard/sickbeard.ini”

    bash: /usr/local/sickbeard/SickBeard.py: Permission denied

    I can’t find where it comes from…

  40. Hi,

    I’m having a problem when i try to update the couchpotato it gives this error:

    “[potato.core._base.updater] Failed updating via GIT: Traceback (most recent call last):
    File “/home/pi/CouchPotatoServer/couchpotato/core/_base/updater/main.py”, line 186, in doUpdate
    self.repo.saveStash()
    File “/home/pi/CouchPotatoServer/libs/git/repository.py”, line 427, in saveStash
    self._executeGitCommandAssertSuccess(command)
    File “/home/pi/CouchPotatoServer/libs/git/repository.py”, line 85, in _executeGitCommandAssertSuccess
    raise GitCommandFailedException(kwargs.get(‘cwd’, self._getWorkingDirectory()), command, returned)
    GitCommandFailedException: GitCommandFailedException: Command ‘stash save’ failed in /home/pi/CouchPotatoServer (1):

    *** Please tell me who you are.

    Run

    git config –global user.email “[email protected]
    git config –global user.name “Your Name”

    to set your account’s default identity.
    Omit –global to set the identity only in this repository.

    fatal: empty ident not allowed
    Cannot save the current index state”

    Is there any way for making the update via ssh?

    thank you

  41. I can’t start sabnzbd auto start.
    I read this website and I’m afraid to try out http://wiki.sabnzbd.org/install-ubuntu-repo

    Anyway the User name and Host need that to be writing somewhere?

  42. There is a typo in the couchpotato init.d startup script

    dirdir should just be dir

  43. This article offers clear idea designed for the new users of blogging, that genuinely how to do blogging.

  44. This is really great.

    The icing on the cake would be ‘htpc manager’
    the only install i could find for the rPi is http://kanis.net/raspberry-pi-install-htpc-manager/
    which is a bit limited.

    thanks.

  45. Your missing the command to install Git just before Sickbeard. Don’t presume people have it installed :-)

    sudo apt-get install git-core

  46. I can’t get Couchpotato to start automatically, and when I try to start manually it gives me this:

    [email protected]:~$ sudo /etc/init.d/couchpotato start
    Starting CouchPotato.
    usage: CouchPotato.py [-h] [–data_dir DATA_DIR] [–config_file CONFIG_FILE]
    [–debug] [–console_log] [–quiet] [–daemon]
    [–pid_file PID_FILE]
    CouchPotato.py: error: unrecognized arguments: –data_dirdir=/var/couchpotato

    Have I done something wrong?

  47. how can i update sickbeard if update with the update button in sickbeard it fails to start

  48. Ahaa, its nice dscussion гegarding thіs paragraph at thіs place at this web site, Ӏ haѵe
    read aⅼl that, so noow me аlso commenting heгᥱ.

    Alѕo vusit my site; http://www.freexboxlivecodesx.com

Leave a Comment

17 − six =


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>