Jump to content

Emby can't save files in mediafolders - Permission denied


looking111
Go to solution Solved by Q-Droid,

Recommended Posts

looking111

Hello all, 

today I noticed that emby is no longer allowed to write files in the mediafolders. Here is the log:

2021-07-25 23:39:17.238 Info HttpClient: GET https://assets.fanart.tv/fanart/movies/621876/moviethumb/flora--ulysses-607bc5b5e0c74.jpg
2021-07-25 23:39:17.593 Error ProviderManager: UnauthorizedAccessException: Emby Server is being write access to /home/movies/Flora and Ulysses-landscape.jpg. Please check your file permissions.
2021-07-25 23:39:17.772 Info Server: http/2 Response 204 to 192.168.11.7. Time: 12951ms. https://stream.tux.lan:8920/emby/Items/RemoteSearch/Apply/112831?ReplaceAllImages=true&X-Emby-Client=Emby Web&X-Emby-Device-Name=Chrome&X-Emby-Device-Id=2d349e40-4a36-4f51-af27-7f9a37b64a93&X-Emby-Client-Version=4.6.4.0
2021-07-25 23:39:17.775 Error ProviderManager: Error in metadata saver
        *** Error Report ***
        Version: 4.6.4.0
        Command line: /opt/emby-server/system/EmbyServer.dll -programdata /var/lib/emby -ffdetect /opt/emby-server/bin/ffdetect -ffmpeg /opt/emby-server/bin/ffmpeg -ffprobe /opt/emby-server/bin/ffprobe -restartexitcode 3 -updatepackage emby-server-deb_{version}_amd64.deb
        Operating system: Linux version 5.11.22-1-pve (build@proxmox) (gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2) #1 SMP PVE 5.11.22-2 (Fri
        Framework: .NET Core 3.1.13
        OS/Process: x64/x64
        Runtime: opt/emby-server/system/System.Private.CoreLib.dll
        Processor count: 10
        Data path: /var/lib/emby
        Application path: /opt/emby-server/system
        System.UnauthorizedAccessException: System.UnauthorizedAccessException: Access to the path '/home/movies/Flora and Ulysses.nfo' is denied.
         ---> System.IO.IOException: Permission denied
           --- End of inner exception stack trace ---
           at System.IO.FileStream.WriteNative(ReadOnlySpan`1 source)
           at System.IO.FileStream.WriteSpan(ReadOnlySpan`1 source)
           at System.IO.FileStream.<>c.<WriteAsyncInternal>b__110_0(Task t, Object s)
           at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
        --- End of stack trace from previous location where exception was thrown ---
           at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
        --- End of stack trace from previous location where exception was thrown ---
           at NfoMetadata.Savers.BaseNfoSaver.SaveToFile(Stream stream, String path, LibraryOptions libraryOptions, CancellationToken cancellationToken)
           at NfoMetadata.Savers.BaseNfoSaver.Save(BaseItem item, LibraryOptions libraryOptions, CancellationToken cancellationToken)
           at MediaBrowser.Providers.Manager.ProviderManager.SaveMetadata(BaseItem item, LibraryOptions libraryOptions, ItemUpdateType updateType, IMetadataSaver[] savers, CancellationToken cancellationToken)
        Source: System.Private.CoreLib
        TargetSite: Void WriteNative(System.ReadOnlySpan`1[System.Byte])
        InnerException: System.IO.IOException: Permission denied

The strange thing is. Emby has write access. I tested it manually by giving "emby" a bash, changing the user and successfully creating files in the folders. And if i place a file in that folders, i also can delete this files with the emby webinterface. How does emby access the folders? What i have to do, that this is working again? 

The folders are mounted with the fstab from an sambaserver with "file_mode=0777,dir_mode=0777"

Best regards

looking111

Link to comment
Share on other sites

  • Solution
Q-Droid

These are samba shares? If so then try adding the nobrl mount option.

This thread has more info: 

 

 

  • Like 1
Link to comment
Share on other sites

looking111

Perfectly, it works now again! :) :) 

Quote

Deactivating the byte range lock. Some programmes cannot cope with the byte-range lock and therefore cannot write to mounted SMB shares despite correct permissions. The remedy here is the mount option nobrl.

Very Thanks @Q-Droid

Link to comment
Share on other sites

  • 2 months later...

Hi, I've got the same problem but adding "nobrl" to fstab doesn't fix it. All my SMB shares are mounted like this:

//192.168.45.4/Movies                   /media/Movies                   cifs    auto,rw,credentials=/root/.smb_movies,uid=998,gid=998,file_mode=0660,dir_mode=0770,nobrl  0 0


UID/GID 998 is my "emby" user/group. Emby is run as this emby user and if I run "ls -la" inside a folder that emby complains not having write access to it shows that all files are owned by "emby:emby" with 0660 rights.

Previously that was working fine and I didn't changed anything with that share. But I think I updated emby to 4.6.4.0 and upgraded my Debian Buster VM to Bullseye. Not sure when exactly this problem started because matiching media works fine so I just now noticed it because I wondered why no new nfos where created.

Any idea what else could cause this?

Edited by Dunuin
Link to comment
Share on other sites

I also verified that the emby user has write access to those shares:

runuser -u emby -- touch /media/Movies/test.txt

will create a file:

-rw-rw----  1 emby emby    0 Sep 27 17:42 test.txt

So no idea why emby is comlaining it can't write metadata.

 

Edit:

Ok, I think "nobrl" fixed it. Error isn't found in logs now. Thanks :)

Edited by Dunuin
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...