How to install CouchPotato and SickChill on Raspberry Pi


#1

Instructions for installation of CouchPotato and SickChill for Raspberry Pi

** UPDATE - December 2018 - edit and uploaded new scripts to install SickChill.
They are at the bottom of this post.

** UPDATE - at the end of instructions are the scripts that automatically installs couchpotato, sickchill, unrar, zip, rpimonitor, syncthing and headphones* *
** Fixed old Sickrage link to new: https://github.com/SiCKRAGE/SickRage.git (jan2016, dec2018 - now there is SickChill)* *
** Added new installations scripts for syncthing and headphones (jan2016)* *
** important note! Use completed folder for torrents on external disk, otherwise there will be problems with permissions. (July2016)* *

CouchPotato
_

  1. SSH into your working instance of OSMC on your Raspberry Pi or Raspberry Pi 2.

For example: ssh osmc@192.168.xxx.xxx
User: osmc
Pass: osmc
_
2. Create a user, mod his groups, and make empty home folder for ~/.couchpotato configs

    sudo useradd couchpotato
    sudo usermod -a -G osmc couchpotato
    sudo mkdir /home/couchpotato
    sudo chown -R couchpotato:couchpotato /home/couchpotato

If you get error: sudo: git: command not found
First run command:

sudo apt-get update && sudo apt-get install git
_
3. Clone (download) CouchPotato and assign right folder ownership

    sudo git clone http://github.com/RuudBurger/CouchPotatoServer /opt/CouchPotatoServer
    sudo chown -R couchpotato:couchpotato /opt/CouchPotatoServer

_
4. Create the correctly configured systemd unit for CouchPotato. Edit its [Service] section ExecStart path.

   cd /opt/CouchPotatoServer
   sudo cp ./init/couchpotato.fedora.service ./init/couchpotato.service
   sudo nano ./init/couchpotato.service

Find and change line ExecStart=/var/lib/CouchPotatoServer/CouchPotato.py --daemon
New line should look like this ExecStart=/opt/CouchPotatoServer/CouchPotato.py --daemon
Replace var/lib with opt

Before saving it should look something like that (works autorestart) :

    [Unit]
    Description=CouchPotato application instance
    After=network-online.target

    [Service]
    ExecStart=/opt/CouchPotatoServer/CouchPotato.py --daemon
    GuessMainPID=no
    Type=forking
    User=couchpotato
    Group=couchpotato
    KillMode=process

    [Install]
    WantedBy=multi-user.target

_
5. Install a systemd unit of CouchPotato

sudo cp ./init/couchpotato.service /etc/systemd/system/couchpotato.service
_
6. Launch the daemon at startup

sudo systemctl enable couchpotato.service
_
7. Launch the daemon.
Enjoy results on http://192.168.xxx.xxx:5050 or http://osmc:5050 (or whatever your Raspberry Pi IP address or name is)

sudo systemctl start couchpotato.service

Use different completed folder for Movies and NOT the same for TV Shows.
Example:
/HD/Downloads/Movies - Movies (CouchPotato)
/HD/Downloads/Completed - TV Shows (SickChill)

SickChill
_

  1. Create a user, mod his groups, and make empty home folder for ~/.sickchill configs

     sudo useradd sickchill
     sudo usermod -a -G osmc sickchill
     cd /opt/
     sudo git clone https://github.com/SickChill/SickChill.git sickchill
     sudo cp sickchill/runscripts/init.systemd /etc/systemd/system/sickchill.service
     sudo chown -R sickchill:sickchill /opt/sickchill
    

If you don’t have enough permission use command:
sudo chmod +x /opt/sickchill
_
2. Edit service file:
sudo nano /etc/systemd/system/sickchill.service
_
3. Remove “/usr/bin/python2.7”:

Before change:
ExecStart=/usr/bin/python2.7 /opt/sickchill/SickBeard.py -q --daemon --nolaunch --datadir=/opt/sickchill

After Change:
ExecStart=/opt/sickchill/SickBeard.py -q --daemon --nolaunch --datadir=/opt/sickchill
_
4. Launch the daemon at startup

sudo systemctl enable sickchill.service
_
5. Launch the daemon, at first start sickchill create settings file config.ini

sudo systemctl start sickchill.service
_
6. Stop sickrage to edit config.ini
sudo service sickchill stop
_
7. Add username and password into config.ini:
sudo nano /opt/sickchill/config.ini

search for:
web_username = ""
web_password = ""

and add your yousername (example):
web_username = "osmc"
web_password = "osmc"

If you don’t do that, your Pi may freeze when you try login into sickrage. Beacuse there is no username and password.
_
8. Start the daemon to accept new username and password.

sudo service sickchill start

If you get some error after this, you have two options:

  1. Maybe you didn’t edit file sickrage.service
  2. Or applications doesn’t have enought permissions to folder.
    (If sickchill doesn’t start, you probably didn’t delete path “/usr/bin/python2.7” from /etc/systemd/system/sickchill.service)

Now try to open http://192.168.x.xx:8081 or http://osmc:8081

Solution for “A stop job is running for SickRage/SickChill daemon (1m 30s)”, when you reboot or shutdown Raspberry Pi

Connect with ssh, and try following:
sudo nano /etc/systemd/system/sickchill.service

Under ExecStart add following:
TimeoutStopSec=5s

Ctr+x, Y, enter.

It should look like this:

[Unit]
Description=SickChill Daemon

[Service]
User=sickchill
Group=sickchill
Type=forking
GuessMainPID=no
ExecStart=/opt/sickchill/SickBeard.py -q --daemon --nolaunch --datadir=/opt/sickchill
TimeoutStopSec=5s

[Install]
WantedBy=multi-user.target

Or just use this simple command:
sudo sed -i '55i TimeoutStopSec=5s' /etc/systemd/system/sickchill.service

BONUS

Transmission script for autoremoving completed torrents:
_

  1. Stop Transmission:
    sudo service transmission stop
    _

  2. Go to transmission location and create new file:

    cd
    cd .config
    cd transmission-daemon
    sudo nano autoremove.sh
    _

  3. Copy and paste text below, change “yourusername” and “yourpassword” to
    your user and password for transmission. After you paste it and edit,
    press “ctrl+x”, “y” and “enter” (be careful how is text copied, it must
    be same as here, otherwise will not work correctly):

    #!/bin/sh

    the folder to move completed downloads to port, username,

    password

    SERVER=“9091 --auth yourusername:yourpassword”

    use transmission-remote to get torrent list from

    transmission-remote list use sed to delete first / last line

    of output, and remove leading spaces use cut to get first

    field from each line

    TORRENTLIST=transmission-remote $SERVER --list | sed -e '1d;$d;s/^ *//' | cut --only-delimited --delimiter=" " --fields=1
    transmission-remote $SERVER --list

    for each torrent in the list

    for TORRENTID in $TORRENTLIST
    do
    echo Processing : $TORRENTID

    check if torrent download is completed

    DL_COMPLETED=transmission-remote $SERVER --torrent $TORRENTID --info | grep "Percent Done: 100%"

    check torrents current state is

    STATE_STOPPED=transmission-remote $SERVER --torrent $TORRENTID --info | grep "State: Seeding\|Stopped\|Finished\|Idle"
    echo $STATE_STOPPED

    if the torrent is “Stopped”, “Finished”, or “Idle” after

    downloading 100%"

    if [ “$DL_COMPLETED” ] && [ “$STATE_STOPPED” ]; then

    move the files and remove the torrent from Transmission

    echo “Torrent #$TORRENTID is completed”
    echo “Removing torrent from list”
    transmission-remote $SERVER --torrent $TORRENTID --remove
    else
    echo “Torrent #$TORRENTID is not completed. Ignoring.”
    fi
    done
    _

  4. Edit settings.json:
    sudo nano settings.json
    _

  5. Search for:
    "script-torrrent-done-enabled": false,

Now change “false” to “true”

"script-torrrent-done-enabled": true,
_
6. Set path to script in settings.json. Search for:

"script-torrent-done-filename":"",

Add path:
"/home/omsc/.config/transmission-daemon/autoremove.sh"

Now looks something like this:
"script-torrent-done-filename": "/home/omsc/.config/transmission-daemon/autoremove.sh",
_
7. Run transmission service:
sudo service transmission start

Enable usb hard drive over samba
_

  1. edit samba configuration file:
    sudo nano /etc/samba/smb.conf
    _
  2. add text below comment = OSMC Home Directory

[media]
browsable = yes
read only = no
valid users = osmc
path = /media/
comment = USB media

  1. now should look something like this:

[osmc]
browsable = yes
read only = no
valid users = osmc
path = /home/osmc
comment = OSMC Home Directory

[media]
browsable = yes
read only = no
valid users = osmc
path = /media/
comment = USB media

_
4. restart samba service
sudo service samba restart

Script for update couchpotato
_

  1. create file
    sudo nano cp-update.sh
    _

  2. copy text into file

    #!/bin/bash

    CuchPotato Auto Update Script from htpcBeginner

    sudo service couchpotato stop
    sleep 10
    #foldee where is installed couchpotato
    sudo mv /opt/CouchPotatoServer /opt/CouchPotatoServer.old
    cd /opt/
    sudo git clone https://github.com/RuudBurger/CouchPotatoServer.git /opt/CouchPotatoServer
    sudo service couchpotato start
    _

  3. run script
    sudo sh cp-update.sh
    _

  4. Script moves /opt/CouchPotatoServer to /opt/CouchPotatoServer.old. If you wish to delete old version, you can use command below or change below “old line in script” to “command”

command or new line in script:
sudo rm -R /opt/CouchPotatoServer

old line in script :
sudo mv /opt/CouchPotatoServer /opt/CouchPotatoServer.old

info: Setting are saved in /home/couchpotato/.couchpotato

Fix for removing movies from couchpotato/kodi
Fix for issues for removing movies with couchpotato or kodi, solution was posted by member Martin.

Run only this command in ssh:

sudo chfn -o umask=002 couchpotato

Scripts with easy installation

**NEW UPDATE (December 2018) SickChill Scripts:

Copy file easyinstall.sh to osmc home folder and run command:
sudo sh easyinstallv2.sh

easyinstall.sh - installs sickchill, couchpotato, zip, unrar (username and password for sickchill is osmc)
easyinstallv2.sh - same as easyinstall.sh, only with comments (recommended if something goes wrong)
cp-update.sh - update couchpotato, rename old versions to CouchPotatoServer.old
cp-update-rmold.sh - delete old version, installs new CouchPotatoServer (settings and database are saved at /home/couchpotato/)
autoremove.sh - script for removing completed torrents in transmission
uninstall.sh - unistalls zip, unrar, couchpotato, sickchill (make backup of database before doing this, location for couchpotato is /home/couchpotato)
installsyncthing.sh - syncthing for snyc files between devices (include 2 scripts for crontab for sorting photos and videos)
installheadphnes.sh - application for downloading music

TIP:
If you have any write problems on external drive, you could try to change with which Group should SickChill started (sickchill to osmc).

Run first command to add user sickchill to osmc Group:
sudo useradd -G osmc sickchill

Example of sickchill.service:

[Unit]
Description=SickChill Daemon

[Service]
User=sickchill
Group=osmc
Type=forking
GuessMainPID=no
ExecStart=/opt/sickchill/SickBeard.py -q --daemon --nolaunch --datadir=/opt/sickchill
TimeoutStopSec=5s

[Install]
WantedBy=multi-user.target

What’s changed:

Before: Group=sickchill
After: Group=osmc


Is OSMC just a customised debian distro with a specialised kodi install?
CouchPotato Autostart
Transmission permission denied error
Transmission - remove torrent when complete
Vero 2 stuck at "please stand by." after update
[HowTo] Torrentbox - NAS
Cron not working after reinstall
Sickrage doesn’t start since the last update of OSMC
Transmission and Sickrage doesn't run at machine startup
#2

When i try to sudo git clone, i got this:
osmc@osmc:~$ sudo git clone http://github.com/RuudBurger/CouchPotatoServer /opt/CouchPotatoServer
sudo: git: command not found

osmc@osmc:~$ sudo git clone https://github.com/echel0n/SickRage.git sickrage
sudo: git: command not found

Where`s the problem?


#3
sudo apt-get update && sudo apt-get install git

#4

Thank you for help! It works now.


#5

Now im stuck at:

sudo cp runscripts/init.systemd /etc/systemd/system/sickrage.service

osmc@osmc:/opt$ sudo cp runscripts/init.systemd /etc/systemd/system/sickrage.service
cp: cannot stat ‘runscripts/init.systemd’: No such file or directory

Do i need python (sudo apt-get install python-openssl, sudo apt-get install python-yenc) or anything else?


#6

Hey.
I’m new on Rpi, on OSMC and on every this stuff…
I followed this tuto step by step but I get an error and it don’t works…

For the couchpotato installation :
Just after “nano .init/couchpotato.service” i change everything to have the same text, I save, and when I want to install systemd unit I have the following error :

osmc@osmc:/opt/CouchPotatoServer$ sudo systemctl start couchpotato.service
Warning: Unit file of couchpotato.service changed on disk, ‘systemctl daemon-reload’ recommended.

I’m completely lost…
Can you help me ?
Thanks a lot !
Greg


#7

you must do

cd sickrage

first


#8

First copy file: sudo cp ./init/couchpotato.service /etc/systemd/system/couchpotato.service
reload daemon: systemctl daemon-reload
and: systemctl enable couchpotato.service

After those steps try to run again command: sudo systemctl start couchpotato.service

Does it work?


#9

You can use command cd sickrage and after that
sudo cp runscripts/init.systemd /etc/systemd/system/sickrage.service, like Aitor_Mendez says.

or

this command:
sudo cp sickrage/runscripts/init.systemd /etc/systemd/system/sickrage.service


#10

I have done it like you said, and it still doesn`t work…
When i try to login at http://osmc:8081, RPI2 starts freezing and RAM goes to 98% and then stops :confused:

Log file: http://paste.osmc.io/wisijabeme


#11

Yes it works !
Except we have to add a sudo befor systemctl daemon-reload and a sudo before systemctl enable couchpotato.service

Thanks a lot !

(PS : I launch couchpotato. I’ll try to configure it and then restart RPi to be sure the autostart works…)


#12

I would recommend to stop sickrage with: sudo service sickrage stop , disable startup script: sudo systemctl disable sickrage.service, (not sure if you could use: sudo systemctl remove sickrage.service) then remove startup script: sudo rm /etc/systemd/system/couchpotato.service
and sudo rm -R /opt/sickrage. Now try again with the begining of istallation proces for sickrage. I hope that this will help you.


#13

Yes it works even after a restart ! Thanks you !

But i have a problem with transmission… I know i’m not on the good subject but i don’t know the good word to search my issue (English is not my langage…).

Perhaps someone can help me or send me a link :wink:

  • I downloaded transmission directly from the OSMC AppStore. I have access to transmission from web : ip_raspberry:9091
  • I configured CP to connect to transmission, and when I click to “test transmission” i read “connection successfull”

When I download a movie (directly from CP in a first time), the movie is snatched, but transmission don’t add it to the queue (I verified : i choose “show : all”).

**EDIT : ** When I add a torrent manually it works…

Port is open, directory are configured, I have source…

I d’ont understand my mistake…

Thanks for your help !
Greg


#14

Excellent. I’m happy to hear that you successfully fix your problem :smiley: maybe you should try with address http://localhost:9091 . That means if your pi2 doesnt have reserved ip on router (dhcp), it should always work, no matter what ip address is. I hope you dont have selected black hole, that means that torrent files are saved in some folder and transmission is watching that folder for new torrents.


#15

Did not help… Same problem, ram`s goes to 96% and RPi freezes…
Here is print screen of every step i made


#16

I don’t see sudo nano for file sickrage.service. Maybe thats the problem if you didn’t edit file and correct paths and run commands.


#17

I did change ExecStart to path /opt/sickrage


#18

I really don’t know what to say, try to update with commands and reboot pi:
sudo apt-get update
sudo apt.get upgrade

Is that fresh installation or restore of osmc?


#19

Fresh install 10 times i 2 days :smiley: (every time when it fails, i did a fresh install) i did apt-get update/upgrade/dist-upgrade, everything.


#20

Yes it works… I don’t know why… because i tried the both before to post an issue :smile:

Anyway, my last job is to add french provider in customs_plugin and to fix my renaming issue…

Thanks for this very great tuto step by step !!!