NZBGet, CouchPotato and Sonarr

I’ve followed a few guides to install NZBGet, CouchPotato and Sonarr on OSMC RC but I’ve had no luck. NZBGet partially works but if I reboot the Pi, OSMC stalls on the loading screen. I was wondering if anyone had successfully installed any of these on OSMC RC? Thanks.

Note: I’ve followed the guides with success on Raspbian in the past.

NZBGet: Install NZBGet 14 Raspberry Pi with Raspbian •
CouchPotato: Install CouchPotato Raspberry Pi with Raspbian •
Sonarr: Install Sonarr Raspberry Pi with Mono 3.10 •

Don’t install Upstart! OSMC is base on systemd. Create the following file to start nzb at system start:

sudo nano /etc/systemd/system/nzbget.service

paste this

[Unit]
Description=NZBGet
# This will load nzbget only after setting up the network
After=network.target
[Service]
User=osmc
ExecStart=/usr/bin/nzbget -D
ExecStop=/usr/bin/nzbget -Q
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
[Install]
# Needed to run nzbget at boot
WantedBy=multi-user.target

and save the file. Test it:

sudo systemctl start nzbget.service

Works for me. I don’t have Couchpotato and Sonarr but it should work the same way.

Thanks @jefi for the advice. Should I be following a tutorial for Debian rather than Raspbian?

Thanks

Debian tutorial: Install NZBGet 14 Stable on Debian Linux •
Raspbian tutorial: Install NZBGet 14 Raspberry Pi with Raspbian •

I successfully installed couch potato and I can run the deamon and it works remotely. I tried your script but it doesn’t autostart after reboot. Any advice?

You need to “sudo systemctl enable” to start a systemd service at boot.

I tried that with the path in the argument;

sudo systemctl enable /etc/systemd/system/couchpotato.service

I must be doing something wrong because it’s not working.

I’ve managed to get NZBGet, CouchPotato and Sonarr working. I’ve got all except CouchPotato to autostart. Not sure what I’m doing wrong.

NZBGet is working but it keeps pausing downloads with the following error;

Pausing all activities due to errors in configuration

There are the following errors just prior to the above one;

.nzbget(61): Invalid value for option “NzbDir” (/media/2TB/Usenet/NZBGet/nzb/): could not read information for directory /media/2TB/Usenet/NZBGet/nzb: errno 13,

.nzbget(67): Invalid value for option “QueueDir” (/media/2TB/Usenet/NZBGet/queue/): could not read information for directory /media/2TB/Usenet/NZBGet/queue: errno 13,

.nzbget(70): Invalid value for option “TempDir” (/media/2TB/Usenet/NZBGet/tmp/): could not read information for directory /media/2TB/Usenet/NZBGet/tmp: errno 13,

.nzbget(49): Invalid value for option “InterDir” (/media/2TB/Usenet/NZBGet/inter/): could not read information for directory /media/2TB/Usenet/NZBGet/inter: errno 13,

All those folders exist. Any ideas on how to fix this greatly appreciated.

DaemonAfter is not a valid unit directive as far as I know. You should either have

After = network.target

or

After = network-online.target

network.target will cause it to start after our network manager (connman) starts, but potentially before the network is actually up (doesn’t usually matter for daemons that bind to all interfaces though) and will also cause it to be shut down before the network goes down on reboot/shutdown.

network-online.target will cause it to wait until the network is actually up and running (valid IP address received by DHCP and link active) but it will only wait if you enable the connman-wait-for-network service as well. (Which will also make Kodi wait for the network to be up before loading)

With connman-wait-for-network disabled, (the default) network-online.target will behave the same as network.target.

Oh, thanks. Copied this from another site. I’m not so familiar with systemd options :no_mouth: edited my post…

Had the same problems with a network (cifs) share. Seems to be permission related :confused: . Now I download to my sd card and run a cron job which rsyncs to my network share.

Still can’t seem to get NZBGet to start without pausing due to configuration errors. Could it be that NZBGet is starting before my USB HD is mounted? If I manually resume NZBGet it works fine.

Yes, could be. Here is someone, who managed this with a script:
http://nzbget.net/forum/viewtopic.php?f=3&t=545&start=10#p4985

I managed by added nzbget to start at boot by adding

nzbget -D

to the rc.local file. Don’t know how pretty it is, but it works

sudo nano /etc/rc.local

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

nzbget -D

exit 0

I got this from the raspberry pi website http://www.raspberrypi.org/documentation/linux/usage/rc-local.md

osmc@osmc:~$ systemctl status nzbget.service
* nzbget.service - NZBGet
   Loaded: loaded (/etc/systemd/system/nzbget.service; enabled)
   Active: failed (Result: exit-code) since Sat 2015-04-11 08:24:42 UTC; 5min ago
  Process: 660 ExecStop=/usr/bin/nzbget -Q (code=exited, status=203/EXEC)
  Process: 658 ExecStart=/usr/bin/nzbget -D (code=exited, status=203/EXEC)
 Main PID: 658 (code=exited, status=203/EXEC)

Why does this happen? I get something similar with Sonarr

I need help to setting up nzbget in the latest OSMC.

I followed the config example in this thread, but when I execute sudo systemctl start nzbget.service nothing happens.

I have installed nzbget into my home, running the nzbget install script. The binary generated by this is working, when I navigate to its folder and run ./nzbget but somehow, it isnt being called correctly by the script.

[Unit]
Description=NZBGet
# This will load nzbget only after setting up the network
After=network-online.target
[Service]
User=osmc
ExecStart=/home/osmc/nzbget/nzbget -D
ExecStop=/home/osmc/nzbget/nzbget -Q
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
[Install]
# Needed to run nzbget at boot
WantedBy=multi-user.target

Any input on this will be appreciated.

I want to learn how to properly run things on systemd

Thanks

Can you please tell me which tutorials you used to get these programs working on OSMC?

ExecStart=/home/osmc/nzbget/nzbget

Should be

ExecStart=/home/osmc/nzbget

And same for Execstop

I used the guides listed in the first post here.
But only as a rough guide up to where they create unit.d scripts for autostart. Stop there.
You have to make system.d scripts as shown in this thread.
Also in the guides if you come across where it says chown pi change that to osmc.

[Unit]
Description=NZBGet
After=network.target

[Service]
User=osmc
Group=osmc
ExecStart=/opt/nzbget/nzbget -D
ExecStop=/opt/nzbget/nzbget -Q
# process will demonize and parent return ok
Type=forking
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process

[Install]
# Needed to run nzbget at boot
WantedBy=multi-user.target