Issues with Sonarr renaming / moving files on Linux

Hey guys! First thanks for the awesome software, really amazed by the polish.

I’m having an annoying issue with Sonarr, it’s basically unable to move / rename any of the downloaded files. It seems to be a permissions issue, but I’m 100% sure that those should work.

Sonarr is running as user nzbdrone, group media, and the folders it has to access all have the media group read, write and execute bit set.

I have tried using su to use the nzbdrone user, and I can manually navigate to those folders and create files.

However my log is littered with statements like these:

15-10-5 16:27:10.8|Warn|ImportApprovedEpisodes|Couldn't import episode /etc/sabnzbd/Downloads/complete/The.Borgias.S03E01.720p.BluRay.x264-DEMAND/borgias.s03e01.720p.bluray.x264-demand.mkv

System.UnauthorizedAccessException: Access to the path is denied.
  at System.IO.File.Move (System.String sourceFileName, System.String destFileName) [0x00000] in <filename unknown>:0 
  at NzbDrone.Common.Disk.DiskProviderBase.MoveFile (System.String source, System.String destination, Boolean overwrite) [0x000d0] in m:\BuildAgent\work\6c3239faf2b92630\src\NzbDrone.Common\Disk\DiskProviderBase.cs:210 
  at NzbDrone.Common.Disk.DiskTransferService.TransferFile (System.String sourcePath, System.String targetPath, TransferMode mode, Boolean overwrite, Boolean verified) [0x003a6] in m:\BuildAgent\work\6c3239faf2b92630\src\NzbDrone.Common\Disk\DiskTransferService.cs:202 


15-10-5 16:27:07.5|Error|VideoFileInfoReader|Unable to parse media info from file: /etc/sabnzbd/Downloads/complete/Modern.Family.S02E13.HDTV.XviD-LOL/modern.family.213.hdtv-lol.avi

System.UnauthorizedAccessException: Access to the path "/etc/sabnzbd/Downloads/complete/Modern.Family.S02E13.HDTV.XviD-LOL/modern.family.213.hdtv-lol.avi" is denied.
  at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in <filename unknown>:0 
  at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean isAsync, Boolean anonymous) [0x00000] in <filename unknown>:0 
  at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess)
  at NzbDrone.Common.Disk.DiskProviderBase.OpenReadStream (System.String path) [0x0001b] in m:\BuildAgent\work\6c3239faf2b92630\src\NzbDrone.Common\Disk\DiskProviderBase.cs:371 
  at NzbDrone.Core.MediaFiles.MediaInfo.VideoFileInfoReader.GetMediaInfo (System.String filename) [0x00049] in m:\BuildAgent\work\6c3239faf2b92630\src\NzbDrone.Core\MediaFiles\MediaInfo\VideoFileInfoReader.cs:46 

I know how to work with linux users, groups and permissions, both Sickbeard and Couchpotato are setup with their own users, and all read and write to the same folders just by being part of the media group.

I have even tried to set the folders directly as the nzbdrone user. In desperation, I’ve tried setting the folders and files to 777 permissions, basically world read and writable. Has not worked either :frowning:

Am I the only user with this problem? Maybe I’m the only one that doesn’t run Sonarr as root?

Any help would be appreciated :smile:

Hey there. You didn’t mention your downloader, but if files are moving I assume is Usenet.

Have you look at the permissions of the file at the end of the download process? I usually avoid for having this kind of problem to use a umask of 002 in the client.

Plenty of users don’t run as root, so th at isn’t it.

What OS are we talking about?

I’m using ubuntu 14.04. I’m having issues both with sabnzbd and transmission, so I don’t think it’s a client thing. Plus sickbeard and couchpotato have no issue grabbing and renaming the files.

Thanks for the tip with the umask, I use ACL’s to the same effect, but definitely easier to implement that way.

I’ll give some examples:

This is the origin folder:

boss@boss-server /opt/torrents/downloads
> $ ll                                                                                                                                                                              
total 12K
drwxrwsr-x+ 2 debian-transmission media 4.0K Oct  6 11:08 The Last Ship S02E07 720p WEB-DL x264-Belex - Dual Audio

Group is set to media, files inside are accesible too:

boss@boss-server /opt/torrents/downloads
> $ ll                                                                                                                                                                              
total 12K
drwxrwsr-x+ 2 debian-transmission media 4.0K Oct  6 11:20 The Last Ship S02E07 720p WEB-DL x264-Belex - Dual Audio

This is the destination folder:

boss@boss-server /opt/torrents/downloads
> $ ll /storage/TV\ Shows/ | grep "Last Ship"                                                                                                                                       
drwxrwsr-x  1 plex media 1.1K Oct  6 11:28 The Last Ship

nzbdrone user’s group is media:

boss@boss-server /opt/torrents/downloads
> $ groups nzbdrone                                                                                                                                                                 
nzbdrone : media plex debian-transmission

and yet I get those messages in my log. I know it has to be a permissions issue, I just don’t see what I’m doing wrong.

Thanks for the help!

Everything looks fine for me. I wouldn’t use ACL , they tend to complicate more than help.

In your first post you showed a path with error in a totally different location, /etc which is no place for downloads if you ask me. Are you getting the same errors in these other locations /opt and /storage ?

Also I want to see permissions in the above folder. When you do ls -la the single dot shows current dir perm, double dot shows directory above the current.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.