Permission denied ( Failure in tempfile.mkstemp)

Support for the Debian/Ubuntu package, created by JCFP.
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
atemispro8
Newbie
Newbie
Posts: 3
Joined: February 12th, 2018, 3:26 pm

Permission denied ( Failure in tempfile.mkstemp)

Post by atemispro8 » February 12th, 2018, 3:57 pm

I've had my sabnzbd setup for a few years working without issues. Previously the sabnzbd completed and incomplete folders reside on a mounted filesystem. I am migrating to a new external filesystem. I mount the new filesystem in the same location (all the same paths match - no changes required). I confirmed the permissions and owners of the sabnzbd folders match the previous directory tree and they do.

I am running sabnazbd as my local user, and that user is the owner of the folder. The folders also have 777 permissions.

Sabnzbd is able to see the completed/incomplete folders (no errors saying it cannot create them, etc.) but it thinks that it cannot create the temp directories in the incomplete folder. The following is from the logs:

Code: Select all

2018-02-12 14:03:36,228::INFO::[__init__:670] Adding mynzb.nzb
2018-02-12 14:03:36,234::INFO::[misc:993] Creating directories: /mnt/tank/sabnzbd/incomplete/mynzb
2018-02-12 14:03:36,242::ERROR::[__init__:867] Failure in tempfile.mkstemp
OSError: [Errno 13] Permission denied: '/mnt/tank/sabnzbd/incomplete/mynzb/__ADMIN__/SABnzbd_nzf_s4BgHb'
2018-02-12 14:03:36,243::WARNING::[nzbstuff:772] Invalid NZB file mynzb.nzb, skipping (reason=, line=0)
2018-02-12 14:03:36,243::INFO::[nzbstuff:1722] [N/A] Purging data for job mynzb (keep_basic=False, del_files=False)
When I touch a file on the mounted filesystem, this is what it returns:

Code: Select all

[email protected]:~$ touch /mnt/tank/sabnzbd/incomplete/test2
[email protected]:~$ ls -la /mnt/tank/sabnzbd/incomplete/
total 8
drwxrwxrwx 2 matthew matthew 4096 Feb 12 14:15 .
drwxrwxrwx 5 matthew matthew 4096 Feb 12 13:08 ..
-rw-rw-r-- 1 matthew matthew    0 Feb 12 14:15 test2
And below is the current sabnzbd process running as the same user:

Code: Select all

[email protected]:~$ ps aux | grep sab
matthew   1848  0.8  1.0 1994636 85404 ?       Sl   14:01   0:20 /usr/bin/python -OO /usr/bin/sabnzbdplus --daemon --pidfile /var/run/sabnzbdplus/pid --server 0.0.0.0:8081
So..
  • Sab is running as user 'matthew'
  • Folders have 777 permissions
  • Folders are owned by 'matthew'
  • I can touch files into the incomplete directory with correct permissions/users
  • Sab cannot create into the directory
Anyone have any ideas?

User avatar
sander
Release Testers
Release Testers
Posts: 6320
Joined: January 22nd, 2008, 2:22 pm

Re: Permission denied ( Failure in tempfile.mkstemp)

Post by sander » February 12th, 2018, 4:07 pm

Linux rights are a mystery to me, and network drives are even a bigger problem, so this is a long shot:

Code: Select all

2018-02-12 14:03:36,234::INFO::[misc:993] Creating directories: /mnt/tank/sabnzbd/incomplete/mynzb
... so that goes well? Just like your manual touch command?

Code: Select all

2018-02-12 14:03:36,242::ERROR::[__init__:867] Failure in tempfile.mkstemp
OSError: [Errno 13] Permission denied: '/mnt/tank/sabnzbd/incomplete/mynzb/__ADMIN__/SABnzbd_nzf_s4BgHb'
... and that (subdirectory) doesn't go well? Could it be a umask thing? Did you check the rights on /mnt/tank/sabnzbd/incomplete/mynzb/ ?

Code: Select all

2018-02-12 14:03:36,243::WARNING::[nzbstuff:772] Invalid NZB file mynzb.nzb, skipping (reason=, line=0)
Oh ... is this an effect of the lines before, or is your NZB faulty?

User avatar
jcfp
Release Testers
Release Testers
Posts: 871
Joined: February 7th, 2008, 12:45 pm

Re: Permission denied ( Failure in tempfile.mkstemp)

Post by jcfp » February 13th, 2018, 5:41 am

Note that tempfile.mkstemp wants to create "a temporary file in the most secure manner possible". Thus, the mere ability to create a file is insufficient; it also needs to tweak permissions to prevent ending up with a world readable (etc...) file like the one created by 'touch'. Which calls for info on the capabilities and/or mount options of the underlying file system.

atemispro8
Newbie
Newbie
Posts: 3
Joined: February 12th, 2018, 3:26 pm

Re: Permission denied ( Failure in tempfile.mkstemp)

Post by atemispro8 » February 13th, 2018, 10:20 am

sander wrote:
February 12th, 2018, 4:07 pm
... so that goes well? Just like your manual touch command?
No, I dont think so. I used the following watch command to see if there are any actual changes in the incomplete folder and it did not show anything. (This could not be the most accurate way of testing tho).

Code: Select all

watch -n 0.1 -d ls -l /mnt/tank/sabnzbd/incomplete/
sander wrote:
February 12th, 2018, 4:07 pm
... and that (subdirectory) doesn't go well? Could it be a umask thing? Did you check the rights on /mnt/tank/sabnzbd/incomplete/mynzb/ ?
The folder is either not being created or successfully being deleted (as the bottom of the log says it is deleting the folder - rollback).
sander wrote:
February 12th, 2018, 4:07 pm
Oh ... is this an effect of the lines before, or is your NZB faulty?
This happens with every nzb I try. I have tried over 20 just to be sure. I am not sure why it is saying that when it knows it is a permission issue.


jcfp wrote:
February 13th, 2018, 5:41 am
Note that tempfile.mkstemp wants to create "a temporary file in the most secure manner possible". Thus, the mere ability to create a file is insufficient; it also needs to tweak permissions to prevent ending up with a world readable (etc...) file like the one created by 'touch'. Which calls for info on the capabilities and/or mount options of the underlying file system.
My old filesystem was ZFS and I shared the dataset using the built in "zfs set sharenfs=on" command. I am not sure how that equates to a NFS export in terms of options. Below are the export and mount options I have tried.

Export on host (through /etc/exports):

Code: Select all

/storage            192.168.0.0/16(rw,sync,no_subtree_check,no_root_squash,fsid=1942)
Mount on client (through /etc/fstab):

Code: Select all

192.168.10.30:/storage/tank /mnt/tank nfs4 rsize=32768,wsize=32768,timeo=14,_netdev 0 0
#192.168.10.30:/storage/tank /mnt/tank nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0
The uncommented line is how I used to mount the old filesystem I was using. The commented line is another option I found and tried. Both give me the same situation as I originally described (no noticeable differences between the functionality of the two).

atemispro8
Newbie
Newbie
Posts: 3
Joined: February 12th, 2018, 3:26 pm

Re: Permission denied ( Failure in tempfile.mkstemp)

Post by atemispro8 » February 13th, 2018, 4:33 pm

The only other thing I can think to show is a comparison of the parent sabnzbd folder on the host from the old filesystem to the new filesystem:

Code: Select all

# ls -la /tank/sabnzbd/
total 131
drwxrwxrwx 5 matthew matthew 5 Oct  7 21:19 .
drwxr-xr-x 5 root    root    5 Jul 11  2016 ..
drwxrwxrwx 4 matthew matthew 4 Mar 20  2017 completed
drwxrwxrwx 2 matthew matthew 2 Feb 12 12:40 incomplete
drwxrwxrwx 2 matthew matthew 2 Jan  8  2017 watch
# ls -la /storage/tank/sabnzbd/
total 20
drwxrwxrwx 5 matthew matthew 4096 Feb 12 13:08 .
drwxr-xr-x 3 root    root    4096 Jul 11  2016 ..
drwxrwxrwx 4 matthew matthew 4096 Feb 12 13:08 completed
drwxrwxrwx 2 matthew matthew 4096 Feb 12 13:31 incomplete
drwxrwxrwx 2 matthew matthew 4096 Feb 12 13:08 watch
And the only difference is the original /tank/sabnzbd structure shows the symlinks column (5,5,4,2,2) on the left and on the right of the user:group section, where the new filesystem structure is showing the symlink column on the left (5,3,4,2,2) and the foldersize (i think) on the right (4096 . . ).

And that the 'total' section is different?

User avatar
jcfp
Release Testers
Release Testers
Posts: 871
Joined: February 7th, 2008, 12:45 pm

Re: Permission denied ( Failure in tempfile.mkstemp)

Post by jcfp » February 16th, 2018, 3:16 pm

So before it was zfs with some kind of zfs sharing mechanism, and the current one is something (what?) exported via nfs?

Can you change modes of a file created through 'touch' on the command line?

Post Reply