Folder permissions between FreeNAS storage and Ubuntu 20.04 VM

ionutm80

Dabbler
Joined
Mar 18, 2018
Messages
25
Hi guys,

I desperately need your valuable help and guidance. I have a FreeNAS system where I have set-up an Ubuntu 20.04 VM. Within the VM I have a perfectly working Docker / Docker-Compose environment with Radarr, Sonarr, Transmission with VPN, etc. Within the VM everything is working fine, I add a movie in either Radarr or Sonarr than it's being sent to Transmission which is downloading it and than Radarr/Sonarr grabs the movie and moves it in the movies folder. So far so good. Problem is that my library of existing movies and tv shows sits on a RaidZ2 partition on FreeNAS. I can mount with NFS the movies and tv folders from FreeNAS inside the Ubuntu VM and the main user has write and read access on them: I can create or delete folders there but NOT Radarr neither Sonarr, whenever they try to import a downloaded movie into the mounted share from FreeNAS I get the message that permission is denied. If I unmount the share from FreeNAS they can import the movies in the exact folder in which the share was mounted. Both Radarr and Sonarr Docker have the same GID and UID as the user who is able to write into the mounted share from FreeNAS.

Please help! How can I make Docker Sonarr and Radarr also be able to import movies into the mounted share from FreeNAS?
 

KrisBee

Wizard
Joined
Mar 20, 2017
Messages
1,288
Your problem description implies the permissions of the mount point within your Ubuntu VM changes so as to deny "writes" when the NFS share is mounted. What are the mount point's observed permissions before and after mounting the share in the VM?

Also, are you using NFSv3 or NFSv4 in FreeNAS? If the later, did you check "NFSv3 ownership model for NFSv4"? Are the "movie" and "TV" folders each in their own datasets, or folders within a dataset on FreeNAS.
 

ionutm80

Dabbler
Joined
Mar 18, 2018
Messages
25
No, the permission of the mount does not change. The user created when I installed Ubuntu VM, let's say "ionut", is able to read-write before and after I mount the share. It's only Docker Radarr which is not able to write to the folder after the NFS share is mounted. But I do not understand why since the docker environment is created inside the home user forder: /home/ionut/.docker.
The user permissions on the folder content are:
drwxr-xr-x 2 ionut ionut 4096 Jul 8 11:47 'xyz'
drwxr-xr-x 2 ionut ionut 4096 Jul 8 12:05 'xyy'
 

ionutm80

Dabbler
Joined
Mar 18, 2018
Messages
25
In fact I believe my question would be how to give write permission to the radarr docker container for the mounted share?
 

KrisBee

Wizard
Joined
Mar 20, 2017
Messages
1,288
Are you using an image for radarr where you can set the user mappings as per linuxserver/radarr for example?
 

KrisBee

Wizard
Joined
Mar 20, 2017
Messages
1,288
OK, you didn't answer my questions about your NFS config. Assuming you're using bind mounts for your radarr container you may want 775/664 dir/file perms on the host VM rather than 755/644. If you've not done so already. I would set the "Maproot User" and "Maproot Group" to "root" and "wheel" in your NFS share defintion and restart both the NFS server in FreeNAS and the radarr container. Exec into the radarr console and see if radarr gets a perms denied or not.

Other than that I'll bow out as I'm not using containers actively.
 

ionutm80

Dabbler
Joined
Mar 18, 2018
Messages
25
Hi, sorry it was late last night.

Please see below the NFS mounts on the host Ubuntu VM with /etc/fstab:

192.168.1.81:/mnt/Homeserver/Media/Temporary_Movies /home/ionut/media/movies nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0
Where 192.168.1.81 is the FreeNAS host.

And the folder permissions on the Ubuntu VM:

ionut@ubuntu-vm:/mnt/medialibrary$ ls -la
total 182
drwxr-xr-x+ 8 root root 4096 Jul 7 16:09 .
drwxr-xr-x 4 root root 4096 Jul 7 16:09 ..
drwxr-xr-x+ 2 root root 4096 Jul 7 16:09 audiobooks
drwxr-xr-x+ 2 root root 4096 Jul 7 16:09 books
drwxr-xr-x+ 2 root root 4096 Jul 7 16:09 comics
drwxrwxr-x 164 ionut ionut 164 Jul 8 10:41 movies
drwxrwxr-x 9 ionut ionut 9 Jul 7 17:17 music
drwxrwxr-x 17 ionut ionut 17 Jul 7 16:57 tv

I will try to enter the Radarr Docker and show the permissions for the folders above from there.

Thanks for your input!
 

ionutm80

Dabbler
Joined
Mar 18, 2018
Messages
25
And part of the log from Radarr:

[v3.0.0.3129] NzbDrone.Mono.Disk.LinuxPermissionsException: Error setting permissions: EPERM
at NzbDrone.Mono.Disk.DiskProvider.SetPermissions(String path, String mask) in d:\a\1\s\src\NzbDrone.Mono\Disk\DiskProvider.cs:line 90
at NzbDrone.Core.MediaFiles.MediaFileAttributeService.SetMonoPermissions(String path, String permissions) in d:\a\1\s\src\NzbDrone.Core\MediaFiles\MediaFileAttributeService.cs:line 87

2020-7-8 23:47:37.0|Warn|ImportApprovedMovie|Couldn't import movie /downloads/completed/Moovie/movie.mkv

[v3.0.0.3129] System.UnauthorizedAccessException: Access to the path '/movies/Movie/movie.mkv.partial~' is denied.
---> System.IO.IOException: Operation not permitted
--- End of inner exception stack trace ---
at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.FileSystem.CopyFile(String sourceFullPath, String destFullPath, Boolean overwrite)
at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
at NzbDrone.Mono.Disk.DiskProvider.TransferFilePatched(String source, String destination, Boolean overwrite, Boolean move) in d:\a\1\s\src\NzbDrone.Mono\Disk\DiskProvider.cs:line 301
at NzbDrone.Mono.Disk.DiskProvider.CopyFileInternal(String source, String destination, Boolean overwrite) in d:\a\1\s\src\NzbDrone.Mono\Disk\DiskProvider.cs:line 224
at NzbDrone.Common.Disk.DiskProviderBase.CopyFile(String source, String destination, Boolean overwrite) in d:\a\1\s\src\NzbDrone.Common\Disk\DiskProviderBase.cs:line 213
at NzbDrone.Common.Disk.DiskTransferService.TryCopyFileTransactional(String sourcePath, String targetPath, Int64 originalSize) in d:\a\1\s\src\NzbDrone.Common\Disk\DiskTransferService.cs:line 482
at NzbDrone.Common.Disk.DiskTransferService.TransferFile(String sourcePath, String targetPath, TransferMode mode, Boolean overwrite, DiskTransferVerificationMode verificationMode) in d:\a\1\s\src\NzbDrone.Common\Disk\DiskTransferService.cs:line 342
at NzbDrone.Common.Disk.DiskTransferService.TransferFile(String sourcePath, String targetPath, TransferMode mode, Boolean overwrite, Boolean verified) in d:\a\1\s\src\NzbDrone.Common\Disk\DiskTransferService.cs:line 232
at NzbDrone.Core.MediaFiles.MovieFileMovingService.TransferFile(MovieFile movieFile, Movie movie, String destinationFilePath, TransferMode mode) in d:\a\1\s\src\NzbDrone.Core\MediaFiles\MovieFileMovingService.cs:line 115
at NzbDrone.Core.MediaFiles.MovieFileMovingService.CopyMovieFile(MovieFile movieFile, LocalMovie localMovie) in d:\a\1\s\src\NzbDrone.Core\MediaFiles\MovieFileMovingService.cs:line 92
at NzbDrone.Core.MediaFiles.UpgradeMediaFileService.UpgradeMovieFile(MovieFile movieFile, LocalMovie localMovie, Boolean copyOnly) in d:\a\1\s\src\NzbDrone.Core\MediaFiles\UpgradeMediaFileService.cs:line 73
at NzbDrone.Core.MediaFiles.MovieImport.ImportApprovedMovie.Import(List`1 decisions, Boolean newDownload, DownloadClientItem downloadClientItem, ImportMode importMode) in d:\a\1\s\src\NzbDrone.Core\MediaFiles\MovieImport\ImportApprovedMovie.cs:line 123

2020-7-8 23:48:59.8|Warn|ImportApprovedMovie|Couldn't import movie /downloads/completed/Movie/movie.mkv

[v3.0.0.3129] System.ArgumentNullException: Value cannot be null. (Parameter 'path2')
at System.IO.Path.Combine(String path1, String path2)
at NzbDrone.Core.MediaFiles.UpgradeMediaFileService.UpgradeMovieFile(MovieFile movieFile, LocalMovie localMovie, Boolean copyOnly) in d:\a\1\s\src\NzbDrone.Core\MediaFiles\UpgradeMediaFileService.cs:line 55
at NzbDrone.Core.MediaFiles.MovieImport.ImportApprovedMovie.Import(List`1 decisions, Boolean newDownload, DownloadClientItem downloadClientItem, ImportMode importMode) in d:\a\1\s\src\NzbDrone.Core\MediaFiles\MovieImport\ImportApprovedMovie.cs:line 123

2020-7-8 23:50:30.0|Warn|ImportApprovedMovie|Couldn't import movie /downloads/completed/Movie/movie.mkv

[v3.0.0.3129] System.ArgumentNullException: Value cannot be null. (Parameter 'path2')
at System.IO.Path.Combine(String path1, String path2)
at NzbDrone.Core.MediaFiles.UpgradeMediaFileService.UpgradeMovieFile(MovieFile movieFile, LocalMovie localMovie, Boolean copyOnly) in d:\a\1\s\src\NzbDrone.Core\MediaFiles\UpgradeMediaFileService.cs:line 55
at NzbDrone.Core.MediaFiles.MovieImport.ImportApprovedMovie.Import(List`1 decisions, Boolean newDownload, DownloadClientItem downloadClientItem, ImportMode importMode) in d:\a\1\s\src\NzbDrone.Core\MediaFiles\MovieImport\ImportApprovedMovie.cs:line 123

2020-7-8 23:50:59.7|Info|RssSyncService|Starting RSS Sync
2020-7-8 23:51:09.8|Info|DownloadDecisionMaker|Processing 500 releases
2020-7-8 23:51:17.1|Info|RssSyncService|RSS Sync Completed. Reports found: 500, Reports grabbed: 0
2020-7-8 23:52:00.1|Warn|ImportApprovedMovie|Couldn't import movie /downloads/completed/Moon.2009.2160p.UHD.Remux.HEVC.HDR.Atmos.TrueHD.7.1-playBD/Moon.2009.2160p.UHD.Remux.HEVC.HDR.Atmos.TrueHD.7.1-playBD.mkv

[v3.0.0.3129] System.ArgumentNullException: Value cannot be null. (Parameter 'path2')
at System.IO.Path.Combine(String path1, String path2)
at NzbDrone.Core.MediaFiles.UpgradeMediaFileService.UpgradeMovieFile(MovieFile movieFile, LocalMovie localMovie, Boolean copyOnly) in d:\a\1\s\src\NzbDrone.Core\MediaFiles\UpgradeMediaFileService.cs:line 55
at NzbDrone.Core.MediaFiles.MovieImport.ImportApprovedMovie.Import(List`1 decisions, Boolean newDownload, DownloadClientItem downloadClientItem, ImportMode importMode) in d:\a\1\s\src\NzbDrone.Core\MediaFiles\MovieImport\ImportApprovedMovie.cs:line 123
 

ionutm80

Dabbler
Joined
Mar 18, 2018
Messages
25
folder permissions from inside the Radarr Docker:

drwxrwxr-x 163 abc abc 163 Jul 8 23:47 movies

and the gid and uid for the docker user:

root@DockSTARTer:/# id abc
uid=1000(abc) gid=1000(abc) groups=1000(abc),100(users)
 

ionutm80

Dabbler
Joined
Mar 18, 2018
Messages
25
I would set the "Maproot User" and "Maproot Group" to "root" and "wheel" in your NFS share defintion and restart both the NFS server in FreeNAS and the radarr container. Exec into the radarr console and see if radarr gets a perms denied or not.

Hi again, I already had the NFS set like that with maproot user as root and maproot group as wheel.
 

ionutm80

Dabbler
Joined
Mar 18, 2018
Messages
25
Ok, I have managed to solve the issue, it was a permission issue on FreeNAS side, the dataset I was mounting was owned by multiple jails. I created a new dataset specifically for Ubuntu VM and voila, everything works like magic.
 
Top