SMB mount permission issue for sonarr only


#1

Sonarr version (exact version): 2.0.0.5252
Mono version (if Sonarr is not running on Windows): 4.2.1
OS: Linux nvrlnd 4.14.52 #1 SMP Thu Oct 11 15:51:48 CST 2018 aarch64 aarch64 aarch64 GNU/Linux (Ubuntu 16.04.5 LTS)
Debug logs: https://pastebin.com/yhmZyfDG

Description of issue:
When trying to update the root folder path in Series editor to “/home/qbt/Sonarr/”, I get “Folder is not writable by user qbt” error. But that folder IS writable by that user.

Sonarr is running as user “qbt”
qbt@nvrlnd:~$ ps ugxaw | grep mono
qbt 1661 1.6 28.4 1834176 289300 ? Ssl Jan06 14:34 /usr/bin/mono /opt/NzbDrone/NzbDrone.exe -nobrowser -data=/home/qbt/.config/NzbDrone

As that user I can change directory to that folder, AND create files to my hearts content:

qbt@nvrlnd:~$ cd /home/qbt/Sonarr/

qbt@nvrlnd:~/Sonarr$ ls -laus
total 0
0 drwxrwxr-x 2 qnap users 0 Jan 7 09:16 .
0 drwxrwxr-x 2 qnap users 0 Jan 7 08:43 …
0 drwxrwxr-x 2 qnap users 0 Jan 7 09:16 .RecycleBin

qbt@nvrlnd:~/Sonarr$ touch sonarr_write_test.txt

qbt@nvrlnd:~/Sonarr$ ls -laus
total 0
0 drwxrwxr-x 2 qnap users 0 Jan 7 09:16 .
0 drwxrwxr-x 2 qnap users 0 Jan 7 08:43 …
0 drwxrwxr-x 2 qnap users 0 Jan 7 09:16 .RecycleBin
0 -rwxrwxr-x 1 qnap users 0 Jan 7 09:48 sonarr_write_test.txt

qbt@nvrlnd:~/Sonarr$ rm sonarr_write_test.txt

qbt@nvrlnd:~/Sonarr$ ls -laus
total 0
0 drwxrwxr-x 2 qnap users 0 Jan 7 09:48 .
0 drwxrwxr-x 2 qnap users 0 Jan 7 08:43 …
0 drwxrwxr-x 2 qnap users 0 Jan 7 09:16 .RecycleBin

You can see in the trace log the error.
Question: why does the trace log also display : Access to the path “/home/(removed)/Sonarr/sonarr_write_test.txt” is denied. "
What is “(removed)”?? I didn’t put that there. Sonarr did.

/home/qnap/Sonarr is a symlink to a cifs mount at /mnt/smb/qnap/Video/Sonarr. I’ve also tried the full path to the mount point (/mnt/smb/qnap/Video/Sonarr) and I get the same “Folder is not writeable” error. (Trace log for full path is here: https://pastebin.com/bf2BGMA5)

Again, the user the service is running as has full access to the path:
qbt@nvrlnd:~$ cd /mnt/smb/qnap/Video/Sonarr

qbt@nvrlnd:/mnt/smb/qnap/Video/Sonarr$ ls -laus
total 0
0 drwxrwxr-x 2 qnap users 0 Jan 7 09:48 .
0 drwxrwxr-x 2 qnap users 0 Jan 7 08:43 …
0 drwxrwxr-x 2 qnap users 0 Jan 7 09:16 .RecycleBin

qbt@nvrlnd:/mnt/smb/qnap/Video/Sonarr$ touch sonarr_write_test.txt

qbt@nvrlnd:/mnt/smb/qnap/Video/Sonarr$ ls -laus
total 0
0 drwxrwxr-x 2 qnap users 0 Jan 7 09:48 .
0 drwxrwxr-x 2 qnap users 0 Jan 7 08:43 …
0 drwxrwxr-x 2 qnap users 0 Jan 7 09:16 .RecycleBin
0 -rwxrwxr-x 1 qnap users 0 Jan 7 09:59 sonarr_write_test.txt

qbt@nvrlnd:/mnt/smb/qnap/Video/Sonarr$ rm sonarr_write_test.txt

qbt@nvrlnd:/mnt/smb/qnap/Video/Sonarr$ ls -laus
total 0
0 drwxrwxr-x 2 qnap users 0 Jan 7 10:00 .
0 drwxrwxr-x 2 qnap users 0 Jan 7 08:43 …
0 drwxrwxr-x 2 qnap users 0 Jan 7 09:16 .RecycleBin

Why does sonarr think it does not have write access to the folder, when it clearly does? Any other process running at “qbt” can access that share without any issue. This tells me there is no issue with share permissions. It seems clearly a sonarr thing.


#2

Hold on this… I think I know what the issue is, but I’m away from my system. Will check when I get home and update here.


#3

Resolved. Rookie mistake… sigh.

When you fix the group permissions for an account so that it can write to a folder, you MUST make sure that any processes using that account are also restarted. Running processes do NOT pickup any new permissions (group membership) that may have been added. They are figured out at initial run time. Sonarr was running using “old” group membership. I never restarted that process using the new group membership. This is what got me confused; the account could write, but the Sonarr process could not.

Once I restarted the Sonarr service… all was hunky-dory.


#4

the (removed) part is sonarr sanitising the logs so you can upload them without giving away anything private


#5

I think the solution to my problem may be different from yours because I set everything to 777, and I did restart sonarr from the web interface, but if you’d be willing to take a look and help me out I’d appreciate it since it sounds like you know what you’re talking about.