Permissions issue - copy succeeds but Sonarr says permission failure

Sonarr version (exact version):
Mono version (if Sonarr is not running on Windows): (also happening on 6.8.x)
OS: Ubuntu 20.04
Debug logs: Partial: Complete:
Description of issue: I have been rearranging my setup and I’m obviously missing some sort of permissions. Sonarr can download and import with rTorrent just fine, but Nzbget downloads supposedly fail to be imported because of permissions issues. However, the copy happens anyway and Sonarr suddenly says the file already exists. I should note that the copy destination is an smb share, but it’s working with no issues using rTorrent. I was previously on Mono 6.8 but downgraded to 5.2 to see if the issues still persist (they do).

Here is a snapshot of permissions of two files (first one downloaded with rTorrent and succeeded, the second downloaded with Nzbget and “failed” (even though the copy succeeded):

sonarr@lynx:/srv/torrent/downloads/Last.Week.Tonight.With.John.Oliver.S07E07.April.5.2020.1080p.AMZN.WEB-DL.DD+2.0.H.264-monkee$ ls -l
total 2064260
-rw-r--r-- 1 rtorrent rtorrent 2113793409 Jun 13 11:55 Last.Week.Tonight.With.John.Oliver.S07E07.April.5.2020.1080p.AMZN.WEB-DL.DD+2.0.H.264-monkee.mkv
-rw-r--r-- 1 rtorrent rtorrent         92 Jun 13 11:55 Last.Week.Tonight.With.John.Oliver.S07E07.April.5.2020.1080p.AMZN.WEB-DL.DD+2.0.H.264-monkee.nfo

sonarr@lynx:/opt/nzbget/downloads/completed/tv/Last.Week.Tonight.with.John.Oliver.S07E08.720p.WEB.H264-XLF$ ls -l
total 393964
-rwxr-xr-x 1 nzbget droboshares 403413796 Apr 13 06:10 05f98a981ec747158a45dd3dfa63367a.mkv

The logs from the original failure would be the most useful (to see why it copied the file there then aborted), but permissions are the most common thing to look at, though besides different owners I don’t see anything obviously broken.

Yeah it’s very odd.

My mistake, I thought I copied the original attempt in my partial debug log but it looks like i copied one of the retries. I’ll try to get a new log shortly.

@markus101 Update: here’s a new log after deleting the destination file and attempting a manual import. The file was copied over perfectly fine:

This looks to be the key error:
[v3.0.3.885] System.UnauthorizedAccessException: Permission denied ---> Mono.Unix.UnixIOException: Permission denied [EACCES].

I did notice Sonarr is attempting a move instead of a copy, maybe that’s why? Sonarr doesn’t have write access to the downloads folder (I could always add it as a workaround I suppose).

UPDATE 2: I added write permissions to the downloads folder and Sonarr imported it with no complaints, however for some reason in the activity area it stayed stuck at the “Importing” phase. A reboot of Sonarr updated it to “No files found are eligible for import” so I assume it completed the Move sucessfully. How come it’s not fully finishing the process?

Not sure if you sorted this already in Discord, but the logs should have something if it didn’t mark the download as imported in Sonarr.

The solution ended up being setting the proper umask of 002 in my various systemd configs, making sure the download clients are saving with the right umask, and properly setting the permissions and group on any existing files.

1 Like