[How-To] Giving Plugins Write Permissions to Your Data

Status
Not open for further replies.

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
I was thinking to leave well enough alone but I did try this with the only result being that Sabnzbd is now stopped and I can not get it to restart:

root@sabnzbd_1:/ # service sabnzbd onestart
Starting sabnzbd.
su: pam_start: system error
/usr/local/etc/rc.d/sabnzbd: WARNING: failed to start sabnzbd
root@sabnzbd_1:/ # service sabnzbd start
Starting sabnzbd.
su: pam_start: system error
/usr/local/etc/rc.d/sabnzbd: WARNING: failed to start sabnzbd
root@sabnzbd_1:/ #
usually this happens when you change the ownership/permission level of the jail. either restore it from a snapshot, or backup your /var/db/sabnzbd, and restore it to a new sabnzbd install
 

BBarker

Contributor
Joined
Aug 7, 2015
Messages
120
usually this happens when you change the ownership/permission level of the jail. either restore it from a snapshot, or backup your /var/db/sabnzbd, and restore it to a new sabnzbd install

Wow...thanks for the fast reply! I do not have a snap shot from before when it was working. What is the best way to make a backup of /var/db/sabnzbd? Would I accomplish the same result if I leave the jail configuration the same and reinstalled sabnzbd? I don't have a problem reconfiguring it again.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Wow...thanks for the fast reply! I do not have a snap shot from before when it was working. What is the best way to make a backup of /var/db/sabnzbd? Would I accomplish the same result if I leave the jail configuration the same and reinstalled sabnzbd? I don't have a problem reconfiguring it again.
I'd personally copy it out of the jail on the commandline, somewhere else on my pool

no, your jail's operation system files are broken, so you need a new jail.
if you're ok reconfiguring it again, you can just not backup/restore that directory. just blow away your current plugin and install sabnzbd again
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Wow...thanks for the fast reply! I do not have a snap shot from before when it was working. What is the best way to make a backup of /var/db/sabnzbd? Would I accomplish the same result if I leave the jail configuration the same and reinstalled sabnzbd? I don't have a problem reconfiguring it again.
I'd personally copy it out of the jail on the commandline, somewhere else on my pool

no, your jail's operation system files are broken, so you need a new jail.
if you're ok reconfiguring it again, you can just not backup/restore that directory. just blow away your current plugin and install sabnzbd again
 

BBarker

Contributor
Joined
Aug 7, 2015
Messages
120
I'd personally copy it out of the jail on the commandline, somewhere else on my pool

no, your jail's operation system files are broken, so you need a new jail.
if you're ok reconfiguring it again, you can just not backup/restore that directory. just blow away your current plugin and install sabnzbd again

So the best way to blow away the current plug in and jail is to delete the storage and then the plugin?

Also, can I create the jail, assign storage and then upload the sabnzbd.pbi to it or is the best way just to download the plugin and let it create it's own jail and then assign storage?

edit: thank you for your time in this.....
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
So the best way to blow away the current plug in and jail is to delete the storage and then the plugin?
that should work, by storage I assume you mean the jails > storage tab.
 

BBarker

Contributor
Joined
Aug 7, 2015
Messages
120
that should work, by storage I assume you mean the jails > storage tab.

Yes and thank you.

Edit: I've reinstalled from the plugins menu and assigned storage. Anything else that needs to be done before I turn it on?
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Yes and thank you.

Edit: I've reinstalled from the plugins menu and assigned storage. Anything else that needs to be done before I turn it on?
no, unless you were going to restore a data-directory which you said you wouldnt, or if your changing sabnzbd user for some reason
 

BBarker

Contributor
Joined
Aug 7, 2015
Messages
120
no, unless you were going to restore a data-directory which you said you wouldnt, or if your changing sabnzbd user for some reason

In configuring from the Sabnzbd webGUI, it won't let me set the incomplete or complete download folders that I already have.

"Cannot create download_dir folder /media/Downloads/Incomplete"

Edit: the plugin turned on, but now I can't get it to use the file folders where all my media data is stored. I am not using the default location at /var/db/sabnzbd for reference.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
In configuring from the Sabnzbd webGUI, it won't let me set the incomplete or complete download folders that I already have. " Cannot create download_dir folder /media/Downloads/Incomplete"
are you sure they already exist in the jail? it sounds like from the error they aren't there. are they on a dataset you havent mounted into the jail?
if you verify they do exist, sabnzbd's user needs write permissions to them. dont do what you likely did earlier and change ownership/permissions for the jail dataset.
 

BBarker

Contributor
Joined
Aug 7, 2015
Messages
120
are you sure they already exist in the jail? it sounds like from the error they aren't there. are they on a dataset you havent mounted into the jail?
if you verify they do exist, sabnzbd's user needs write permissions to them. dont do what you likely did earlier and change ownership/permissions for the jail dataset.

I installed Sabnzbd from the plugin menu. Then I went to the jails>storage tab and added the storage to it. Started the plugin and in the process of setting up the locations for where I want the files to be downloaded encountered the error message.

edit: the dataset is mounted to my media storage on the pool where I have my disk drives. the jails are mounted in their own pool using an SSD. Is this the problem?

Untitled.jpg
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
I installed Sabnzbd from the plugin menu. Then I went to the jails>storage tab and added the storage to it. Started the plugin and in the process of setting up the locations for where I want the files to be downloaded encountered the error message.
please show the output of 'ls -l /media/Downloads'
 

BBarker

Contributor
Joined
Aug 7, 2015
Messages
120
please show the output of 'ls -l /media/Downloads'

Untitled1.jpg

edit: In checking the storage under the jails>storage tab the "mounted" box is unchecked? Is this correct?

edit 2: It turns out the previous storage was still there from my first install so I deleted both of them and reattached it to the jail and now this is what is showing.....the Downloads folder is gone because I deleted it.

Untitled2.jpg

Edit 3: With the new storage, I can point to the new folders and Sabnzbd is running, the plugin tab is off and will not turn on and I have this error showing in the sabnzbd webGUI:
"Cannot create backup file for /var/db/sabnzbd/sabnzbd.ini.bak"

New .jpg showing the freshly installed "Downloads" folder and it's strange permissions.

Untitled3.jpg
 
Last edited:

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
View attachment 11939

edit: In checking the storage under the jails>storage tab the "mounted" box is unchecked? Is this correct?

edit 2: It turns out the previous storage was still there from my first install so I deleted both of them and reattached it to the jail and now this is what is showing.....the Downloads folder is gone because I deleted it.

View attachment 11940

Edit 3: With the new storage, I can point to the new folders and Sabnzbd is running, the plugin tab is off and will not turn on and I have this error showing in the sabnzbd webGUI:
"Cannot create backup file for /var/db/sabnzbd/sabnzbd.ini.bak"

New .jpg showing the freshly installed "Downloads" folder and it's strange permissions.

View attachment 11941
can you show the output of 'ls -l /var/db/sabnzbd'?

you need to properly implement a solution from this thread for sabnzbd to be able to writet to your "strange" folder.
 

BBarker

Contributor
Joined
Aug 7, 2015
Messages
120
I appreciate your help in chasing this down. I did check 'ls -l /media' and this is what is shows after resetting the storage:
Untitled4.jpg

Here is 'ls -l /var/db/sabnzbd':
Untitled5.jpg
 

BBarker

Contributor
Joined
Aug 7, 2015
Messages
120
can you show the output of 'ls -l /var/db/sabnzbd'?

you need to properly implement a solution from this thread for sabnzbd to be able to writet to your "strange" folder.

I guess I should reply to your quote instead of just posting.....please see above. When I check 'ls -l /mnt/Boomer/media' is shows the same USER:GROUP as listed in the output for 'ls -l /media' from my sabnzbd jail.....shouldn't this work?

As it sits now, Sabnzbd is running and I can access it from the webGUI. It will download, unpack, delete the data files and move the final product to the completed folder which I can access as I please. The plugin will still not turn on and I get this persistent error message in the webGUI:
'Cannot create backup file for /var/db/sabnzbd/sabnzbd.ini.bak'

Output from jail 'ls -l /var/db/sabnzbd

Untitled6.jpg
 
Last edited:

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
I appreciate your help in chasing this down. I did check 'ls -l /media' and this is what is shows after resetting the storage:
View attachment 11942

Here is 'ls -l /var/db/sabnzbd':
View attachment 11943
I appreciate your help in chasing this down. I did check 'ls -l /media' and this is what is shows after resetting the storage:
View attachment 11942

Here is 'ls -l /var/db/sabnzbd':
View attachment 11943
Did you change the ownership/permissions of your sabnzbd jail again? /var/db/sabnzbd should be owned by media.
I think you keep changing the ownership of the jail, which you should never do.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
I guess I should reply to your quote instead of just posting.....please see above. When I check 'ls -l /mnt/Boomer/media' is shows the same USER:GROUP as listed in the output for 'ls -l /media' from my sabnzbd jail.....shouldn't this work?

As it sits now, Sabnzbd is running and I can access it from the webGUI. It will download, unpack, delete the data files and move the final product to the completed folder which I can access as I please. The plugin will still not turn on and I get this persistent error message in the webGUI:
'Cannot create backup file for /var/db/sabnzbd/sabnzbd.ini.bak'

Output from jail 'ls -l /var/db/sabnzbd

View attachment 11944
See my post, you screwed up your jail again. stop changing it's owner. Only ever change the ownership/permission of datasets with your data, not datasets that contain operating system/application files.
 

BBarker

Contributor
Joined
Aug 7, 2015
Messages
120
See my post, you screwed up your jail again. stop changing it's owner. Only ever change the ownership/permission of datasets with your data, not datasets that contain operating system/application files.

Ok...longish post.

Spent some more time googling and reading about permissions and ownership in FreeBSD and tried this:

1. Deleted the storage from the jail and then deleted the plugin
2. SSH into the root system and deleted the "Downloads" directory from my media folder (it had locked me out when I deleted Sabnzbd) and recreated it using mkdir and checked to make sure it's permissions and ownership matched the rest of the dataset....it did.
3. Reinstalled the Sabnzbd plugin, attached the media dataset as storage and then turned it on
4. Accessed the webGUI and setup my servers and switches and the one change I made was when I set up my download folders to point to where I created them in my media dataset, I did not set permissions in the Sabnzbd webGUI but left it blank. The previous times I did this, when I went back to check the plugin, it was off and would not turn on no matter what I tried. Sabnzbd would work, but if I restarted the jail, it would shutdown and not restart at all.
4. Downloaded a test .nzb file and it worked without throwing any errors that I could see but when I tried to access it from my 'Complete' folder on my laptop, I got a permissions error. Checking showed that while the 'Downloads', 'Downloads/Complete' and 'Downloads Incomplete' folders all had the correct permissions, the file inside did not. So I did a 'cmod -R 755 /mnt/Boomer/media/Downloads' and got the permissions to change and now could access the files. Of course, now the plugin was off and would not turn back on so I did an 'ls -l /var/db/sabnzb' from the sabnzbd jail to check ownership as you suggested and saw this:
Untitled7.jpg
So now I am really perplexed as to why the plugin won't turn on until I remembered you asking to restart the jail, which in the past has always been disastrous but this time proved exactly what was needed. The plugin is on, Sabnzbd appears to be working properly, and while I can read the downloaded files, I can't modify them. Here is the permissions showing for the file I downloaded:
Untitled8.jpg

So in restarting the jail, it changed how the permissions were handled. How can I get the permissions changed back to where I can move, modify and rename the files?

Edit: I guess what I really need to know is how to make sure that Sabnzbd gives the files the same permissions as the folder they are being sent to.

Sooooo close!!!
 
Last edited:

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Ok...longish post.

Spent some more time googling and reading about permissions and ownership in FreeBSD and tried this:

1. Deleted the storage from the jail and then deleted the plugin
2. SSH into the root system and deleted the "Downloads" directory from my media folder (it had locked me out when I deleted Sabnzbd) and recreated it using mkdir and checked to make sure it's permissions and ownership matched the rest of the dataset....it did.
3. Reinstalled the Sabnzbd plugin, attached the media dataset as storage and then turned it on
4. Accessed the webGUI and setup my servers and switches and the one change I made was when I set up my download folders to point to where I created them in my media dataset, I did not set permissions in the Sabnzbd webGUI but left it blank. The previous times I did this, when I went back to check the plugin, it was off and would not turn on no matter what I tried. Sabnzbd would work, but if I restarted the jail, it would shutdown and not restart at all.
4. Downloaded a test .nzb file and it worked without throwing any errors that I could see but when I tried to access it from my 'Complete' folder on my laptop, I got a permissions error. Checking showed that while the 'Downloads', 'Downloads/Complete' and 'Downloads Incomplete' folders all had the correct permissions, the file inside did not. So I did a 'cmod -R 755 /mnt/Boomer/media/Downloads' and got the permissions to change and now could access the files. Of course, now the plugin was off and would not turn back on so I did an 'ls -l /var/db/sabnzb' from the sabnzbd jail to check ownership as you suggested and saw this:
View attachment 11952
So now I am really perplexed as to why the plugin won't turn on until I remembered you asking to restart the jail, which in the past has always been disastrous but this time proved exactly what was needed. The plugin is on, Sabnzbd appears to be working properly, and while I can read the downloaded files, I can't modify them. Here is the permissions showing for the file I downloaded:
View attachment 11953

So in restarting the jail, it changed how the permissions were handled. How can I get the permissions changed back to where I can move, modify and rename the files?

Edit: I guess what I really need to know is how to make sure that Sabnzbd gives the files the same permissions as the folder they are being sent to.

Sooooo close!!!
You are correlating things without understanding everything about the underlying system, lol. restarting the jail never breaks things, it usually just seems to cause things to break because service that were running will no longer start because of a previous error. Also changing the permission setting in sabnzbd wont break anything, except maybe the ability to read those files, for example from CIFS.

In your latest attempt I believe the plugin won't turn on because it doesn't have write permissions to it's download folders.
sabnzbd needs write permissions to those folders, which you can accomplish by properly implementing a solution from this threads opening post.
In your case, whatever method you are using to access the downloaded files also needs write permissions. So you should also implement one of the solutions from this thread (without undoing what you did for sabnzbd), though doing that for a sharing protocol is going to be different steps then what's documented here. I suggest you let the download directory be owned by UID 816, and have sabnzbd write files with 777 permissions.
 
Status
Not open for further replies.
Top