Ubuntu: Folder is not writable with user

Sonarr version (exact version):
3.0.7.1477
Mono version (if Sonarr is not running on Windows):
6.8.0.105
OS:
Ubuntu 21.10
Debug logs:

[v3.0.7.1477] System.UnauthorizedAccessException: Root folder path ‘/home/(removed)/wdelements-mount/Video/TV/’ is not writable by user ‘vortilion’
at NzbDrone.Core.RootFolders.RootFolderService.Add (NzbDrone.Core.RootFolders.RootFolder rootFolder) [0x000e9] in M:\BuildAgent\work\63739567f01dbcc2\src\NzbDrone.Core\RootFolders\RootFolderService.cs:117
at Sonarr.Api.V3.RootFolders.RootFolderModule.CreateRootFolder (Sonarr.Api.V3.RootFolders.RootFolderResource rootFolderResource) [0x00007] in M:\BuildAgent\work\63739567f01dbcc2\src\Sonarr.Api.V3\RootFolders\RootFolderModule.cs:56
at Sonarr.Http.REST.RestModule1[TResource].<set_CreateResource>b__42_0 (System.Object options) [0x00000] in M:\BuildAgent\work\63739567f01dbcc2\src\Sonarr.Http\REST\RestModule.cs:168 at Nancy.NancyModule+<>c__DisplayClass38_01[T].b__0 (System.Object args) [0x00047] in :0
at Nancy.NancyModule+<>c__DisplayClass40_01[T].<Post>b__0 (System.Object args, System.Threading.CancellationToken ct) [0x00047] in <e31b230dbd29407fadcc55713e0bbd0f>:0 at Nancy.Routing.Route1[T].Invoke (Nancy.DynamicDictionary parameters, System.Threading.CancellationToken cancellationToken) [0x00017] in :0
at Nancy.Routing.DefaultRouteInvoker.Invoke (Nancy.Routing.Route route, System.Threading.CancellationToken cancellationToken, Nancy.DynamicDictionary parameters, Nancy.NancyContext context) [0x00086] in :0
at Nancy.Routing.DefaultRequestDispatcher.Dispatch (Nancy.NancyContext context, System.Threading.CancellationToken cancellationToken) [0x002b7] in :0
at Nancy.NancyEngine.InvokeRequestLifeCycle (Nancy.NancyContext context, System.Threading.CancellationToken cancellationToken, Nancy.Bootstrapper.IPipelines pipelines) [0x0011d] in :0

Description of issue:
I am running sonarr inside an Ubuntu 21.10-VM on my QNAP NAS. i was able to get it to run if I mount a NAS-folder inside the vm (for testing purposes) but what I really want to achieve is adding a USB-drivbe as sonar-root-path. I can mount it as well, but if I try to select it as root path in sonarr it tells me that sonarr cant write to that directory with the user (which is the same user as the one with whom I am logged in ubuntu.

I tried mounting it via

sudo mount -t cifs -o credentials=/home/vortilion/credentials.txt,uid=1000,gid=1000 //nas059585.local/WDElements/TV /home/vortilion/wdelements-mount/tv

and I tried mounting in /etc/fstab via
//nas059585.local/WDElements/TV /home/vortilion/wdelements-mount/tv cifs credentials=/home/vortilion/credentials.txt,uid=1000,gid=1000,sec=ntlmv2,iocharset=utf8,noperm 0 0

To me the error doesn’t make sense. I am using the same user for sonarr as for ubuntu, I can write to the folder via File Explorer and create folders, files etc. which works perfectly, all those changes I do manually with the same user are immediately visible in the host system. So why does Sonarr tell me the same user CAN’T write to that folder? Whats even stranger: Sonarr DOES create a text file with the name “sonar_write_test”.

Since the file was created it sounds like Sonarr can write to that folder, but after writing the file it was unable to delete it.

If you post the full debug logs as covered in the wiki there should be additional information logged to indicate exactly what failed. Could be that when Sonarr attempted to delete the file it wasn’t visible to Sonarr (delays listing files through CIFS) or the delete itself failed.

hi Markus, thanks for responding. sorry I forgot the Debug-log, here it is:

Seems like a very clear error here

2022-03-26 18:02:17.5|Fatal|SonarrErrorPipeline|Request Failed. POST /api/v3/rootFolder
 
[v3.0.7.1477] System.UnauthorizedAccessException: Root folder path '/home/(removed)/wdelements-mount/Video/TV/' is not writable by user 'vortilion'

Sonarr is running under vortilion which does not have write access to /home/vortilion/wdelements-mount/Video/TV/

As I already stated DOES the user have write access to this folder…

Looking closer at the code we don’t separate the write test enough to differentiate where the issue might lie, but you can trouble shoot a bit more and create a subfolder in your home folder (with at least one folder inside), that’s just a local folder, not mounted from SMB, then try adding that as the root folder, this should narrow down the issue to be related to either the mounting of the SMB share or the share itself.

I suspect in this case the SMB share is slow to react to the file being created and errors out when the file is immediately deleted.

It seems I found the solution, even though I don’t quite understand why it was a problem: the external HDD was previously connected to my windows-pc and it’s content was shared to specific windows users (so I could read from it from my iPad via smb). I reconnected the hdd to my pc, removed the share and reconnected it to the NAS. It worked! But I never though the windows share would afflict the access via linux….

1 Like

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