truenas / charts

TrueNAS SCALE Apps Catalogs & Charts
BSD 3-Clause "New" or "Revised" License
306 stars 293 forks source link

Jellyfin: Permission denied for some files in /cache/temp/ #2683

Closed Lyphion closed 3 months ago

Lyphion commented 3 months ago

Heyho,

some time ago I migrated my Jellyfin Container from TrueCharts to TrueNAS. Since then I have some permission problems with files in the cache directory.

App Version: 10.9.8
Chart Version: 1.3.2
TrueNAS Version: Dragonfish-24.04.2

After creating a fresh container with default settings (except additional storage for the media), I tried to import my libraries containing Movies, Series and Photos. Everything except the photos worked perfectly. but when scaning the photos library many errors occur similar to this:

[2024-07-24 22:51:01.637 +02:00] [ERR] [35] MediaBrowser.Providers.Photos.PhotoAlbumMetadataService: Error in "Dynamic Image Provider"
System.UnauthorizedAccessException: Access to the path '/cache/temp/f271e408de9d4a7f9d96fab236d42d41.jpg' 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 fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, UnixFileMode openPermissions, Int64& fileLength, UnixFileMode& filePermissions, Boolean failForSymlink, Boolean& wasSymlink, Func`4 createOpenException)
   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
   at MediaBrowser.Model.IO.AsyncFile.OpenRead(String path)
   at MediaBrowser.Providers.Manager.ProviderManager.SaveImage(BaseItem item, String source, String mimeType, ImageType type, Nullable`1 imageIndex, Nullable`1 saveLocallyWithMedia, CancellationToken cancellationToken)
   at Emby.Server.Implementations.Images.BaseDynamicImageProvider`1.FetchToFileInternal(BaseItem item, IReadOnlyList`1 itemsWithImages, ImageType imageType, CancellationToken cancellationToken)
   at Emby.Server.Implementations.Images.BaseDynamicImageProvider`1.FetchAsync(T item, MetadataRefreshOptions options, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.MetadataService`2.RunCustomProvider(ICustomMetadataProvider`1 provider, TItemType item, String logName, MetadataRefreshOptions options, RefreshResult refreshResult, CancellationToken cancellationToken)

I checked all the permissions (media folder and volume paths) and Jellyfin (user/group: apps) has access to the files and folders and the photos are visible, accessible and viewable through the WebGUI, but are missing the Folder/Library image collage. The strange thing is, for a few folders inside the photos library the collage image is present, but for the most the prior error is printed and the image is missing. When viewing the permissions on the files inside the cache folder, I saw that some files didn't specify any permission. The content of these files is not empty and seem valid.

I tried setting it up multiple times and every time the same folders succeed and the rest fail. Restarting the container or the machine didn't help.

Permission for cache folder and inner temp:

drwxr-xr-x 8 apps apps 8 Jul 24 21:40 cache
drwxr-xr-x 8 apps apps 8 Jul 24 21:40 cache/temp

Part of the files inside cache/temp with missing permissions:

...
---------- 1 apps apps 194K Dec 26  2004 efd8b941c6934103a8d0707c33b3b565.JPG
---------- 1 apps apps 376K Jul 17  2010 f064fb628a854afda28104167923408b.jpg
---------- 1 apps apps 4.2M Jun 10  2012 f0cd3e4814084be6aeaeb9dbbe2d9f6b.JPG
-rw-r--r-- 1 apps apps  21K Jul 24 21:38 f1be34b4-0537-4335-82aa-87ab13812035.jpg
-rw-r--r-- 1 apps apps  19K Jul 24 21:38 f214737b-6e5b-426c-963e-fa9c91f2399f.jpg
---------- 1 apps apps 5.9M Jul  1  2019 f271e408de9d4a7f9d96fab236d42d41.jpg
-rw-r--r-- 1 apps apps  82K Jul 24 21:21 f2ada9a8-3aa5-41a7-8c9c-901109006320.jpg
...

The files with '-' in the name seem to be Thumbnails of Episodes of Series.

I don't know if this is a Jellyfin or an TrueNAS problem and I couldn't find any similar reports. The only thing I know is prior to the migration everything worked, but I didn't and now can't check the old log files.

If I missed some useful or important information, let me know! Thanks in advance

sync-by-unito[bot] commented 3 months ago

➤ Stavros Kois commented:

Considering that you already have files in there, and permissions looks fine to me, I’d say something is wrong on Jellyfin side. But, can you confirm that cache/temp output you shared is the one at root? eg /cache/temp or is it under /config? (You can use pwd to see the current directory).

I also found this https://github.com/jellyfin/jellyfin/pull/12226 ( https://github.com/jellyfin/jellyfin/pull/12226|smart-link ) , which might be related. And only got merged last week, so probably will land on the next release.

Lyphion commented 3 months ago

Thanks for the response. The cache is at the root level and not in "/config". I forgot to mention, that I also tried different settings for the cache directory path which also didn't helped. I think I wait until the next release maybe your linked Pull Request helps.

stavros-k commented 3 months ago

I'll close this one for now, if you still have issues once the new version is release or find additional information, feel free to share.

Thanks