SynoCommunity / spksrc

Cross compilation framework to create native packages for the Synology's NAS
https://synocommunity.com
Other
3.03k stars 1.23k forks source link

Sonarr unable to import downloads #3256

Closed imran0 closed 6 years ago

imran0 commented 6 years ago

Setup

Package Name: Sonarr Package Version: 20180303-13 (inside app this is version 2.0.0.5163)

NAS Model: Synology DS212+ NAS Architecture: ? DSM version: DSM 5.0-4482

Expected behavior

Sonarr should import folder from /volume1/Downloads/Completed -> /volumeUSB2/usbshare/video/TV Shows

Actual behavior

The following error is displayed for a show: Couldn't import episode /volume1/Downloads/Completed/Series/Billions.S03E01.720p.WEB.H264-DEFLATE/f798e91152b843858196fcf16b2a30b0.mkv: Access to the path is denied.

In debug logs this error is logged:

18-3-26 00:40:18.0|Debug|EpisodeFileMovingService|Moving episode file: /volume1/Downloads/Completed/Series/Billions.S03E01.720p.WEB.H264-DEFLATE/f798e91152b843858196fcf16b2a30b0.mkv to /volumeUSB2/usbshare/video/TV Shows/Billions/3x01 - Tie Goes to the Runner WEBDL-720p.mkv
18-3-26 00:40:18.0|Debug|DiskTransferService|Move [/volume1/Downloads/Completed/Series/Billions.S03E01.720p.WEB.H264-DEFLATE/f798e91152b843858196fcf16b2a30b0.mkv] > [/volumeUSB2/usbshare/video/TV Shows/Billions/3x01 - Tie Goes to the Runner WEBDL-720p.mkv]
18-3-26 00:40:18.1|Warn|ImportApprovedEpisodes|Couldn't import episode /volume1/Downloads/Completed/Series/Billions.S03E01.720p.WEB.H264-DEFLATE/f798e91152b843858196fcf16b2a30b0.mkv

[v2.0.0.5163] System.UnauthorizedAccessException: Access to the path is denied.
  at System.IO.File.Move (System.String sourceFileName, System.String destFileName) [0x00116] in <cb410c64c7fa4e8d9841a0cbe4173d66>:0 
  at NzbDrone.Common.Disk.DiskProviderBase.MoveFileInternal (System.String source, System.String destination) [0x00000] in <6d548036160a49ed8e2657c617163f50>:0 
  at NzbDrone.Mono.Disk.DiskProvider.MoveFileInternal (System.String source, System.String destination) [0x00076] in <a4f6bcacc2ea4724bcba67562d4e7206>:0 
  at NzbDrone.Common.Disk.DiskProviderBase.MoveFile (System.String source, System.String destination, System.Boolean overwrite) [0x000e3] in <6d548036160a49ed8e2657c617163f50>:0 
  at NzbDrone.Common.Disk.DiskTransferService.TryMoveFileTransactional (System.String sourcePath, System.String targetPath, System.Int64 originalSize, NzbDrone.Common.Disk.DiskTransferVerificationMode verificationMode) [0x0008f] in <6d548036160a49ed8e2657c617163f50>: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 <6d548036160a49ed8e2657c617163f50>: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 <6d548036160a49ed8e2657c617163f50>: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 <9b8bbe29888f49229914613e26af4aa5>:0 
  at NzbDrone.Core.MediaFiles.EpisodeFileMovingService.MoveEpisodeFile (NzbDrone.Core.MediaFiles.EpisodeFile episodeFile, NzbDrone.Core.Parser.Model.LocalEpisode localEpisode) [0x0006c] in <9b8bbe29888f49229914613e26af4aa5>:0 
  at NzbDrone.Core.MediaFiles.UpgradeMediaFileService.UpgradeEpisodeFile (NzbDrone.Core.MediaFiles.EpisodeFile episodeFile, NzbDrone.Core.Parser.Model.LocalEpisode localEpisode, System.Boolean copyOnly) [0x0017c] in <9b8bbe29888f49229914613e26af4aa5>: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) [0x00277] in <9b8bbe29888f49229914613e26af4aa5>:0 

--

Steps I've taken: I have have given access to volumeUSB2 and Downloads to both sc-downloads and sc-media groups. I have even gone into the individual users (sc-nzbdrone) and given it access to those folders.

Please advise

LtMarx commented 6 years ago

Yes it works for new and existing downloads

yarez0 commented 6 years ago

Does anyone can give us all the members in each group. I played with users and groups and I don’t know if my groups has correct users inside.

Thanks

koenvanzuijlen commented 6 years ago

@LtMarx

Sorry to be a pain but could you give all relevant info on rights and owners for each folder maybe?

LtMarx commented 6 years ago

No worries.

  1. Select all folders (dont select top folder).
  2. Right click properties
  3. change group into sc-download (and apply to all folders, subfolders and files)
  4. Then in the tab authorization, check read, write and execute boxes behind group (and apply to all folders, subfolders and files)

That did the trick for me

Hutsoncap commented 6 years ago

Okay, I think I figured out the issue. RAR files maintain the permissions of whomever packaged the files, and uploaded to the Newsgroup. These original permissions are what is causing issues with importing. In NZBget, you can change the Unrar command to "Ignore file attributes (permissions)", by adding a "x -ai" to the UnrarCmd field in the UNPACK section of NZBGet. After making these changes, all downloads, including the random character files began to correctly inherit the permissions of my "Completed" Directory, and Sonarr imported with no issues. Hope this helps!

yarez0 commented 6 years ago

Ok I’m trying. I’ll feeback on a few days

HansGr00ber commented 6 years ago

@Hutsoncap It's a little early to say that's definitely fixed it for me but so far so good. Not had a failure since adding that switch.

M0UL commented 6 years ago

seems to be working, no import problems since adding the switch

yarez0 commented 6 years ago

confirm that it is working

balmhood commented 6 years ago

i found a fix but have to do this on regular basis, seems like I am losing the permissions from time to time. I did the following:

  1. right click on folder

  2. select properties

  3. put owner: admin

  4. put group: sc-download

  5. image

  6. check "apply to folder..."

  7. click on Permission

  8. tick all and even if all is ticked, tick "Apply to this folder..."

  9. click OK

this worked for me image

BenjV commented 6 years ago

The problem is that you did not convert the shared folder to support ACL's. Read this and especially the last part. https://github.com/SynoCommunity/spksrc/wiki/Permission-Management

Grominx commented 5 years ago

Okay, I think I figured out the issue. RAR files maintain the permissions of whomever packaged the files, and uploaded to the Newsgroup. These original permissions are what is causing issues with importing. In NZBget, you can change the Unrar command to "Ignore file attributes (permissions)", by adding a "x -ai" to the UnrarCmd field in the UNPACK section of NZBGet. After making these changes, all downloads, including the random character files began to correctly inherit the permissions of my "Completed" Directory, and Sonarr imported with no issues. Hope this helps!

Works for me!

dobage commented 3 years ago

I know I am coming to the party way late....I have a Synology DS1019+ and have the synocommunity NZBget, Sonarr, and Radarr (not even trying this until Sonarr works) installed. If I do a normal add NZB manually it will download and unrar fine and save in a "completed" directory and I can move it manually. If I do something through Sonarr it will send it to NZBget and download it but fails on the unrar (Unpack for file name here failed. Also shows Unrar error code: 9 and Could not create directory /Public/tv/file name here/_unpack: could not create directory). I added the switch "x -ai" no change. I have my downloads directory set to admin (now but also tried sc-download) as owner. sc-download, sc-radarr, sc-nzbdrone, sc-nzbget all have rw to the download directory. I see a post up further talking about owner = admin group = sc-download (I do not see the group option. I can tell by the errors it is a permissions issue just can not figure it out. I am really trying to get this to work because my dl speeds when using this set up is over 100MBPS vs my windows setup used for years is no more the 40MBPS.

ds1 ds2