How to install SABnzbd in iocage jail and change permission to write to Freenas Pool owned by other user.

RSVP

Explorer
Joined
Feb 11, 2016
Messages
73
First time writing something up like this so forgive how poorly written and organized. I have been struggling getting a news reader off warden into iocage and to be fully functional. This seems to have done it.

This version is a lot different than the old warden plugin. I think the issues were mostly:
  • Can't get to web gui unless you edit .ini
  • Different user group ID than 816 than legacy version
  • Mount points I had to do 1 to 1. On old version i got away with just one mount point. this version I have 1 mount point for incomplete. and 1 for each category. Did this through web gui after pkg installed and operational with correct users. have to have correct users to confiugre sab and work.
/usr/local/sabnzbd/Downloads/complete/Movies​
/usr/local/sabnzbd/Downloads/complete/TV​
/usr/local/sabnzbd/Downloads/incomplete​


Make jail through webgui
Start the jail and go to shell from the right three dot selection area.

You have to enter this below and start and stop it otherwise you don't get .ini to edit

pkg install sabnzbdplus​
sysrc sabnzbd_enable="YES"​
service sabnzbd start​
service sabnzbd status​
service sabnzbd stop​
edit /usr/local/sabnzbd/sabnzbd.ini​


Go to line 85 to edit - host = 127.0.0.1 and change it to host = 0.0.0.0

service sabnzbd start​


At this point you can access the webgui.
But you should also change the user to have same number that owns your shares on freenas. If you don't you cant post process. I don't think it matters the name, just the number. in my case 816. What messed me up here originally was that media is my pool owner but the jail had that used already. so had to use a different name

pw useradd -n newmedia -u 816 -d /nonexistent -s /usr/sbin/nologin
chown -R newmedia:newmedia /usr/local/sabnzbd
sysrc 'sabnzbd_user=newmedia'
chown -R newmedia:newmedia /usr/local/share/sabnzbdplus
chown -R newmedia:newmedia /var/run/sabnzbd
service sabnzbd start

It seems to be working well.
 

msbxa

Contributor
Joined
Sep 21, 2014
Messages
151
First time writing something up like this so forgive how poorly written and organized. I have been struggling getting a news reader off warden into iocage and to be fully functional. This seems to have done it.

This version is a lot different than the old warden plugin. I think the issues were mostly:
  • Can't get to web gui unless you edit .ini
  • Different user group ID than 816 than legacy version
  • Mount points I had to do 1 to 1. On old version i got away with just one mount point. this version I have 1 mount point for incomplete. and 1 for each category. Did this through web gui after pkg installed and operational with correct users. have to have correct users to confiugre sab and work.
/usr/local/sabnzbd/Downloads/complete/Movies​
/usr/local/sabnzbd/Downloads/complete/TV​
/usr/local/sabnzbd/Downloads/incomplete​


Make jail through webgui
Start the jail and go to shell from the right three dot selection area.

You have to enter this below and start and stop it otherwise you don't get .ini to edit

pkg install sabnzbdplus​
sysrc sabnzbd_enable="YES"​
service sabnzbd start​
service sabnzbd status​
service sabnzbd stop​
edit /usr/local/sabnzbd/sabnzbd.ini​


Go to line 85 to edit - host = 127.0.0.1 and change it to host = 0.0.0.0

It seems to be working well.

Instead of editing sabnzbd.ini try this method

iocage exec sabnzbd sed -i '' -e 's?host = 127.0.0.1?host = 0.0.0.0?g' /usr/local/sabnzbd/sabnzbd.ini
 

msbxa

Contributor
Joined
Sep 21, 2014
Messages
151
But you should also change the user to have same number that owns your shares on freenas. If you don't you can't post process. I don't think it matters the name, just the number. in my case 816.

Post processing is been driving me crazy from the day iocage jails was introduced.
Can you elaborate more about this number that owns shares on freenas?. Do you mean the user that logs into FreeNAS? an example would be appreciated.
 

RSVP

Explorer
Joined
Feb 11, 2016
Messages
73
Do you have mount points in SAB jail? The source points should be visable under storage> then pools. you can choose the 3 dots on the right and edit permissions. This is to set what group owns everything in storage. Mine is user and group "media" that is 816 in the user and group section. Post processing doesnt work because the default owner of SAB is not the same as who owns the share. You have to change SAB by running that last section of code but replacing 816 with the number of the group that owns theshares.
 

msbxa

Contributor
Joined
Sep 21, 2014
Messages
151
Thanks, I spent several hours trying to educate myself and I think I have managed successful by implementing the idea, waiting to install other jails and starts testing.
 

RSVP

Explorer
Joined
Feb 11, 2016
Messages
73
No worries and good luck. It took me so long to get this running. If you are still are stuck just ask.
 

lloyd

Dabbler
Joined
Dec 27, 2013
Messages
16
Thanks for the instructions on this. I put this into a format similar to Pentaflake in that post on FN11.2 iocage jails

Code:
echo '{"pkgs":["sabnzbdplus","ca_root_nss"]}' > /tmp/pkg.json

# remember to replace <IP>/<MASK> e.g(192.168.1.2/24) and <GATEWAY> e.g(192.168.1.1)
iocage create -n "sabnzbd" -p /tmp/pkg.json -r 11.2-RELEASE ip4_addr="vnet0|<IP>/<MASK>" defaultrouter="<GATEWAY>" vnet="on" allow_raw_sockets="1" boot="on"
rm /tmp/pkg.json

# config file for sabnzbd outside is on dataset outside of jail.
zfs create media/apps/sabnzbd
chown -R media:media /mnt/media/apps/sabnzbd

#Its mount point in the jail
iocage exec sabnzbd mkdir /config

# datasets are owned by media and sabnzbd is run by media
iocage exec sabnzbd "pw user add media -c media -u 8675309 -d /nonexistent -s /usr/bin/nologin"
iocage exec sabnzbd chown -R media:media /config

# I use the watchfolder on occasion aready owned by media
iocage exec sabnzbd mkdir /mnt/watchfolder

# Remember the download mount points must match radarr/sonnar mount points
# for example when sab finished it says the show is at /mnt/downloads/complete/tv/YOUR_SHOW
# sonarr then looks for it at /mnt/downloads/complete/tv/YOUR_SHOW in its jail
iocage exec sabnzbd mkdir /mnt/downloads

# Mount em up and get ready to move out
iocage fstab -a sabnzbd /mnt/media/apps/sabnzbd /config nullfs rw 0 0
iocage fstab -a sabnzbd /mnt/media/watchfolder /mnt/watchfolder nullfs rw 0 0
iocage fstab -a sabnzbd /mnt/media/downloads /mnt/downloads nullfs rw 0 0

iocage exec sabnzbd sysrc "sabnzbd_enable=YES"
iocage exec sabnzbd sysrc "sabnzbd_conf_dir=/config"
iocage exec sabnzbd sysrc "sabnzbd_user=media"
iocage exec sabnzbd sysrc "sabnzbd_group=media"

# This creates this initial sabnzbd.ini file. If you already have one just copy it directly to /config
iocage exec sabnzbd service sabnzbd start
iocage exec sabnzbd service sabnzbd stop
iocage exec sabnzbd sed -i '' -e 's?host = 127.0.0.1?host = 0.0.0.0?g' /config/sabnzbd.ini
iocage exec sabnzbd service sabnzbd start


If everything went okay you should be able to access sabnzbd
<JAILIP>:8080
Make sure you configure sabnzbd folders to point to your /mnt/downloads
e.g.
Temporary Download Folder = /mnt/downloads/incomplete
Completed Download Folder =/mnt/downloads/complete
Watched Folder = /mnt/watchfolder

If you have permission trouble try spaming chown -R media:media on your datasets and mount points.
 

msbxa

Contributor
Joined
Sep 21, 2014
Messages
151
Most of the installations of these iocage jails are easy to follow with minor extra changes but as soon as you start creating users and groups with their permissions and if you don't understand how they work together you get lost. Their is a lot of fiddling between chown and chmod to make things work. From my side everything is clear thanks to you guys and others from this forum. Sabnzbd and Medusa running fine without any issues. Preparing to install SickGear and Sickchill for more testing.
 

adelphikos

Cadet
Joined
Nov 18, 2020
Messages
2
I've followed these instructions, and I now get:

/usr/local/etc/rc.d/sabnzbd: WARNING: failed to start sabnzbd

Any suggestions where to look? sabnzbd started fine prior to changing the permissions and I was able to view the gui interface (although getting a complete_dir directory: /mnt/Downloads error accessing)
 

adelphikos

Cadet
Joined
Nov 18, 2020
Messages
2
Turns out that the step of changing /usr/local/sabnzbd/sabnzbd.ini "host = 127.0.0.1" and change it to "host = 0.0.0.0" was my problem.

I set host to my actual static IP and it started up fine.

Since I was struggling to identify the issue, I eventually realized that running sabnzbd manually makes troubleshooting much simpler:

# /usr/local/bin/SABnzbd.py -f /usr/local/sabnzbd/sabnzbd.ini

This would output that "Unable to bind to port 8080 on localhost. Some other software uses the port or SABnzbd is already running." port 8080 is not in use and it is not already running.
 
Top