From e95820921dc2b2565762207c85b8f97e4cc558bb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 22 May 2026 15:12:34 +0000 Subject: [PATCH] Replace disk-modifying chown/chmod with non-destructive accessibility check Instead of modifying actual filesystem permissions on the mounted disk (which would be destructive), we now only check whether the mount point is likely inaccessible by the configured PUID and warn the user with instructions to fix it themselves on the host. Agent-Logs-Url: https://github.com/alexbelgium/hassio-addons/sessions/fc207e95-fe21-468e-ab90-0819676fbf87 Co-authored-by: alexbelgium <44178713+alexbelgium@users.noreply.github.com> --- .templates/00-local_mounts.sh | 15 ++++++++------- jellyfin/CHANGELOG.md | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.templates/00-local_mounts.sh b/.templates/00-local_mounts.sh index 37758fb088..47c800a682 100755 --- a/.templates/00-local_mounts.sh +++ b/.templates/00-local_mounts.sh @@ -103,15 +103,16 @@ if bashio::config.has_value 'localdisks'; then bashio::addon.stop ) - # Set ownership and permissions on the mount point AFTER mounting - # so that apps running as PUID/PGID can access the content + # Check if the mount is accessible by the configured PUID/PGID + # We do NOT chown/chmod the mount point as that would modify actual disk permissions if bashio::config.has_value 'PUID' && bashio::config.has_value 'PGID'; then PUID="$(bashio::config 'PUID')" - PGID="$(bashio::config 'PGID')" - chown "$PUID:$PGID" "$dirpath"/"$disk" 2>/dev/null \ - || bashio::log.warning "Could not chown $dirpath/$disk to $PUID:$PGID - content may not be accessible" - chmod 755 "$dirpath"/"$disk" 2>/dev/null \ - || bashio::log.warning "Could not chmod $dirpath/$disk - content may not be accessible" + mount_owner=$(stat -c '%u' "$dirpath/$disk" 2>/dev/null) + mount_perms=$(stat -c '%a' "$dirpath/$disk" 2>/dev/null) + if [ "$mount_owner" != "$PUID" ] && [ "${mount_perms:2:1}" = "0" ]; then + bashio::log.warning "$dirpath/$disk is owned by UID $mount_owner with permissions $mount_perms - may not be accessible by PUID $PUID." + bashio::log.warning "If the drive appears empty, fix permissions on the drive root: chmod 755 (on the host)." + fi fi done diff --git a/jellyfin/CHANGELOG.md b/jellyfin/CHANGELOG.md index c992266d06..f59ffb3663 100644 --- a/jellyfin/CHANGELOG.md +++ b/jellyfin/CHANGELOG.md @@ -1,7 +1,7 @@ ## 10.11.9 (2026-05-22) - Update to latest version from linuxserver/docker-jellyfin (changelog : https://github.com/linuxserver/docker-jellyfin/releases) -- Fix local drive mounts (btrfs/ext4) showing empty when app runs as PUID/PGID +- Add warning when local drive mount permissions may prevent access by PUID/PGID ## 10.11.8 (2026-04-06) - Update to latest version from linuxserver/docker-jellyfin (changelog : https://github.com/linuxserver/docker-jellyfin/releases)