Install Sonarr on Arch Linux

Sonarr Arch Linux

Sonarr is a TV series download manager capable of downloading from Peer to Peer and Usenet networks. It is comparable to Couchpotato or Headphones except it manages only TV series. It integrates with rTorrentuTorrent Server, Deluge, NZBGet and many more downloaders. It can also make use of Jackett to communicate with BitTorrent trackers.

 

Install Sonarr

Install dependencies.

sudo pacman -S libmediainfo mono sqlite

 

Install Packer if needed or use another package wrapper like Yaourt.

 

Install with packer.

packer -S radarr

 

Set the ownership on the startup directory.

sudo chown -R sonarr:sonarr /usr/lib/sonarr

 

Set the ownership of the AppData directory.

sudo chown -R sonarr:sonarr /var/lib/sonarr

 

Optionally add the system user to secondary groups.

sudo usermod -a -G nzbget,rtorrent,amule,users radarr

 

Fix Sonarr Automatic Updating

The default systemd script interferes with the auto update feature available from the user interface. It can still be updated via pacman but this relies on the package maintainer. For a more permanent fix a custom systemd script can be used. Note that with the script the shutdown button within the we interface will restart instead of shutting down.

 

Open systemd service file.

sudo nano /usr/lib/systemd/system/sonarr.service

 

Delete the old systemd script, copy the new script and save.

[Unit]
Description=Sonarr Service
After=network.target

[Service]
User=sonarr
Group=sonarr
Restart=always
RestartSec=5
Type=simple
ExecStart=/usr/bin/mono /usr/lib/sonarr/NzbDrone.exe -nobrowser -data=/var/lib/sonarr
ExecStop=-/usr/bin/mono /tmp/nzbdrone_update/NzbDrone.Update.exe "ps aux | grep NzbDrone | grep -v grep | awk '{ print $2 }'" /tmp/nzbdrone_update /usr/lib/sonarr/NzbDrone.exe
TimeoutStopSec=20

[Install]
WantedBy=multi-user.target

 

Reload systemd scripts for the changes to take effect.

sudo systemctl daemon-reload

 

Backup Sonarr Settings

Settings and the database can be backed up from the web interface by navigating to System -> Backup and click the Backup button. After the it has finished backing up the archive can be downloaded for safe keeping. Alternatively the files can be backed up manually by copying the entire directory that also contains additional files like images and logs.

 

Backup the system directory manually.

sudo cp -R /var/lib/sonarr/ /mnt/backup/

 

Restore Sonarr Settings

Stop the service.

sudo systemctl stop radarr.service

 

Remove the current App data directory.

sudo rm -Rd /var/lib/sonarr

 

Extract the backup archive downloaded from the web interface.

sudo unzip backup.zip -d /var/lib/sonarr/

 

Alternatively move the copied backup directory.

sudo cp -R /mnt/backup/sonarr/ /var/lib/

 

Apply permissions to the new App data directory.

sudo chown -R sonarr:sonarr /var/lib/sonarr

 

Run Sonarr

Start the service.

sudo systemctl start radarr.service

 

Enable the service to run on boot.

sudo systemctl enable radarr.service

 

Use Sonarr

Access the web interface in the browser on the default port 8989 and 9898 if SSL is enabled the current IP address. For example http://192.168.0.100:8989/. Configure other settings from the settings page.

  • JP

    Hey Dominic, first of all, great post! I followed all of your instructions and have nzbdrone working great.
    The problem I’m running into is in trying to install the latest update through the web GUI. I can see that it downloads and verifies the update package and even kicks off the nzbdrone update program. It then says that nzbdrone is restarting but never comes back up, at least, quickly.
    When I check for the running process, it’s no longer running and I have to manually start it up again.
    It sounds like a permission issue when doing the update because the update install files are left over in /tmp/nzbdrone_update directory.

    Any help with this would be appreciated!

    Thanks

    • Dom

      I had the same issue and I didn’t fix it until your comment. I don’t think it’s a permission issue as I tried changing permissions on nzbdrone directories before.

      I tried updating by running packer -S sonarr but the package is not up to date. Sonarr should start on it’s own after a while. In the end the re-installation must have fixed the issue as the update completed after that. Try this and hopefully it will work like it did for me, otherwise I am out of ideas for now 🙂

      • JP

        Hi Dom! I had to use packer -S nzbdrone to get it to update. Afterwards, I had to re-run the chmod commands and reload the daemon using systemctl daemon-reload and then the sonarr startup command.

        • Dom

          For me it didn’t actually update to a newer version, it just re-installed. Maybe the package was updated in the last 24 hours or maybe there is a difference in nzbdrone and sonarr packages. At least for me the automatic update now works, maybe there was a bug in sonarr before… Anyway, let me know it the auto update works for you.

          • John Papoula

            Hi Dom, I saw your post about the update failing using systemd in this link: https://forums.sonarr.tv/t/auto-update-fails-on-arch-linux/3798

            I confirmed my process ID matches what’s in the nzbdrone.pid file and I also updated my service script with your changes but can’t get the update to work.

            Here’s my log:

            15-4-20 15:21:55.2|Info|UpdateApp|Starting NzbDrone Update Client
            15-4-20 15:21:59.3|Info|UpdateApp|Updating NzbDrone to version 2.0.0.3004
            15-4-20 15:22:01.5|Info|AppFolderInfo|Data directory is being overridden to [/media/usb/sonarr]
            15-4-20 15:22:02.2|Debug|UpdateApp|NzbDrone process ID: 10914
            15-4-20 15:22:02.2|Debug|UpdateApp|Arguments:
            15-4-20 15:22:02.2|Debug|UpdateApp| 10914
            15-4-20 15:22:02.2|Debug|UpdateApp| /tmp/nzbdrone_update
            15-4-20 15:22:02.2|Debug|UpdateApp| /usr/lib/sonarr/NzbDrone.exe
            15-4-20 15:22:02.2|Debug|UpdateApp| /data=/media/usb/sonarr
            15-4-20 15:22:02.2|Debug|UpdateApp| /nobrowser
            15-4-20 15:22:02.2|Debug|UpdateApp|Using executing application: /usr/lib/sonarr/NzbDrone.exe
            15-4-20 15:22:02.2|Debug|UpdateApp|Executable location: /usr/lib/sonarr/NzbDrone.exe
            15-4-20 15:22:02.2|Info|UpdateApp|Starting update process. Target Path:/usr/lib/sonarr
            15-4-20 15:22:02.3|Info|InstallUpdateService|Verifying requirements before update…
            15-4-20 15:22:02.4|Debug|ProcessProvider|Finding process with Id:10914
            15-4-20 15:22:02.5|Warn|ProcessProvider|Unable to find process with ID 10914
            15-4-20 15:22:02.5|Fatal|UpdateApp|An error has occurred while applying update package.

            System.ArgumentException: Process with ID doesn’t exist 10914
            at NzbDrone.Update.UpdateEngine.InstallUpdateService.Verify (System.String targetFolder, Int32 processId) [0x00000] in :0
            at NzbDrone.Update.UpdateEngine.InstallUpdateService.Start (System.String installationFolder, Int32 processId) [0x00000] in :0
            at NzbDrone.Update.UpdateApp.Start (System.String[] args) [0x00000] in :0
            at NzbDrone.Update.UpdateApp.Main (System.String[] args) [0x00000] in :0

            Thanks again,

            JP

          • It’s a tough one to debug especially since sonarr updates are quite rare these days. At least the last 3 worked for me. I suggest you double check all steps and permissions on all sonarr locations. From the log “/media/usb/sonarr” seems odd to me, try re installing with default directory and other parameters.

          • sam

            I am getting following error

            15-5-27 09:55:09.3|Info|UpdateApp|Starting Sonarr Update Client
            15-5-27 09:55:10.0|Info|UpdateApp|Updating Sonarr to version 2.0.0.3154
            15-5-27 09:55:10.5|Info|AppFolderInfo|Data directory is being overridden to [/var/lib/sonarr]
            15-5-27 09:55:10.6|Debug|UpdateApp|NzbDrone process ID: 31038
            15-5-27 09:55:10.6|Debug|UpdateApp|Arguments:
            15-5-27 09:55:10.6|Debug|UpdateApp| 31038
            15-5-27 09:55:10.6|Debug|UpdateApp| /tmp/nzbdrone_update
            15-5-27 09:55:10.6|Debug|UpdateApp| /usr/lib/sonarr/NzbDrone.exe
            15-5-27 09:55:10.6|Debug|UpdateApp| /data=/var/lib/sonarr
            15-5-27 09:55:10.6|Debug|UpdateApp| /nobrowser
            15-5-27 09:55:10.6|Debug|UpdateApp|Using executing application: /usr/lib/sonarr/NzbDrone.exe
            15-5-27 09:55:10.6|Debug|UpdateApp|Executable location: /usr/lib/sonarr/NzbDrone.exe
            15-5-27 09:55:10.6|Info|UpdateApp|Starting update process. Target Path:/usr/lib/sonarr
            15-5-27 09:55:10.6|Info|InstallUpdateService|Verifying requirements before update…
            15-5-27 09:55:10.6|Debug|ProcessProvider|Finding process with Id:31038
            15-5-27 09:55:10.7|Warn|ProcessProvider|Unable to find process with ID 31038
            15-5-27 09:55:10.7|Fatal|UpdateApp|An error has occurred while applying update package.

            System.ArgumentException: Process with ID doesn’t exist 31038
            at NzbDrone.Update.UpdateEngine.InstallUpdateService.Verify (System.String targetFolder, Int32 processId) [0x000c3] in m:BuildAgentwork6c3239faf2b92630srcNzbDrone.UpdateUpdateEngineInstallUpdateService.cs:72
            at NzbDrone.Update.UpdateEngine.InstallUpdateService.Start (System.String installationFolder, Int32 processId) [0x00000] in m:BuildAgentwork6c3239faf2b92630srcNzbDrone.UpdateUpdateEngineInstallUpdateService.cs:76
            at NzbDrone.Update.UpdateApp.Start (System.String[] args) [0x00020] in m:BuildAgentwork6c3239faf2b92630srcNzbDrone.UpdateUpdateApp.cs:59
            at NzbDrone.Update.UpdateApp.Main (System.String[] args) [0x00042] in m:BuildAgentwork6c3239faf2b92630srcNzbDrone.UpdateUpdateApp.cs:43

          • I can only suggest you try re-installing and following the instructions precisely as they did work for me.

          • sam

            can you tell which version of mono you got?

            I read that version above 3.10 breaks update processes.

            I am trying to update sonarr from 2.0.0.3004 to 2.0.0.3154 and I have mono-4.0.1.28-1. downgraded mono to 3.12.1-1 which was in my cache but no success.

            I do not have mono 3.10 so can not check theory.

          • I haven’t’ heard of issues with mono but that might well be the source of your problems if it’s a different version. I have recently updated sonarr while my mono version was “Mono JIT compiler version 4.0.1”. This is the current version updated via pacman. Try reinstalling everything to eliminate any version or cache issues.

        • dom

          I updated the post, the new systemd script should work with the auto updater now!