Issue importing from download

Sonarr version: 2.0.0.5338
Mono version: 6.4.0.198
OS: Raspbian Buster

Hi, I’ve been using sonarr for years on Windows and have recently purchased a raspberry pi and trying to set it all up there. I’m doing it all from scratch, not trying to import anything from my old setup.
For the most part, it’s been smooth sailing. Installed fine, connected it up to qbittorrent without a problem and it automatically sent stuff to qbittorrent, awesome.

However, when the download completes it isn’t managing to move it into the library. The error in the log is

Couldn’t import episode /home/qbtuser/Downloads/…/…mkv: Access to the path is denied.

Now I’m comfortable with the linux terminal, but I am still a linux newbie. I’m sure this has something to do with file permissions, but for the life of me I can’t figure it out.

At first the user sonarr runs under didn’t have access to the directory qbittorrent downloaded to. I fixed that up, and confirmed that as that user I could manipulate files.

I then looked at the destination it was trying to move the file to. This is an external hard drive that I’ve formatted as exfat. Looking at the directory the owner is root but everyone has full permissions (777). Again, as the sonarr user I was able to add files here, rename files here. I noticed a hidden file was added to the directory for the file to import with the suffix .partial~ and from what I could see it was the full file, it had just failed to remove the suffix - That file had 777 permissions.

Here is the stack trace

System.UnauthorizedAccessException: Access to the path is denied. ---> System.IO.IOException: Operation not permitted
   --- End of inner exception stack trace ---
  at Interop.ThrowExceptionForIoErrno (Interop+ErrorInfo errorInfo, System.String path, System.Boolean isDirectory, System.Func`2[T,TResult] errorRewriter) [0x00014] in <285579f54af44a2ca048dad6be20e190>:0 
  at Interop.CheckIo (System.Int64 result, System.String path, System.Boolean isDirectory, System.Func`2[T,TResult] errorRewriter) [0x0000a] in <285579f54af44a2ca048dad6be20e190>:0 
  at Interop.CheckIo (System.Int32 result, System.String path, System.Boolean isDirectory, System.Func`2[T,TResult] errorRewriter) [0x00000] in <285579f54af44a2ca048dad6be20e190>:0 
  at System.IO.FileSystem.CopyFile (System.String sourceFullPath, System.String destFullPath, System.Boolean overwrite) [0x0005c] in <285579f54af44a2ca048dad6be20e190>:0 
  at System.IO.FileSystem.LinkOrCopyFile (System.String sourceFullPath, System.String destFullPath) [0x0006f] in <285579f54af44a2ca048dad6be20e190>:0 
  at System.IO.FileSystem.MoveFile (System.String sourceFullPath, System.String destFullPath) [0x0003a] in <285579f54af44a2ca048dad6be20e190>:0 
  at System.IO.File.Move (System.String sourceFileName, System.String destFileName) [0x00083] in <285579f54af44a2ca048dad6be20e190>:0 
  at NzbDrone.Common.Disk.DiskProviderBase.MoveFileInternal (System.String source, System.String destination) [0x00000] in <76bdc4530d5346bba006f54e6ddfeb8a>:0 
  at NzbDrone.Mono.Disk.DiskProvider.MoveFileInternal (System.String source, System.String destination) [0x00076] in <aec85af9bd8541478441e0ba188a66cf>:0 
  at NzbDrone.Common.Disk.DiskProviderBase.MoveFile (System.String source, System.String destination, System.Boolean overwrite) [0x000e3] in <76bdc4530d5346bba006f54e6ddfeb8a>:0 
  at NzbDrone.Common.Disk.DiskTransferService.TryMoveFileTransactional (System.String sourcePath, System.String targetPath, System.Int64 originalSize, NzbDrone.Common.Disk.DiskTransferVerificationMode verificationMode) [0x0008f] in <76bdc4530d5346bba006f54e6ddfeb8a>:0 
  at NzbDrone.Common.Disk.DiskTransferService.TransferFile (System.String sourcePath, System.String targetPath, NzbDrone.Common.Disk.TransferMode mode, System.Boolean overwrite, NzbDrone.Common.Disk.DiskTransferVerificationMode verificationMode) [0x003ce] in <76bdc4530d5346bba006f54e6ddfeb8a>:0 
  at NzbDrone.Common.Disk.DiskTransferService.TransferFile (System.String sourcePath, System.String targetPath, NzbDrone.Common.Disk.TransferMode mode, System.Boolean overwrite, System.Boolean verified) [0x0000e] in <76bdc4530d5346bba006f54e6ddfeb8a>:0 
  at NzbDrone.Core.MediaFiles.EpisodeFileMovingService.TransferFile (NzbDrone.Core.MediaFiles.EpisodeFile episodeFile, NzbDrone.Core.Tv.Series series, System.Collections.Generic.List`1[T] episodes, System.String destinationFilePath, NzbDrone.Common.Disk.TransferMode mode) [0x0012c] in <808631c82f974aa9ade775cc9d46232a>:0 
  at NzbDrone.Core.MediaFiles.EpisodeFileMovingService.MoveEpisodeFile (NzbDrone.Core.MediaFiles.EpisodeFile episodeFile, NzbDrone.Core.Parser.Model.LocalEpisode localEpisode) [0x0006c] in <808631c82f974aa9ade775cc9d46232a>:0 
  at NzbDrone.Core.MediaFiles.UpgradeMediaFileService.UpgradeEpisodeFile (NzbDrone.Core.MediaFiles.EpisodeFile episodeFile, NzbDrone.Core.Parser.Model.LocalEpisode localEpisode, System.Boolean copyOnly) [0x0017c] in <808631c82f974aa9ade775cc9d46232a>:0 
  at NzbDrone.Core.MediaFiles.EpisodeImport.ImportApprovedEpisodes.Import (System.Collections.Generic.List`1[T] decisions, System.Boolean newDownload, NzbDrone.Core.Download.DownloadClientItem downloadClientItem, NzbDrone.Core.MediaFiles.EpisodeImport.ImportMode importMode) [0x00281] in <808631c82f974aa9ade775cc9d46232a>:0

Quickly looking at the source, Line 434 of https://github.com/Sonarr/Sonarr/blob/master/src/NzbDrone.Common/Disk/DiskTransferService.cs is where the issue is happening

If anyone can help me out it would be ace. Thanks in advance!

Just thinking about it some more as the drive is exfat, you can’t set permissions on files in it.
I try to change permissions on a file and the error I get is

Error setting permissions: Operation not permitted

In Settings > Media Management > Permissions, the settings are:
Set Permissions: No
File chmod mask 0644
Folder chmod mask 0755
chown User empty
chown Group empty

Is it possible that even when Set Permissions is No that it attempts to set them to some default values?

I just found https://www.reddit.com/r/sonarr/comments/cigm0m/strange_incomplete_moving_of_files_all_of_a/

So I downgraded to Mono 5.18 and it’s fixed the problem.

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