Jellyfin Forum
[SOLVED] Cannot Read Mounted SMB path on RHEL9 - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: General Questions (https://forum.jellyfin.org/f-general-questions)
+--- Thread: [SOLVED] Cannot Read Mounted SMB path on RHEL9 (/t-solved-cannot-read-mounted-smb-path-on-rhel9)



[SOLVED] Cannot Read Mounted SMB path on RHEL9 - ayrus02 - 2023-10-21

Hi, I have problem, my Jellyfin setup is on old PC running AlmaLinux 9, the setup was run perfectly. But recently I've tried to add new library to read some mounted SMB Shares on other machine.

Bellow are the error log from Jellyfin when I've tried to browse the path to mounted SMB shares:

Code:
[2023-10-21 22:06:23.519 +07:00] [ERR] [3] Jellyfin.Server.Middleware.ExceptionMiddleware: Error processing request. URL "GET" "/Environment/DirectoryContents".
System.UnauthorizedAccessException: Access to the path '/mnt/60-raspiberry-pi-1tb-usb-drive/01-Movies' is denied.
---> System.IO.IOException: Permission denied
  --- End of inner exception stack trace ---
  at System.IO.FileSystemInfo.Create(String fullPath, String fileName, FileStatus& fileStatus)
  at System.IO.Enumeration.FileSystemEnumerator`1.MoveNext()
  at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
  at System.Linq.Enumerable.WhereEnumerableIterator`1.ToArray()
  at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
  at System.Linq.OrderedEnumerable`1.GetEnumerator()+MoveNext()
  at System.Linq.Enumerable.SelectIPartitionIterator`2.MoveNext()
  at System.Text.Json.Serialization.Converters.IEnumerableDefaultConverter`2.OnWriteResume(Utf8JsonWriter writer, TCollection value, JsonSerializerOptions options, WriteStack& state)
  at System.Text.Json.Serialization.JsonCollectionConverter`2.OnTryWrite(Utf8JsonWriter writer, TCollection value, JsonSerializerOptions options, WriteStack& state)
  at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
  at System.Text.Json.Serialization.JsonConverter`1.WriteCore(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
  at System.Text.Json.Serialization.JsonConverter`1.WriteCoreAsObject(Utf8JsonWriter writer, Object value, JsonSerializerOptions options, WriteStack& state)
  at System.Text.Json.JsonSerializer.WriteCore[TValue](JsonConverter jsonConverter, Utf8JsonWriter writer, TValue& value, JsonSerializerOptions options, WriteStack& state)
  at System.Text.Json.JsonSerializer.WriteStreamAsync[TValue](Stream utf8Json, TValue value, JsonTypeInfo jsonTypeInfo, CancellationToken cancellationToken)
  at System.Text.Json.JsonSerializer.WriteStreamAsync[TValue](Stream utf8Json, TValue value, JsonTypeInfo jsonTypeInfo, CancellationToken cancellationToken)
  at System.Text.Json.JsonSerializer.WriteStreamAsync[TValue](Stream utf8Json, TValue value, JsonTypeInfo jsonTypeInfo, CancellationToken cancellationToken)
  at Microsoft.AspNetCore.Mvc.Formatters.SystemTextJsonOutputFormatter.WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|30_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
--- End of stack trace from previous location ---
  at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
  at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
  at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
  at Jellyfin.Server.Middleware.ServerStartupMessageMiddleware.Invoke(HttpContext httpContext, IServerApplicationHost serverApplicationHost, ILocalizationManager localizationManager)
  at Jellyfin.Server.Middleware.WebSocketHandlerMiddleware.Invoke(HttpContext httpContext, IWebSocketManager webSocketManager)
  at Jellyfin.Server.Middleware.IpBasedAccessValidationMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager)
  at Jellyfin.Server.Middleware.LanFilteringMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager)
  at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
  at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
  at Jellyfin.Server.Middleware.QueryStringDecodingMiddleware.Invoke(HttpContext httpContext)
  at Swashbuckle.AspNetCore.ReDoc.ReDocMiddleware.Invoke(HttpContext httpContext)
  at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
  at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
  at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
  at Jellyfin.Server.Middleware.RobotsRedirectionMiddleware.Invoke(HttpContext httpContext)
  at Jellyfin.Server.Middleware.LegacyEmbyRouteRewriteMiddleware.Invoke(HttpContext httpContext)
  at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context)
  at Jellyfin.Server.Middleware.ResponseTimeMiddleware.Invoke(HttpContext context, IServerConfigurationManager serverConfigurationManager)
  at Jellyfin.Server.Middleware.ExceptionMiddleware.Invoke(HttpContext context)

FYI: I've run the mounting of SMB Shares using root user. Is there anyway I can enter some console using user of Jellyfin to verify that Jellyfin can access (read) the path and it's content?

Regards,
ayrus02


RE: Cannot Read Mounted SMB path on RHEL9 - Deleted User - 2023-10-21

(2023-10-21, 03:23 PM)ayrus02 Wrote: Is there anyway I can enter some console using user of Jellyfin to verify that Jellyfin can access (read) the path and it's content?

if it's installed in docker

docker exec -it jellyfin /bin/bash
- (replace jellyfin with the name of your container)

if it's not in a docker
# su jellyfin
(replace jellyfin with the username for jellyfin)


RE: Cannot Read Mounted SMB path on RHEL9 - ayrus02 - 2023-10-21

(2023-10-21, 03:30 PM)000 Wrote:
(2023-10-21, 03:23 PM)ayrus02 Wrote: Is there anyway I can enter some console using user of Jellyfin to verify that Jellyfin can access (read) the path and it's content?

if it's installed in docker

docker exec -it jellyfin /bin/bash
- (replace jellyfin with the name of your container)

if it's not in a docker
# su jellyfin
(replace jellyfin with the username for jellyfin)

OK, thanks for the help, I've resolve this problem by adding these options on mount command of SMB Share

Code:
uid=961,gid=962

and Jellyfin flawlessly can read the SMB share folder.
uid 961 is for jellyfin user in my server and gid 962 is group for jellyfin on my server. You can see what UID and GID for your jellyfin user by running this command:

Code:
# id jellyfin
uid=961(jellyfin) gid=962(jellyfin) groups=962(jellyfin),39(video),998(render)

Thanks to all of you for the help provided...

Regards.
ayrus02