nicknsy / jellyscrub

Smooth mouse-over video scrubbing previews for Jellyfin.
MIT License
668 stars 27 forks source link

System.IO.IOException: Permission denied error with 10.9.0/jellyfin master #65

Closed satmandu closed 1 year ago

satmandu commented 1 year ago
[2023-01-23 19:36:33.744 -05:00] [INF] [1] Nick.Plugin.Jellyscrub.JellyscrubPlugin: Attempting to inject trickplay script code in "/jellyfin/jellyfin-web/index.html"
[2023-01-23 19:36:33.749 -05:00] [ERR] [1] Nick.Plugin.Jellyscrub.JellyscrubPlugin: Encountered exception while writing to "/jellyfin/jellyfin-web/index.html": "System.UnauthorizedAccessException: Access to the path '/jellyfin/jellyfin-web/index.html' is denied.
 ---> System.IO.IOException: Permission denied
   --- End of inner exception stack trace ---
   at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirError)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode, Func`4 createOpenException)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, UnixFileMode openPermissions, Int64& fileLength, UnixFileMode& filePermissions, Func`4 createOpenException)
   at System.IO.File.OpenHandle(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
   at Nick.Plugin.Jellyscrub.JellyscrubPlugin..ctor(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer, ILogger`1 logger, IServerConfigurationManager configurationManager)"
[2023-01-23 19:36:33.750 -05:00] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: "Jellyscrub" "1.0.0.7"
nicknsy commented 1 year ago

Do the notes from the installation apply to this?

NOTE: The client script will fail to inject automatically into the jellyfin-web server if there is a difference in permission between the owner of the web files (root, or www-data, etc.) and the executor of the main jellyfin-server. This often happens because...

Docker - the container is being run as a non-root user while having been built as a root user, causing the web files to be owned by root. To solve this, you can remove any lines like User: 1000:1000, GUID:, PID:, etc. from the jellyfin docker compose file. Install from distro repositories - the jellyfin-server will execute as jellyfin user while the web files will be owned by root, www-data, etc. This can likely be fixed by adding the jellyfin (or whichecher user your main jellyfin server runs at) to the same group the jellyfin-web folders are owned by. You should only do this if they are owned by a group other than root, and will have to lookup how to manage permissions on your specific distro. Alternatively, the script can manually be added to the index.html as described below.

e.g. are you running in docker with USER, GUID, PID, etc options set to something other than default/root.

satmandu commented 1 year ago

Ah, yes, I am running with --user, PUID, and PGID options... I'll read the documentation more carefully...