Manual torrent won't hardlink, Completed Download Handling + Hardlinks on

Sonarr version (exact version): 2.0.0.5227
Mono version (if Sonarr is not running on Windows): 5.8.0.108
OS: Synology NAS with Windows/Chrome browser client
Debug logs: https://pastebin.com/28QvFAU9 <<< NEW PASTEBIN
Description of issue: Howdy y’all, first time Sonarr user setting up a Synology NAS 218+ with Deluge, Sonarr, and Plex. Using a private tracker so I want to seed torrents when completed. Tested with a 10-episode TV season; did not trigger from Sonarr, started the torrent manually. But I set up Sonarr to watch for the show’s episodes and move them to the proper Plex folder.

Unfortunately it’s not moving all my files over - only the first 9 episodes were moved - and the first 8 were erased in the torrents folder. So the Deluge torrent is in an error state and the tracker is mad that I’m not seeding.

Set up Deluge to download into an /Incomplete folder and move torrents with the tv-sonarr label to a /Complete/TV Shows folder. This appears to be working fine.

Set up Sonarr with the following maybe-relevant settings:
Rename Episodes: No
Create empty series folders: Yes
Delete empty folders: No
Use Hardlinks instead of Copy: Yes
Ignore Deleted Episodes: Yes
Completed Download Handling: Enabled, Remove: No
Failed Download Handling: Redownload: Yes, Remove: Yes
No Drone Factory set up

TV Show settings:
Monitored: Yes
Use Season Folder: Yes

All files show up correctly in History/Imported
Errors start at line 1584 in pastebin
Example:

18-6-22 03:05:18.8|Warn|DiskTransferService|Failed to completely transfer [/volume1/homes/ibjhtt/Complete/TV Shows/Westworld.S01.UHD.BluRay.2160p.TrueHD.Atmos.7.1.HEVC.REMUX-FraMeSToR/Westworld.S01E01.The.Original.2160p.TrueHD.Atmos.7.1.HEVC.REMUX-FraMeSToR.mkv] to [/volume1/video/TV Shows/Westworld/Season 01/Westworld.S01E01.The.Original.2160p.TrueHD.Atmos.7.1.HEVC.REMUX-FraMeSToR.mkv], retrying [2/2].
(...)
18-6-22 03:24:05.6|Warn|ImportApprovedEpisodes|Couldn't import episode /volume1/homes/ibjhtt/Complete/TV Shows/Westworld.S01.UHD.BluRay.2160p.TrueHD.Atmos.7.1.HEVC.REMUX-FraMeSToR/Westworld.S01E01.The.Original.2160p.TrueHD.Atmos.7.1.HEVC.REMUX-FraMeSToR.mkv

[v2.0.0.5227] System.IO.IOException: Win32 IO returned ERROR_ALREADY_EXISTS. Path:
  at System.IO.File.Move (System.String sourceFileName, System.String destFileName) [0x00102] in <cb410c64c7fa4e8d9841a0cbe4173d66>:0
  at NzbDrone.Common.Disk.DiskProviderBase.MoveFileInternal (System.String source, System.String destination) [0x00000] in <dd337064f29a4a97b4aebc45eed6b5e1>:0
  at NzbDrone.Mono.Disk.DiskProvider.MoveFileInternal (System.String source, System.String destination) [0x00076] in <9073f729c6fe43b9804be90c82248975>:0
  at NzbDrone.Common.Disk.DiskProviderBase.MoveFile (System.String source, System.String destination, System.Boolean overwrite) [0x000e3] in <dd337064f29a4a97b4aebc45eed6b5e1>:0
  at NzbDrone.Common.Disk.DiskTransferService.TryCopyFileTransactional (System.String sourcePath, System.String targetPath, System.Int64 originalSize) [0x00108] in <dd337064f29a4a97b4aebc45eed6b5e1>: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) [0x0034a] in <dd337064f29a4a97b4aebc45eed6b5e1>: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 <dd337064f29a4a97b4aebc45eed6b5e1>: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 <aabac9b0ad5b4efbaa46877cbbb98e40>:0
  at NzbDrone.Core.MediaFiles.EpisodeFileMovingService.CopyEpisodeFile (NzbDrone.Core.MediaFiles.EpisodeFile episodeFile, NzbDrone.Core.Parser.Model.LocalEpisode localEpisode) [0x00079] in <aabac9b0ad5b4efbaa46877cbbb98e40>:0
  at NzbDrone.Core.MediaFiles.UpgradeMediaFileService.UpgradeEpisodeFile (NzbDrone.Core.MediaFiles.EpisodeFile episodeFile, NzbDrone.Core.Parser.Model.LocalEpisode localEpisode, System.Boolean copyOnly) [0x00167] in <aabac9b0ad5b4efbaa46877cbbb98e40>: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) [0x00272] in <aabac9b0ad5b4efbaa46877cbbb98e40>:0

If y’all have any idea what might’ve happened and how to avoid it going forward, I’m all ears. Thank you!

EDIT: Should also mention, I believe there was a NAS file upload operation going on at the time, so it’s possible this was a bug exposed by a clogged CPU.

EDIT 2: New debug-level pastebin. See reply below for details.

Without debug logs we can’t see what lead up to the error importing, but when Sonarr imports a seeding torrent it copies/hardlinks the files, it doesn’t move them.

As long as you’re using the Deluge torrent client directly in Sonarr and not torrent blackhole and the torrent is seeding in Deluge everything should just work.

1 Like

Crap of course. I didn’t use the Deluge client in Sonarr, I used Deluge to open the torrent from a downloaded .torrent file. That probably explains why things went sideways. I’ll change to debug logs and give it another shot, report back, and mark the post as closed if that’s the solution. Thanks, marcus101

EDIT: @marcus101 So I’ve spent a big chunk of the day troubleshooting. Part of my issue is that I’m going to be downloading a lot of full season torrents, due to using a private tracker where full seasons are typically freeleech. Shouldn’t be a problem, just requires a manual import.

Not sure what went sideways in the OP. But now I’m getting a consistent and reproducible problem that’s probably related. According to the debug logs, manually imported files are failing to hardlink because it thinks the two files are on different file systems, so it’s copying the full files instead. Thing is, both files are within the same volume on the same Synology NAS - one in /volume1/home/ibjhtt/Complete/TV Shows/ (Deluge completed folder for tv-sonarr labeled files) and the other in /volume1/video/TV Shows/ (Plex folder).

Debug log link above updated. Here’s the most relevant portion IMO:

18-6-23 21:13:16.6|Debug|EpisodeFileMovingService|Hardlinking episode file: /volume1/homes/ibjhtt/Complete/TV Shows/Westworld.S01.UHD.BluRay.2160p.TrueHD.Atmos.7.1.HEVC.REMUX-FraMeSToR/Westworld.S01E03.The.Stray.2160p.TrueHD.Atmos.7.1.HEVC.REMUX-FraMeSToR.mkv to /volume1/video/TV Shows/Westworld/Season 01/Westworld.S01E03.The.Stray.2160p.TrueHD.Atmos.7.1.HEVC.REMUX-FraMeSToR.mkv
18-6-23 21:13:16.6|Debug|DiskTransferService|HardLinkOrCopy [/volume1/homes/ibjhtt/Complete/TV Shows/Westworld.S01.UHD.BluRay.2160p.TrueHD.Atmos.7.1.HEVC.REMUX-FraMeSToR/Westworld.S01E03.The.Stray.2160p.TrueHD.Atmos.7.1.HEVC.REMUX-FraMeSToR.mkv] > [/volume1/video/TV Shows/Westworld/Season 01/Westworld.S01E03.The.Stray.2160p.TrueHD.Atmos.7.1.HEVC.REMUX-FraMeSToR.mkv]
18-6-23 21:13:16.6|Debug|DiskProvider|Hardlink '/volume1/homes/ibjhtt/Complete/TV Shows/Westworld.S01.UHD.BluRay.2160p.TrueHD.Atmos.7.1.HEVC.REMUX-FraMeSToR/Westworld.S01E03.The.Stray.2160p.TrueHD.Atmos.7.1.HEVC.REMUX-FraMeSToR.mkv' to '/volume1/video/TV Shows/Westworld/Season 01/Westworld.S01E03.The.Stray.2160p.TrueHD.Atmos.7.1.HEVC.REMUX-FraMeSToR.mkv' failed.

[v2.0.0.5227] Mono.Unix.UnixIOException: Invalid cross-device link [EXDEV]
  at Mono.Unix.UnixMarshal.ThrowExceptionForLastError () [0x00005] in <e035688a806b484da1bbfa019e10726b>:0 
  at Mono.Unix.UnixMarshal.ThrowExceptionForLastErrorIf (System.Int32 retval) [0x00004] in <e035688a806b484da1bbfa019e10726b>:0 
  at Mono.Unix.UnixFileSystemInfo.CreateLink (System.String path) [0x0000c] in <e035688a806b484da1bbfa019e10726b>:0 
  at NzbDrone.Mono.Disk.DiskProvider.TryCreateHardLink (System.String source, System.String destination) [0x00013] in <9073f729c6fe43b9804be90c82248975>:0 

Let me know what you think.

EDIT2: Guessing based on other forum posts that the issue might be permissions related but I can’t get it working by changing permissions in the UI. Made sure sc-download had read/write access to all my media folders, then retried. Exact same result.

Tried mucking with permissions via Linux commands, per an earlier post, but mostly just broke my browser sessions and screwed up permissions for folders in odd ways. Had to reboot and open a new private browser session just to get access to the control panel again. Another torrent is now in error due to bad permissions, though the torrents sitting right next to it are fine.

Here’s my cat etc/group/; ibjhtt is my username:

#$_@GID__INDEX@_$65537$
administrators:x:101:admin,ibjhtt
AudioStation:x:254178:
avahi:x:84:
bind:x:53:
daemon:x:2:daemon,root
dbus:x:81:
deluge:x:169500:
dovecot:x:143:dovecot
DownloadStation:x:125560:
FileStation:x:179652:
ftp:x:21:ftp
http:x:1023:ibjhtt
HyperBackup:x:256822:
iTunesServer:x:111825:
jackett:x:276806:
ldap:x:439:
log:x:19:root
lp:x:7:lp
maildrop:x:126:
MediaServer:x:118831:
mysql:x:66:
nobody:x:99:
ntp:x:87:
nzbdrone:x:265802:
OAuthService:x:226662:
postfix:x:125:postfix
postgres:x:55:
radarr:x:102788:
root:x:0:root
rpc:x:32:
sc-download:x:65536:ibjhtt,sc-nzbdrone,sc-radarr
smmsp:x:25:
SynoFinder:x:195341:
SynologyApplicationService:x:130369:
SynologyDrive:x:153742:
SynologyGuests:x:106:
SynologyMoments:x:241695:
system:x:1:system
USBCopy:x:123545:
users:x:100:
video:x:65537:ibjhtt,plex
VideoStation:x:228233:
wheel:x:10:

Any advice would be welcome.

EDIT3: Fixed the permissions issue with torrents - somehow, Deluge had write permissions removed from shared folders. In fact according to the interface all my media apps’ write permissions to the shared media folders had been removed so I added them through the UI. That fixed the torrent issues but not the hardlink issues. So I still need to figure out why that’s happening.

EDIT4: Looks like on my Synology NAS, the system’s primary shared folders (homes, video, etc.) are acting like they’re on different partitions, and that blocks the creation of hardlinks. No idea whether this is how the Synology OS works out of the box these days or whether I mucked up settings somehow.

Regardless, if I have Deluge move my completed torrents anywhere in the same shared folder as my Plex library, Sonarr has no problem creating the hardlinks. So that’s what I’ll do.

Consider this topic closed. But if anyone has questions about what I did to fix it, I’m still watching this post, so drop a line.

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