Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DSM 7 SABNZB: cant create folders complete/incomplete #4842

Closed
jaspov opened this issue Sep 5, 2021 · 32 comments
Closed

DSM 7 SABNZB: cant create folders complete/incomplete #4842

jaspov opened this issue Sep 5, 2021 · 32 comments

Comments

@jaspov
Copy link

jaspov commented Sep 5, 2021

Setup

Package Name: 7.0 evansport
Package Version: v3.3.1-49

NAS Model:
NAS Architecture: Evansport
DSM version: v3.3.1-49

Expected behavior

Just installed new sabnzb for DSM7. Expecting it to finish installatiom

Actual behavior

I get errors that the complete/incomplete folders cant be made (they already exist from an older version of sabnzb on DSM6 which I uninstalled.

Errors:
ERROR a few seconds ago Cannot create directory /volume1/downloads/incomplete

ERROR a few seconds ago Failed making (/volume1/downloads/incomplete)Traceback (most recent call last):  File "/volume1/@appstore/sabnzbd/share/SABnzbd/sabnzbd/filesystem.py", line 672, in create_all_dirs    os.mkdir(path_part_combined)PermissionError: [Errno 13] Permission denied: '/volume1/downloads/incomplete'
ERROR a few seconds ago Cannot create directory /volume1/downloads/incomplete
ERROR a few seconds ago Failed making (/volume1/downloads/incomplete)

Secondly I tried to set the folders manually under the cog icon under settings/folders. The fields are already prefilled with what I think is the correct path (/volume1/downloads/complete) , however saving gives me : "Cannot create directory /volume1/downloads/complete"
Note: If I browse to set the path here I get no browse window. Just a very minimal windows with header: temporary download folder, a tickbox for "system folder" and a cancel and accept button.

Steps to reproduce

_1._installation
2. for second issue: see above, go to cog icon then folders.
3.

Package log

Setup

I am sorry, not sure how to find the log, can't find a var folder. Will try to find out how to get to this folder.

@ghost
Copy link

ghost commented Sep 5, 2021

Sounds like either:

  1. You don't have a shared folder called downloads. Go into Control Panel and make one, ensuring the sc-download group has read/write permissions to the folder.
  2. If you already have the folder, chances are the upgrade may have not set permissions correctly. You'll need to go into File Station and give the 'sc-download' group read/write permissions to the folder.

@BenjV
Copy link

BenjV commented Sep 5, 2021

No the sc-download is for DSM 6 only, that does not work anymore for DSM 7

Check in the control panel the permissions of the share downloads to see if the "system internal user" sc-sabnzbd has read/write permission there.
Most likely the subfolder "incomplete" already existed and then the installation script gets an permission error because as of DSM 7 the installation script are no longer root but in this case run as sc-sabnzbd.
You must go into FileStation select the properties of the folder incomplete and add the permissions for sc-sabnzbd
If other folders are needed do the same for them.

@jaspov
Copy link
Author

jaspov commented Sep 6, 2021

No the sc-download is for DSM 6 only, that does not work anymore for DSM 7

Check in the control panel the permissions of the share downloads to see if the "system internal user" sc-sabnzbd has read/write permission there.
Most likely the subfolder "incomplete" already existed and then the installation script gets an permission error because as of DSM 7 the installation script are no longer root but in this case run as sc-sabnzbd.
You must go into FileStation select the properties of the folder incomplete and add the permissions for sc-sabnzbd
If other folders are needed do the same for them.

Thanks. Checked "control panel", "shared folder". Selected "downloads folder" and switched dropdown to "system internal user". To my surprise there is already only one checkmark and its for read/write access to sc-sabnzb. Python and all the other "users" have no checkmarks. If I am correct I can only do this for "downloads" not for subfolders complete/incomplete.
doublecheck: in control panel the folder Volume 1 has a capitalized letter "V". In path settings it is not capitalized, is that relevant?

Also tried a slightly different folder name in sabnzb configuration volume1/downloads/complete1 and /incomplete1 as these folders don't exist yet. That gives me the same error "Cannot create directory /volume1/downloads/complete1"

Likely irrelevant: in control panel, shared folders, permissions I can also change to "local groups". There I do see previously mentioned sc-download. It has no read/write access to downloads so I selected that as well (however if I understand correctly that is/was only relevant for DSM 6).

@BenjV
Copy link

BenjV commented Sep 6, 2021

I am completely puzzled.
I installed SabNzbd on my test Nas, (used the share Sab instead of downloads) and run it and also got an error.

download_dir directory: /volume1/Sab/incomplete error accessing

I checked the process and it is (as expected) running as user sc-sabnzbd
I checked the folder /volume1/Sab/incomplete and the user "sc-sabnzbd" has read/write permissions there.

The only thing I can think of is that SabNzbd is trying to change the permissions of those folder and the new (DSM 7) permission system of DSM does not allow that because it it using ACL's and not the linux permission settings.

EDIT:
I did some more investigations and I was correct.
You can fix this for now by logging in to the commandline with your admin account en give this command:

sudo chown -R sc-sabnzbd /volume1/downloads/

You should create an issue on the SabNzbd github that they should change this and not try to change the permissions of te folders incomplete. complete and watch if they already exists.
And on Synology they always exists because the installation packages creates them.

@Safihre
Copy link
Contributor

Safihre commented Sep 6, 2021

EDIT:
I did some more investigations and I was correct.
You can fix this for now by logging in to the commandline with your admin account en give this command:

sudo chown -R sc-sabnzbd /volume1/downloads/

You should create an issue on the SabNzbd github that they should change this and not try to change the permissions of te folders incomplete. complete and watch if they already exists.
And on Synology they always exists because the installation packages creates them.

This message is thrown by SABnzbd if it doesn't have read or write access:
https://github.com/sabnzbd/sabnzbd/blob/82268b58e2a9a2729d875bc0d0ee9bf8502413b5/sabnzbd/filesystem.py#L389-L395

@jaspov
Copy link
Author

jaspov commented Sep 6, 2021

EDIT:
I did some more investigations and I was correct.
You can fix this for now by logging in to the commandline with your admin account en give this command:

sudo chown -R sc-sabnzbd /volume1/downloads/

You should create an issue on the SabNzbd github that they should change this and not try to change the permissions of te folders incomplete. complete and watch if they already exists.
And on Synology they always exists because the installation packages creates them.

This message is thrown by SABnzbd if it doesn't have read or write access:
https://github.com/sabnzbd/sabnzbd/blob/82268b58e2a9a2729d875bc0d0ee9bf8502413b5/sabnzbd/filesystem.py#L389-L395

Thanks Safihre. Should I create an issue as BenjV described? Or any other suggestion on what to do to get it working for me (and others)? Bit confused now as sc-sabnzb as read/write access but still getting this error and sabnzb isn't working (see posts above).

@BenjV
Copy link

BenjV commented Sep 6, 2021

EDIT:
I did some more investigations and I was correct.
You can fix this for now by logging in to the commandline with your admin account en give this command:

sudo chown -R sc-sabnzbd /volume1/downloads/

You should create an issue on the SabNzbd github that they should change this and not try to change the permissions of te folders incomplete. complete and watch if they already exists.
And on Synology they always exists because the installation packages creates them.

This message is thrown by SABnzbd if it doesn't have read or write access:
https://github.com/sabnzbd/sabnzbd/blob/82268b58e2a9a2729d875bc0d0ee9bf8502413b5/sabnzbd/filesystem.py#L389-L395

The problem is that the directory exists, the user "sc-sabnzbd" has read/write permissions and that Sabnzbd still try's to create the directory with the os.mkdir command.

@jaspov
Copy link
Author

jaspov commented Sep 6, 2021

Enabled SSH and used putty in windows to execute "sudo chown -R sc-sabnzbd /volume1/downloads/"
Didn't work so rebooted, still didn't work.

Stopped the package, executed the command again via SSH, started package and still same errors:

ERROR                         a minute ago                         Cannot create directory /volume1/downloads/incomplete
--
ERROR                         a minute ago                         Failed making (/volume1/downloads/incomplete)Traceback (most recent call last):  File "/volume1/@appstore/sabnzbd/share/SABnzbd/sabnzbd/filesystem.py", line 672, in create_all_dirs    os.mkdir(path_part_combined)PermissionError: [Errno 13] Permission denied: '/volume1/downloads/incomplete'
ERROR                         a minute ago                         Cannot create directory /volume1/downloads/incomplete
ERROR                         a minute ago                         Failed making (/volume1/downloads/incomplete)

Also wonder if I am the only one with the weird browse menu under configuration if I try to set the folder manually and click browse (see picture)
2021-09-06_18h13_47

@BenjV
Copy link

BenjV commented Sep 6, 2021

It is a strange problem.

A workaround could be to remove SanNzd and remove the share "dowloads" and then install SabNzbd fresh.

@niekniek89
Copy link

I have no issues with a new/fresh install. Thanks for all the work!

@Safihre
Copy link
Contributor

Safihre commented Sep 6, 2021

The problem is that the directory exists, the user "sc-sabnzbd" has read/write permissions and that Sabnzbd still try's to create the directory with the os.mkdir command.

It only does that when it can't access the the directory.

@jaspov no, I am the author of the SABnzbd application. The issue is not the application, it has always worked this way, it's a problem in the specific SynoCommunity package that we should fix.

@jaspov
Copy link
Author

jaspov commented Sep 6, 2021

@jaspov no, I am the author of the SABnzbd application. The issue is not the application, it has always worked this way, it's a problem in the specific SynoCommunity package that we should fix.

Thanks Safihre, I recognize your name from the package in package center. Thanks for all the great work! As you can see I am a complete noob here, any action I should still take or should I just wait untill a package update arrives?
Also curious if the "browse folder" window can be fixed. Always prefer browsing and clicking paths so I don't make any (case sensitive) typos.

@publicarray
Copy link
Member

This is what I have after a fresh installation. What is the output of these commands on a system with the error?

root@DSM7 / [255]# synoacltool -get /volume1/Sab/incomplete
(synoacltool.c, 489)It's Linux mode

root@DSM7 / [255]# synoacltool -get /volume1/Sab/
ACL version: 1 
Archive: has_ACL,is_support_ACL 
Owner: [root(user)] 
--------------------- 
	 [0] group:administrators:allow:rwxpdDaARWc--:fd-- (level:0)
	 [1] user:sc-sabnzbd:allow:rwxpdDaARWc--:fd-- (level:0)

root@DSM7 /#  ls -l /volume1/Sab/
total 0
drwx------+ 1 sc-sabnzbd sc-sabnzbd 0 Sep  7 01:11 complete
drwxrwxrwx+ 1 root       root       8 Sep  7 01:10 @eaDir
drwxr-xr-x  1 sc-sabnzbd sc-sabnzbd 0 Sep  7 01:11 incomplete
drwx------+ 1 sc-sabnzbd sc-sabnzbd 0 Sep  7 01:11 watch

@jaspov
Copy link
Author

jaspov commented Sep 7, 2021

Hope I tried correctly, I get this: After the second command I have sc-download where you have sc-sabnzb

adminacc@DS214Play:~$ synoacltool -get /volume1/downloads/incomplete
(synoacltool.c, 489)It's Linux mode
adminacc@DS214Play:~$ synoacltool -get /volume1/downloads/
ACL version: 1
Archive: has_ACL,is_support_ACL
Owner: [sc-sabnzbd(user)]
---------------------
         [0] group:administrators:allow:rwxpdDaARWc--:fd-- (level:0)
         [1] group:sc-download:allow:r-x---a-R----:---n (level:0)
adminacc@DS214Play:~$ ls -l /volume1/downloads
total 24
drwxrwxrwx  3 sc-sabnzbd users    4096 Sep  6 18:36 complete
drwxrwxrwx+ 3 sc-sabnzbd root     4096 Sep  6 17:03 @eaDir
drwxrwxrwx  2 sc-sabnzbd sabnzbd 12288 Dec 11  2020 incomplete
drwxrwxrwx+ 8 adminacc  users    4096 Sep  7 08:41 temp
adminacc@DS214Play:~$

I attached two screenshots of what it looks like in Synology settings on downloads shared folder (just to be complete, all ticked boxes are shown in these pictures)
1
2

@BenjV
Copy link

BenjV commented Sep 7, 2021

This is why I called it a very strange problem.
Everything seems to be OK and still SabNzbd has problems, does not see the

I tried to duplicate the problem but failed.
I tried a fresh install using a new share and I tried a fresh install using an already existing share and I tried to change the share to an already existing share from within SabNzbd.
I even tried to use the share used and created by Transmission (of course I set the correct permission for sc-sabnzbd first)
No issues where found at all.

@jaspov
By the way the group access of sc-download is a leftover from DSM 6 and has no influence anymore on DSM 7 you can remove that one.
Where did you get the package, because for me it is still not to be found via the package center on my Nas, if I use that it will try to install the DSM 6 version and fails.

@publicarray
Is SabNzbd for DSM 7 already and correctly published?

@publicarray
Copy link
Member

sc-download where you have sc-sabnzb

Yea that is likely part of the problem, however, the owner is sc-sabnzb so should have permission. Do you remember if your NAS was upgraded from DSM5 to 6 and now to 7 or was it just from 6 to 7? I think the easiest way to fix is to create a new shared folder and move everything across, like @BenjV #4842 (comment) mentioned.

@publicarray
Copy link
Member

@BenjV

Is SabNzbd for DSM 7 already and correctly published?

yes

@jaspov
Copy link
Author

jaspov commented Sep 7, 2021

@jaspov
By the way the group access of sc-download is a leftover from DSM 6 and has no influence anymore on DSM 7 you can remove that one.
Where did you get the package, because for me it is still not to be found via the package center on my Nas, if I use that it will try to install the DSM 6 version and fails.

I initially downloaded and installed manually from https://synocommunity.com/package/sabnzbd
Then I uninstalled and reinstalled via Package center (by that time package center was showing the latest version)

@jaspov
Copy link
Author

jaspov commented Sep 7, 2021

sc-download where you have sc-sabnzb

Yea that is likely part of the problem, however, the owner is sc-sabnzb so should have permission. Do you remember if your NAS was upgraded from DSM5 to 6 and now to 7 or was it just from 6 to 7? I think the easiest way to fix is to create a new shared folder and move everything across, like @BenjV #4842 (comment) mentioned.

Thanks for that. I bought the NAS in 2015 so must have upgraded from 5 to 6 and now to 7.
I will try to do the workaround as described. Will I need to create an owner (local group) sc-sabnzbd or should it be enough to recreate the colume "downloads" and reinstall and will that automatically correct the owner issues?

Update: just uninstalled sabnzb. Deleted "downloads" share and removed user "sc-download".
Continued with a (re)install of sabnzb and now all errors are gone. Downloads has been newly created (with subfolders complete, incomplete and watch). So seems solved for me now.

Also the browse window now works fine.

New update: needed to uninstall python 3.8 as well to get everything working.
Lomg version: while installation of sabnzb was fixed, I still had some issues with sabnzb itself, mostly that it did not download and the skin would not update properly. I found some python errors. as complete uninstall and reinstall (and removing downloads...) fixed sabnzb I also uninstalled python 3.8. This required me to uninstall sabnzb again (dependency). So after installing sabnzb a third time (which automatically adds python 3.8) it is finally working. Might be helpful if you have the same issue

@jaspov jaspov closed this as completed Sep 7, 2021
@BenjV
Copy link

BenjV commented Sep 7, 2021

@publicarray
Maybe you were on the right path with the age of the system.
This looks like a problem from the past when volumes were created without ACL support.
On DSM 6 you could change that volume to include ACL support but I could not found such a setting on DSM 7

@almograve
Copy link

I was able to fix this issue by deleting both the downloads folder on my nas and reinstalling the sabnzb app BUT sab still doesn't have access to any other existing folder but the "downloads" one and can't rename/move/create folders where I store my shows: volume1/Media/TVShows....
F
ailed making (/volume1/Media/TVShows/eeeeee/Season 1/eeeeeeee
Traceback (most recent call last):
File "/volume1/@appstore/sabnzbd/share/SABnzbd/sabnzbd/filesystem.py", line 672, in create_all_dirs
os.mkdir(path_part_combined)
PermissionError: [Errno 13] Permission denied: '/volume1/Media/TVShows'

@publicarray
Copy link
Member

@almograve I assume you are running DSM7? If so the permission system has changed again: https://github.com/SynoCommunity/spksrc/wiki/Permission-Management#dsm-7-migration

@almograve
Copy link

@publicarray did all that. Won't work. However, I've just created a test share and put some folder into it and I can navigate to it. No need for advanced permission, just give the sc-download access how explained in your guide. I then replicated the exact same settings on my Media folder but it won't work. Create a new Media2 folder, moved it all into it, deleted Media and then Renamed Media2 into Media and it's all good....very very strange

@publicarray
Copy link
Member

The sc-download group no longer works in DSM7 you have to use sc-{packagename} in the system intenal user dropdown

@almograve
Copy link

The sc-download group no longer works in DSM7 you have to use sc-{packagename} in the system intenal user dropdown

yes yes, sorry, was also selected. But it woudn't do it.

@publicarray
Copy link
Member

publicarray commented Sep 18, 2021

Thanks @almograve, so you did get it working with a brand-new share? I suspect that upgrading shares from previous DSM versions doesn't always work correctly (possibly due to the different permission models over the years) and is likely a Synology issue, not much we can do, unfortunately.

@almograve
Copy link

@publicarray yes, that's what I have done. A brand new share with just the rights given to the sc-sabnzbd profile and that's it.

@jmbeck15
Copy link

You might try sudo chmod 777 /volume1/Downloads to force the folder to have sane permissions without the ACL stuff in there. If you ls -la /volume1/Downloads and there is a + character after the permissions string, it may mean access is denied because extended permissions are getting denied. I saw this behavior without even upgrading to DSM 7; in fact, it seemed to happen after upgrading to DSM 6.2.4-25556 Update 2 (but I'm not sure about that).

In any case, sudo chmod 777 <folder> solved it for me. Hopefully didn't screw up something else...

@BenjV
Copy link

BenjV commented Sep 25, 2021

This will screw up the permission structure of DSM which is build on ACL functionality.
That + sign indicates that ACL settings are used, which where introduced by Synology as of DSM 6.

If you remove that, Dsm permissions will not function correctly anymore.

@jmbeck15
Copy link

jmbeck15 commented Sep 26, 2021

@BenjV True, but the permissions weren't working properly previously. And since the directory in question is only used (and created) by external software, I suspect the reason re-installation is working is because it's creating this directory from scratch. I arrived at this conclusion because my complete folder had ACL permissions and my incomplete folder did not. And if I changed settings so the SABnzb complete folder was the incomplete folder, it worked fine.

Interestingly, creating a directory using mkdir from an SSH login, automatically adds ACL permissions. Someone could probably explore this a bit and figure out how to restore the proper ACL permissions. I never ran ls -le on the broken directory to see what ACL permissions it was missing, so I can't tell how to fix them. But two things are (I think) clear:

  1. ACL permissions got screwed up in some update of something.
  2. It probably doesn't hurt anything to nuke ACL permissions on the download directory that SABnzb uses.

If someone has a counterexample for how this will cause a problem, please let me know.

@BenjV
Copy link

BenjV commented Sep 26, 2021

I don't agree that nuking ACL won't hurt anything, it will mess-up DSM.
ACL are needed to give different users access to various folders and as of DSM 7 all packages are running with only user permissions.
So if you don't use ACL's then no other users/packages can use those files/folders.

So the more likely explanation is that messing with permissions(now or in the past) without correctly using ACL has messed-up thing, because on my system, that of @publicarray and lots of other systems thing are working as expected, only in some rare cases this is not working correctly.

@idearat1
Copy link

Thanks so much for those who contributed to this thread. Like others, I'd checked all the permissions and still had the errors in SABnzbd. I didn't change things via SSH, but it turned out to be an easy fix.
I had other directories under /downloads so I moved them en masse to a temporary location.
Next, in Shared Folder I deleted /downloads then re-created it, setting the permissions so they appeared to match what I'd had previously.
I moved the subdirectories back.
All worked well. I had to go back later when I couldn't access the files via NFS and add that back in.
Now I'll just wait to see what other surprises DSM 7 brings me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants