Docker, Sonarr, NZBget, and file permissions

Sonarr version (exact version): 2.0.0.5054
Mono version (if Sonarr is not running on Windows): 4.2.3
OS: Ubuntu 16.04 with Docker 1.12.1
((Debug logs)):

17-11-20 18:16:57.4|Warn|ImportApprovedEpisodes|Couldn’t import episode /downloads/Series/Marvels.The.Punisher.S01E06.1080p.NF.WEB-DL.DD5.1.x264-NTb/Marvels.The.Punisher.S01E06.The.Judas.Goat.1080p.NF.WEB-DL.DD5.1.x264-NTb.mkv

[v2.0.0.5054] System.UnauthorizedAccessException: Access to the path is denied.
at System.IO.File.Move (System.String sourceFileName, System.String destFileName) <0x7f9d3fd4f5c0 + 0x002f0> in :0
at NzbDrone.Common.Disk.DiskProviderBase.MoveFile (System.String source, System.String destination, Boolean overwrite) [0x000e3] in M:\BuildAgent\work\b69c1fe19bfc2c38\src\NzbDrone.Common\Disk\DiskProviderBase.cs:222
at NzbDrone.Common.Disk.DiskTransferService.TryMoveFileVerified (System.String sourcePath, System.String targetPath, Int64 originalSize) [0x00000] in M:\BuildAgent\work\b69c1fe19bfc2c38\src\NzbDrone.Common\Disk\DiskTransferService.cs:566

Description of issue:

I only included the relevant snippet of the log files. Sonarr is running in a Docker containerAs you can see, I am unable to import files downloaded from NZBget, which is running in a Docker container. (I have been able to download files grabbed via Deluge, running in a different Docker image.)

“sonarr”, “deluge”, and “nbzget” are all different user accounts on the base filesystem, and the appropriate UIDs and GIDs are passed to the containers so that files are owned by each username. That is, “sonarr” owns the TV show files in the Plex folder, while “deluge” owns the files downloaded from torrents and “nzbget” owns the files downloaded from newsgroups.

I am using AuFS to fuse the download directories from each download client into a single namespace.

I suspect that Sonarr is trying to rename the file in-place, before moving it to the /tv folder, and it is probably failing because the folder is owned by nzbget:nzbget and 775, and despite the sonarr user being in the nzbget group, it is (probably) trying to create the file as sonarr:sonarr.

How do I make Sonarr play nicely with NZBget when they are both running as different users in different Docker containers?

Have the files/folders belong to a common group that the nzbget and sonarr users are members of and ensure permissions allow the group read and write access.

This worked, but only after I restarted the Docker container.

Just for the benefit of anyone searching, I added the sonarr user to the nzbget group, made sure the files and folders had group permissions (and set the umask appropriately in nzbget), and restarted the Sonarr Docker container to get it to pick up the changed information. (Prior to restarting, it still gave me permission errors, which was the source of my confusion.)

1 Like

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