Install NZBGet on Arch Linux

NZBGet Arch Linux

NZBGet is a Usenet downloader that is stable, fast and packs a lot of features. It is available as a package on Arch Linux but does not come with systemd file out of the box. Fortunately it is simple to add a systemd configuration file.

 

Set up credentials

Create a system account and group of the same name that NZBGet will run under.

sudo useradd -r -s /bin/false nzbget

 

Optionally add the user to secondary groups.

sudo usermod -a -G utserver nzbget

 

Install NZBGet

Install with pacman.

sudo pacman -S nzbget

 

Install packages for all optional features.

sudo pacman -S libpar2 unrar unzip p7zip

 

Alternatively install UnRAR, UnZIP, p7zip and libpar2 individually.

 

Configure NZBGet

Copy default configuration file to the newly created directory.

sudo cp /usr/share/nzbget/nzbget.conf /etc/nzbget.conf

 

Edit the configuration file.

sudo nano /etc/nzbget.conf

To run the daemon as nzbget user modify the DaemonUsername from the default root to nzbget. Change the the default download directory by editing MainDir. Most other options can be changed later from within the GUI.

 

Change configuration file ownership.

sudo chown nzbget:nzbget /etc/nzbget.conf

 

NZBGet Download Directories

Create the download directory.

sudo mkdir /mnt/downloads/nzbget

 

Set the ownership of the download directory.

sudo chown -R nzbget:nzbget /mnt/downloads/nzbget

 

Set the permissions of the download directory.

sudo chmod -R 770 /mnt/downloads/nzbget

 

Configure NZBGet

Create a systemd script.

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

 

Copy the script and save the systemd configuration file.

[Unit]
Description=NZBGet Daemon
After=network.target
After=mnt-downloads.mount

[Service]
User=nzbget
Group=nzbget
Type=forking
ExecStart=/usr/bin/nzbget -D
ExecStop=/usr/bin/nzbget -Q
ExecReload=/usr/bin/nzbget -O
KillMode=process

[Install]
WantedBy=multi-user.target

The mount dependency is only necessary when the main NZBGet directory is on a non-system drive.

 

Run NZBGet

Start the daemon manually as a system user.

sudo -u nzbget /usr/bin/nzbget -D

 

Start the service with systemd.

sudo systemctl start nzbget

 

Enable the service to run on boot with systemd.

sudo systemctl enable nzbget

 

Use NZBGet

Access the web interface on 192.168.0.100:6789 and configure it using the settings page. Change 192.168.0.100 to the actual IP address if different. Leave the default port as 6789 unless it has been changed. Log in with default username nzbget and password tegbzn6789.

  • nixIT

    @Dominic,

    Thank you for the tutorial, I was able to get nzbget installed and configured, however, I am having issues trying to get the service started via your steps.

    When I issue the command:
    sudo systemctl start nzbget.service

    nzbget does not start, and I am unsure where to check for information that can help out.
    Can you help?

    thanx

    –nixIT

    • Check nzbget systemd logs with journalctl -u nzbget command and see what errors it shows. You can also check if nzbget is running with systemctl status nzbget as nzbget might be running but not accessible for external reasons.

      • nixIT

        Thanx DominicM. Here is what I get with systemctl status nzbget:

        ————

        sudo systemctl start nzbget.service
        [nixIT@nixit share]$ systemctl status nzbget.service -l
        ● nzbget.service – NZBGet
        Loaded: loaded (/usr/lib/systemd/system/nzbget.service; disabled; vendor preset: disabled)
        Active: inactive (dead)

        Jul 21 10:17:00 nixit systemd[1]: Started NZBGet.
        Jul 21 10:17:00 nixit systemd[1]: Starting NZBGet…
        Jul 21 10:17:00 nixit nzbget[31703]: Request sent
        Jul 21 10:19:20 nixit systemd[1]: Started NZBGet.
        Jul 21 10:19:20 nixit systemd[1]: Starting NZBGet…
        Jul 21 10:19:20 nixit nzbget[31751]: Request sent
        Jul 21 10:19:20 nixit nzbget[31751]: server returned: Stopping server
        Jul 21 10:21:30 nixit systemd[1]: Stopped NZBGet.
        Jul 21 10:23:33 nixit systemd[1]: Started NZBGet.
        Jul 21 10:23:33 nixit systemd[1]: Starting NZBGet…

        —————–

        not sure why. The results of journalctl are:

        ——————–

        Jul 21 10:17:00 nixed systemd[1]: Started NZBGet.

        Jul 21 10:17:00 nixed systemd[1]: Starting NZBGet…

        Jul 21 10:17:00 nixed nzbget[31703]: Request sent

        Jul 21 10:19:20 nixed systemd[1]: Started NZBGet.

        Jul 21 10:19:20 nixed systemd[1]: Starting NZBGet…

        Jul 21 10:19:20 nixed nzbget[31751]: Request sent

        Jul 21 10:19:20 nixed nzbget[31751]: server returned: Stopping server

        Jul 21 10:21:30 nixed systemd[1]: Stopped NZBGet.

        Jul 21 10:23:33 nixed systemd[1]: Started NZBGet.

        Jul 21 10:23:33 nixed systemd[1]: Starting NZBGet…

        Jul 21 10:48:07 nixed systemd[1]: Started NZBGet.

        Jul 21 10:48:07 nixed systemd[1]: Starting NZBGet…

        Jul 21 10:48:07 nixed nzbget[485]: Request sent

        Jul 21 10:48:07 nixed nzbget[485]: server returned: Stopping server

        Jul 21 10:48:33 nixed systemd[1]: Started NZBGet.

        Jul 21 10:48:33 nixed systemd[1]: Starting NZBGet…

        Jul 21 10:48:33 nixed nzbget[507]: Request sent

        Jul 21 10:48:33 nixed nzbget[507]: server returned: Stopping server

        Jul 21 10:48:56 nixed systemd[1]: Stopped NZBGet.

        Jul 21 10:49:08 nixed systemd[1]: Stopped NZBGet.

        Jul 21 10:59:21 nixed systemd[1]: Started NZBGet.

        Jul 21 10:59:21 nixed systemd[1]: Starting NZBGet…

        Jul 21 10:59:52 nixed systemd[1]: Stopped NZBGet.

        Jul 21 11:10:48 nixed systemd[1]: Started NZBGet.

        Jul 21 11:10:48 nixed systemd[1]: Starting NZBGet…

        ——————-

        I’m not sure what I’m looking for. If you don’t see something, I’m happy to provide info. I’ve also posted the information here:

        https://bbs.archlinux.org/viewtopic.php?id=200023

        Thanx for any help.

      • nixIT

        I added Type=forking to the nzbget.service file and that seemed to fix it. Do you know if that is a valid fix?

        • Try without Type=forking again and see if it works. I had intermittent failures to start recently that would be often fixed by rebooting so maybe Type=forking didn’t actually fix it but rebooting did. I don’t know why it would fix the issue or even what the issue is. The logs seem similar to mine (nothing useful in them).

          • nixIT

            I tried it numerous times without type=forking, even with reboots. However, now it appears to be working.

            I thank you for your help!!

          • It looks like this is due to a an update and now requires Type=forking. Not sure why it still worked for me for so long. Will update the article to reflect this new requirement.

  • Flatshift

    Noticed a pwck error in my log. Looks like the above steps, contrary to couchpotato, do not have you create a home dir, where the couchpotato instructions do with the -m option. /etc/passwd still points to /home/nzbget even though the dir doesn’t exist.

    Oct 12 00:00:07 pi systemd[1]: Starting Verify integrity of password and group files…
    Oct 12 00:00:07 pi pwck[9192]: user ‘nzbget’: directory ‘/home/nzbget’ does not exist
    Oct 12 00:00:07 pi pwck[9192]: pwck: no changes
    Oct 12 00:00:07 pi systemd[1]: shadow.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
    Oct 12 00:00:07 pi systemd[1]: Failed to start Verify integrity of password and group files.
    Oct 12 00:00:07 pi systemd[1]: shadow.service: Unit entered failed state.
    Oct 12 00:00:07 pi systemd[1]: shadow.service: Failed with result ‘exit-code’.

    Sonarr on the other hand looks to be running as a daemon, and /etc/passwd does not show a home dir at all, so there’s no issue. I’m not sure if nzbget can be run this same way or not.

    The two possible solutions I see are to either create a home dir, or move the home dir to /mnt/downloads/nzbget. I’m not sure if this creates any security issues, but /mnt/downloads/nzbget is already 770, so I wouldn’t think it would be a problem.

    Perhaps i’m missing a better solution.

    • I don’t know much about pwck but it doesn’t look directly related to cp. -m option is actually not needed for cp either (corrected now). You have to change directories either in the config manually or preferably in the gui once the bare-bones setup is complete. Check that you have the user/group “nzbget” created. NZBGet is also running as a daemon (if -D option is not removed from systemd script). You shouldn’t need to create or move the home dir. I just deleted nzbget home dir with no issues (it must have been there from original install).

      • Flatshift

        pwck looks to validate the passwd and shadow files and runs periodically it would seem. You can manually run it to check as well.

        from my passwd:
        sonarr:x:903:903:Sonarr daemon:/var/lib/sonarr:/bin/false
        couchpotato:x:901:901::/home/couchpotato:/bin/false
        nzbget:x:902:902::/mnt/incoming/nzbget:/bin/false

        It’s strange as I never changed the home dir for sonarr only for nzbget to resolve the error. Couchpotato has a home because I was following the guide. I created a test user without a home dir, and it too populated /etc/passwd with a :/home/test:/bin/false and gives an error immediately when pwck is run.

        [user@pi incoming]$ sudo sudo useradd -r -s /bin/false tester
        [user@pi incoming]$ sudo pwck
        user ‘tester’: directory ‘/home/tester’ does not exist
        pwck: no changes

        I don’t feel this is in any way service affecting. And my nzbget runs and operates without issue (and does run with -D option as per the .service) as well as does have a group set. I think this is just a warning msg. Either way I figured I’d share.

        • Is the error/warning logged in journalctl? If it’s an error it will be in red.

          • Flatshift

            Technically the home dir does not exist is gray, but the resulting following msg of:

            Oct 12 00:00:07 pi systemd[1]: Failed to start Verify integrity of password and group files.

            is red. And that is what ought my eye scrolling though my logs.

          • Are you sure it’s related to nzbget and not something else?

          • Flatshift

            Technically its related to the nzbget user, and not the software.

            When I run:

            sudo journalctl -u shadow.service

            [user@pi incoming]$ sudo journalctl -u shadow.service
            — Logs begin at Sat 2015-10-10 15:03:13 EDT, end at Mon 2015-10-12 15:32:50 EDT. —
            Oct 10 20:00:10 pi systemd[1]: Starting Verify integrity of password and group files…
            Oct 10 20:00:10 pi pwck[354]: user ‘nzbget’: directory ‘/home/nzbget’ does not exist
            Oct 10 20:00:10 pi pwck[354]: pwck: no changes
            Oct 10 20:00:10 pi systemd[1]: shadow.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
            Oct 10 20:00:10 pi systemd[1]: Failed to start Verify integrity of password and group files.
            Oct 10 20:00:10 pi systemd[1]: shadow.service: Unit entered failed state.
            Oct 10 20:00:10 pi systemd[1]: shadow.service: Failed with result ‘exit-code’.

            I see missing dir issue with every instance of failure that user nzbget directory /home/nzbget does not exist (which is what was in /etc/passwd). Once I set a home dir for nzbget, pwck no longer has an error. The auto validation looks to run every 12 hours, so I guess I’ll find out for sure tomorrow.

          • Yes, that is odd. Perhaps just try to delete the user/group/home dir, reboot and try again. If it doesn’t work, hit it with a hammer 🙂