Jump to content

Unable to delete from Emby despite Emby user itself being able to


Go to solution Solved by Q-Droid,

Recommended Posts

Posted (edited)

Hello everyone,

Having an annoying issue thats got me a little confused.

First off, some generic setup context

emby-server is running as user emby

**ps aux  | grep -i emby
emby      519781  0.7  2.9 4690196 481408 ?      Ssl  Aug14  39:00 dotnet /usr/lib/emby-server/EmbyServer.dll -programdata /var/lib/emby -ffdetect /usr/bin/ffdetect-emby -ffmpeg /usr/bin/ffmpeg-emby -ff                                                                                    

emby is part of the 'media' group in /etc/group

media:x:1002:sonarr,radarr,sabnzbd,emby

Media is located in a location owned by sonarr:media with 775 permissions, which is also true of the subdirectories, and files.

***Root Dir
drwxrwxr-x 161 sonarr media      12288 Aug 18 06:42  TV

***Subdirectories
drwxrwxr-x   2 sonarr media  4096 May 15 18:13  Sample

**Contents
-rwxrwxr-x   1 sonarr media 2484416292 May 14 09:39 Sample.-.01x02.mkv
-rwxrwxr-x   1 sonarr media 2252451272 May 14 09:43 Sample.-.01x03.mkv
-rwxrwxr-x   1 sonarr media 2586233578 May 14 09:50 Sample.-.01x04.mkv
-rwxrwxr-x   1 sonarr media 2384926634 May 14 09:48 Sample.-.01x05.mkv
-rwxrwxr-x   1 sonarr media 2566451792 May 14 09:41 Sample.-.01x06.mkv
-rwxrwxr-x   1 sonarr media 2399426391 May 14 09:56 Sample.-.01x07.mkv
-rwxrwxr-x   1 sonarr media 2499553373 May 14 09:54 Sample.-.01x08.mkv

if i run sudo -H -u emby bash -c 'rm /mnt/hd1/TV/Sample/Sample.-.01x02.mkv' to use the emby user to delete the file, it works fine

likewise if i run sudo -H -u emby bash -c 'rm -r /mnt/hd1/TV/Sample' it properly deletes the whole directory

When I try to delete the series from emby, I get a permissions error and this on the back end

2021-08-18 06:44:09.197 Error Server: Error processing request
    *** Error Report ***
    Version: 4.6.4.0
    Command line: /usr/lib/emby-server/EmbyServer.dll -programdata /var/lib/emby -ffdetect /usr/bin/ffdetect-emby -ffmpeg /usr/bin/ffmpeg-emby -ffprobe /usr/bin/ffprobe-emby -restartexitcode 3
    Operating system: Linux version 5.10.56-1-MANJARO (builduser@development) (gcc (GCC) 11.1.0, GNU ld (GNU Binutils) 2.36.1) #1 SMP PREEMPT Thu Aug 5 10:51:27 UTC 2021
    Framework: .NET Core 3.1.17
    OS/Process: x64/x64
    Runtime: usr/share/dotnet/shared/Microsoft.NETCore.App/3.1.17/System.Private.CoreLib.dll
    Processor count: 4
    Data path: /var/lib/emby
    Application path: /usr/lib/emby-server
    System.IO.IOException: System.IO.IOException: Access to the path '/mnt/hd1/TV/Sample' is denied.
       at System.IO.FileSystem.RemoveDirectoryInternal(DirectoryInfo directory, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound)
       at System.IO.FileSystem.RemoveDirectory(String fullPath, Boolean recursive)
       at Emby.Server.Implementations.Library.LibraryManager.DeleteItem(BaseItem item, DeleteOptions options, BaseItem parent, Boolean notifyParentItem)
       at MediaBrowser.Api.Library.LibraryService.Delete(DeleteItems request)
       at MediaBrowser.Api.Library.LibraryService.Delete(DeleteItem request)
       at Emby.Server.Implementations.Services.ServiceController.<>c__DisplayClass6_0.<VoidActionDelegate>b__0(Object service, Object request)
       at Emby.Server.Implementations.Services.ServiceController.Execute(HttpListenerHost appHost, Object requestDto, IRequest req)
       at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost appHost, IRequest httpReq, IResponse httpRes, RestPath restPath, String responseContentType, CancellationToken cancellationToken)
       at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IRequest httpReq, ReadOnlyMemory`1 urlString, ReadOnlyMemory`1 localPath, CancellationToken cancellationToken)
    Source: System.IO.FileSystem
    TargetSite: Void RemoveDirectoryInternal(System.IO.DirectoryInfo, Boolean, Boolean)
    

 

I like to think im not a total permissions noob, but its certainly possible I missed something here

Edited by j55555
Posted

Hi, yes it looks like the server is being denied access to delete the folder. Please review this and see if it helps:

Thanks.

Posted

Thanks for the quick response Luke,

I double checked this this morning before posting this, I didn't want to be the 10,000th person to at least run in to super basic permissions issues haha

 

 it all certainly seems to be good, and in my original post you can see that everything appears to be in order

  • Solution
Posted

If you are running Manjaro and I believe (not certain) that there are similarities with Arch then the restrictions are from systemd, limiting the permissions for the service process.

This might help: https://wiki.archlinux.org/title/Emby

 

Posted

oh damn this looks like exactly what it might be

thanks Q-Droid i'll look in to it and confirm if it works :)

Posted

OK that actually did it!

I think the only thing that's a little confusing out of the wiki is that emby-server.service doesn't exist in /etc/systemd/system, so i had to copy it from  /usr/lib/systemd/system/emby-server.service to /etc/systemd/system and run daemon-enable

 

Thanks so much for the assist.

 

  • Like 1
Posted

Thanks for the feedback !

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...