Installing SABnzbd on FreeNAS 11.2

Since the introduction of FreeNAS 11.2, there are many under-the-hood changes that makes a hassle migrating from previous version. One of the major changes is the replacement of warden jail with iocage jail.

The removal of well-known NZB downloader SABnzbd from the standard Plugin leaves many users having to manually install it in the new iocage jail.

This is the a run down of how I got everything to work including the elusive permissions.

Prerequisite:
– A dataset created for the downloads (“Shared” in my example)
– “Shared” is own by default FreeNAS user “media” and group “media” (PID/GID 8675309)
– Downloads goes to /mnt/NASX/Shared/z-complete
– Temporary files goes to /mnt/NASX/Shared/z-incomplete
– SSH is enabled on FreeNAS

Enter the following commands:

  1. echo '{"pkgs":["nzbget","ca_root_nss"]}' > /tmp/pkg.json
  2. iocage create -n "sabnzbd" -p /tmp/pkg.json -r 11.2-RELEASE ip4_addr="vnet0|192.168.86.232/24" defaultrouter="192.168.86.1" vnet="on" allow_raw_sockets="1" boot="on"
    # Creates a jail called “sabnzbd” on 192.168.86.232 and the default gateway is 192.168.86.1
  3. rm /tmp/pkg.json
  4. iocage exec sabnzbd mkdir -p /downloads
    # Adds the folder “downloads” in the jail
  5. iocage exec sabnzbd mkdir -p /incomplete
    # Adds the folder “incomplete” in the jail
  6. iocage fstab -a sabnzbd /mnt/NASX/Shared/z-complete /downloads nullfs rw 0 0
    # Adds a mount point in pool /mnt/NASX/Shared/z-complete to /downloads in jail
  7. iocage fstab -a sabnzbd /mnt/NASX/Shared/z-incomplete /incomplete nullfs rw 0 0
    # Adds a mount point in pool /mnt/NASX/Shared/z-incomplete to /incomplete in jail
  8. iocage exec sabnzbd ln -s /usr/local/bin/python2.7 /usr/bin/python
  9. iocage exec sabnzbd ln -s /usr/local/bin/python2.7 /usr/bin/python2
  10. iocage exec sabnzbd "pw groupadd -n media -g 8675309"
  11. iocage exec sabnzbd "pw user add media -c media -u 8675309 -d /nonexistent -s /usr/bin/nologin"
  12. iocage exec sabnzbd chown -R media:media /downloads /incomplete
  13. iocage exec sabnzbd sysrc 'sabnzbd_user=media'
  14. iocage exec sabnzbd chown -R media:media /var/run/sabnzbd
    # 8 – 14 set SABnzbd to run as “media” and enable it read/write permission to the mount points
  15. iocage exec sabnzbd sysrc sabnzbd_enable=YES
  16. iocage exec sabnzbd edit /usr/local/sabnzbd/sabnzbd.ini
    # scrolls to line 85, edit the host to 0.0.0.0 and allow you can access from the 192.168.86.232. Press Esc and “a” to save the ini.
  17. iocage exec sabnzbd service sabnzbd start
    # Restart the service, access from 192.168.86.232:8080

There should not be any errors running any of the above commands, if there is, check syntax or let me know if there is a problem.

Once I logged in, changed the config -> Folders to /downloads and /incomplete respectively and hit Save Changes.

Enjoy!