Can't see Freenas share in SAB configuration

Support for the freeBSD package, created by dbrooks
Post Reply
tykkimies
Newbie
Newbie
Posts: 1
Joined: June 7th, 2014, 11:41 pm

Can't see Freenas share in SAB configuration

Post by tykkimies » June 7th, 2014, 11:48 pm

I posted this same question on FreeNAS forum also, but have not received a response yet.
My issue is that i installed SABNzb plugin and added storage to the jail, but when i got to the SAbnzb configuratio and open up the folders tab, i go to select where i want to store my downloads.
The windows CIFS share i created on my free nas is located at /mnt/FreeNAS/Media/
When i click either temporary download folder or completed download folder and try to browse to that location in get to /mnt/ and then there is nothing in there.
I tried manually entering it in and it does not save. I am not sure where i went wrong during my install. Any help is appreciated.

Also i am willing to completely start from scratch if anyone knows any guides that fit my needs.

I just want something simple. 1 volume with a windows CIFS share, and then I am going to have SABNZB, Couch potato, and sickbeard.

Thanks

User avatar
shypike
Administrator
Administrator
Posts: 21002
Joined: January 18th, 2008, 12:49 pm

Re: Can't see Freenas share in SAB configuration

Post by shypike » June 8th, 2014, 5:04 pm

The package for FreeNAS is developed by others, so these kind of support questions are difficult to answer.
Can you explain what "jail" means in this context?

AbsoluteZero
Newbie
Newbie
Posts: 4
Joined: December 8th, 2014, 7:06 am

Re: Can't see Freenas share in SAB configuration

Post by AbsoluteZero » December 8th, 2014, 12:15 pm

It has been a few months since your post, but I landed here and found the solution to the problem you described. I was trying to debug the same problem on my FreeNAS system, so perhaps others will appreciate additional information & explaination. I am by no means an expert in FreeBSD/FreeNAS, so anyone can correct me if I am wrong in my terminology.

There is a possibility of having file permision issues when installing sabNZBd through the FreeNAS plug-in, depending on how your dataset was created.
I will first provide reference to how my FreeNAS box is setup:

/mnt/volume0 - RAID-Z2 ZPool: 'volume0'
/mnt/volume0/media - 'media' Dataset
/mnt/volume0/media/Downloads - Storage for sabNZBd downloads
/mnt/volume0/media/Downloads/complete/movies - sabNZBd directory for completed movies (also input to CouchPotato)
/mnt/volume0/media/Downloads/complete/tv sabNZBd directory for completed tv shows (also input to Sick Beard / NZBDrone)
/mnt/volume0/media/Downloads/incomplete - sabNZBd directory for initial downloads
/mnt/volume0/media/Downloads/nzb - sabNZBd directory scanned for manual NZB additions (typically copied via SAMBA share)
/mnt/volume0/media/Movies - Final location for renamed & organized movies (output of CouchPotato)
/mnt/volume0/media/TV - Final location for renamed & organized tv shows (output of Sick Beard / NZBDrone)

/mnt/volume0/jails - Jailroot, NOTE: upon further reading, I probably should have created a separate dataset for the jail root, but didn't
/mnt/volume0/jails/sabnzbd_1 - sabNZBd jail, Acts as the root folder for sabNZBd, will refer to as <sabnzbd_root>

Other Files of Interest:
/etc/groups - Groups for FreeBSD system (accessable via FreeNAS GUI)
/etc/passwd - Users for FreeBSD system (accessable via FreeNAS GUI)
<sabnzbd_root>/etc/groups - Groups visible to sabNZBd jail (not viewable by FreeNAS GUI)
<sabnzbd_root>/etc/passwd - Users visible to sabNZBd jail (not viewable by FreeNAS GUI)

CIFS/SAMBA share 'Media' points to /mnt/volume0/media, with guest access turned on, default folder permissions enabled
NFS share 'Media' points to /mnt/volume0/media - This is to cater my HTPC so that I can stream files more reliably over 802.11n dual band. (NFS is faster than SAMBA)

File permissions: everything is owned by root:wheel, #770, except for /mnt/volume0/media/..., which is media:media, #660. This is important since the plugins within the jail will not function properly if not run as root:wheel. Above are my file permissions, but there are other possibilities as I will list below.

**********

A note about FreeNAS jails: They operate in a separate virtual space that is isolated from the rest of the FreeBSD system (and other jails). A jail has its own set of user/group identification numbers, that are not managed through the FreeNAS GUI. Using the FreeNAS GUI (->jails->sabnzbd_1->add storage), create a link inside the sabNZBd jail so that it can access files inside the 'media' dataset created earlier. The choice of folder is arbitrary from within the jail, so I chose /mnt/volume0/jails/sabnzbd_1/media to links to /mnt/volume0/media. NOTE: normally the /media folder is reserved for removable drive mounts, but that will not occur inside the sabNZBd jail, so it can be repurposed.

The <sabnzbd_root>/media folder will change it owner to media:media after creating the link to the 'media' dataset. I am uncertain if the use of user:group='media' for the storage link is a property of the sabNZBd plugin itself or was inherited from the dataset I created. However, the media:media user/group defined within <sabnzbd_root>/etc/groups and <sabnzbd_root>/etc/passwd have UID/GID=816. I originally created the user & group media:media through the FreeNAS GUI, so it was assigned at that time to an arbitrary value of 1007. Keep in mind that even though the readable names for the user/group may match, it is actually the UID and GID that matter. This mismatch is the source of the problem when the sabNZBd plugin cannot see the dataset created. The following options exist:

1. Mark the dataset as globally r/w, ie. "chmod 666 /mnt/volume0/media" by changing the appropriate dataset parameters within the FreeNAS GUI. This means that the UID=816 user (and all other users) will be given permission to read and write to the files within /mnt/volume0/media. This is the solution proposed by most help pages within forums.
2. Define a new user inside the FreeNAS GUI with UID/GID=816, with an arbitrary name, ie. 'content_download'. Add 'content_download' to the 'media' group (GID=1007 in my case) from the FreeNAS GUI. This addition should be reflected inside the /etc/groups file, to show something like, "media:*:1007:media,content_download". The update to /etc/passwd should reflect the 'content_download' user with UID=816. With this solution, new files created from the sabNZBd jail will be owned by the 'content_download' user, but the 'media' groups will remain constant.
3. If the UID and GID of 'media' within /etc/passwd and /etc/groups are changed to 816, then the FreeNAS system will see the 'media' user from the jail and the 'media' user from FreeNAS as the same. In this scenario, all files in the dataset could be modified to be "chmod 600", but I left them as 660 in my system.

I chose solution #3 listed above and sabNZBd was setup easily after the UID/GID modification.

NOTE: When programming the paths within the sabNZBd GUI, use the following paths (as everything is relative to <sabnzbd_root>):
/media/Downloads/incomplete - Folder to place incomplete downloads
/media/Downloads/complete - Folder to place complete downloads
/media/Downloads/nzb - Folder to scan for manual NZB additions

MickG
Newbie
Newbie
Posts: 1
Joined: January 7th, 2015, 8:04 am

Re: Can't see Freenas share in SAB configuration

Post by MickG » January 7th, 2015, 8:09 am

I wanted to take a minute to say Thank You to AbsoluteZero for posting this information. I found it very helpful in my FreeNAS SABnzbd endeavors.

One question I have about the following section of your post:

Other Files of Interest:
/etc/groups - Groups for FreeBSD system (accessable via FreeNAS GUI)
/etc/passwd - Users for FreeBSD system (accessable via FreeNAS GUI)
<sabnzbd_root>/etc/groups - Groups visible to sabNZBd jail (not viewable by FreeNAS GUI)
<sabnzbd_root>/etc/passwd - Users visible to sabNZBd jail (not viewable by FreeNAS GUI)

For those of us who are novice to unix and FreeNAS, can you share how one would see the groups and users visible to sabnzbd jail? I'm assuming it's through command line?

AbsoluteZero
Newbie
Newbie
Posts: 4
Joined: December 8th, 2014, 7:06 am

Re: Can't see Freenas share in SAB configuration

Post by AbsoluteZero » January 7th, 2015, 11:10 am

<sabnzbd_root> = /mnt/volume0/jails/sabnzbd_1
<couchpotato_root> = /mnt/volume0/jails/couchpotato_1
<sonarr_root> = /mnt/volume0/jails/sonarr_1

<sabnzbd_root>/etc/groups - Groups visible to sabNZBd jail (not viewable by FreeNAS GUI)
<sabnzbd_root>/etc/passwd - Users visible to sabNZBd jail (not viewable by FreeNAS GUI)

The <sabnzbd_root> folder is the base folder for the sabnzbd jail. A 'jail' is also referred to as a 'sandbox' in some contexts. Basically, it is a separate system-within-a-system where anything running in the jail has no idea about anything outside the jail and typically can only access files within its own system. From the point of view of sabnzbd, it will see the folder /media and think it is at the root location. NOTE: Whenever programming paths inside Sabnzbd, Couchpotato, Sonarr, it will always be relative to their respective jail root folders. However, in reality this folder is actually mapped to <sabnzbd_root>/media (or /mnt/volume0/jails/sabnzbd_1/media in its expanded form). This obviously creates a problem, since we want the output of sabnzbd to be accessed by other programs running in other jails (such as Couchpotato, SickBeard, Sonarr, etc). The solution is to create a link between the Sabnzbd jail and the main FreeBSD system, which I did through the FreeNAS GUI (->jails->sabnzbd_1->add storage). I created a link between <sabnzbd_root>/media and /mnt/volume0/media, which acts as a tunnel outside of the sandbox/jail for sabnzbd's output, so others can access the files. Similarly, in the CouchPotato and Sonarr jails, I created a tunnel from the <couchpotato_root>/media and <sonarr_root>/media folders to /mnt/volume0/media, so they can use the sabnzbd downloads as inputs to their programs. Programs running outside the jail and inside the main FreeBSD system (ie. FreeNAS & GUI) can see all files within all jails.

There are a few options when trying to access files within the sabnzbd jail.
  • Use an SSH terminal (Putty or Bitvise) into the FreeBSD system or open a web-based terminal/console from the left hand menu on the FreeNAS GUI. Using a text editor such as (vi or nano) to edit the files /mnt/volume0/jails/sabnzbd_1/etc/groups and /mnt/volume0/jails/sabnzbd_1/etc/passwd
  • From the FreeNAS GUI there is a button at the bottom of the 'jails' tab for each jail. Open a web-based terminal/console for the sabnzbd jail and you can use a text editor (vi or nano) to edit the files /etc/groups and /etc/passwd. Remember that from the jail's perspective all files are relative to it's root (/mnt/volume0/jails/sabnzbd_1 in this case)
From the jail's perspective it is using the UID and GID for the user:group defined within it's version of <sabnzbd_root>/etc/groups and <sabnzbd_root>/etc/passwd, when creating new files. However, once those files exist outside the jail/sandbox and into the main FreeBSD system, then it is the actual /etc/groups defined GID and /etc/passwd defined UID that must be set properly to match the settings of the (in my setup) /mnt/volume0/media dataset. To ensure the permissions are set properly from the output of Sabnzbd, I have enabled the file ownership modifications. The output of Sabnzbd (copied to /mnt/volume0/media/Downloads/complete) will have ownership changed (a.k.a. unix command: chown) to group 'media' and user 'media' with file permissions '660' and folder permissions '770'. This is necessary since the Sabnzbd process is run as group 'wheel' and user 'root' within it's own jail, so I want created/moved files into the final /mnt/volume0/media dataset to belong to group 'media' and user 'media' otherwise SAMBA/NFS services could not host the files properly. To reiterate, when I told Sabnzbd to change ownership to group 'media' and user 'media', all of those are ALWAYS in reference to what it thinks those GID and UID are, as defined within <sabnzbd_root>/etc/groups and <sabnzbd_root>/etc/passwd.

robertchas
Newbie
Newbie
Posts: 1
Joined: November 17th, 2015, 4:48 am

Re: Can't see Freenas share in SAB configuration

Post by robertchas » November 17th, 2015, 5:01 am

Hi,

I followed your guide but for some reason my relative folder is /var/db/sabnzbd/Downloads/incomplete and complete do Ijust link from here or can I change the relative folder to /mnt/ST1/jailroot/jaIls/sabnzbd_1/media and then do the linking or do I simply link from /var/db/sabnzbd

AbsoluteZero
Newbie
Newbie
Posts: 4
Joined: December 8th, 2014, 7:06 am

Re: Can't see Freenas share in SAB configuration

Post by AbsoluteZero » November 17th, 2015, 4:58 pm

I think linking from the SABNZBD relative path: /var/db/sabnzbd to your media folder is sufficient (the actual folder name or hierarchy is irrelevant). You didn't specify where your media folder is located, so I have to guess here...
/var/db/sabnzbd --> /mnt/ST1/media

This assumes you have created:
/mnt/ST1/media/Downloads/complete
/mnt/ST1/media/Downloads/incomplete

Just remember that when specifying paths from within SABNZBD that you use the actual relative path you are using, such as:
/var/db/sabnzbd/Downloads/complete
/var/db/sabnzbd/Downloads/incomplete

*******************

There have been updates to FreeNAS since the time when I originally created the post. It is possible that the "add storage" feature has changed, since you said that your relative folder is now /var/db/sabnzbd/Downloads/incomplete. Personally, I just like keeping it simple...

Inside your SABNZBD jail, just make use of (or create) a /media folder.
Then link SABNZBD's /media to the actual media folder: /mnt/ST1/media

Post Reply