From 00f7b604fe3d14212de4270d500f072dd2ffd416 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 22 May 2026 15:02:51 +0000 Subject: [PATCH] Fix local drive mounts showing empty for apps running as PUID/PGID Move chown/chmod to after mount so mount point is accessible by the configured PUID/PGID user. Previously chown ran before mount, making it useless since the mount replaces directory permissions with the filesystem's root inode permissions. For POSIX filesystems (btrfs, ext4) that don't support uid/gid mount options, this ensures the mount point is traversable by non-root users. Fixes #1868 Agent-Logs-Url: https://github.com/alexbelgium/hassio-addons/sessions/338cfbaa-45f3-4ff2-a2f7-b6e8fa3ee9b1 Co-authored-by: alexbelgium <44178713+alexbelgium@users.noreply.github.com> --- .templates/00-local_mounts.sh | 18 ++++++++++++------ jellyfin/CHANGELOG.md | 1 + 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.templates/00-local_mounts.sh b/.templates/00-local_mounts.sh index 12abfc2947..37758fb088 100755 --- a/.templates/00-local_mounts.sh +++ b/.templates/00-local_mounts.sh @@ -60,11 +60,6 @@ if bashio::config.has_value 'localdisks'; then # Creates dir mkdir -p /mnt/"$disk" - if bashio::config.has_value 'PUID' && bashio::config.has_value 'PGID'; then - PUID="$(bashio::config 'PUID')" - PGID="$(bashio::config 'PGID')" - chown "$PUID:$PGID" /mnt/"$disk" - fi # Check FS type and set relative options (thanks @https://github.com/dianlight/hassio-addons) fstype=$(lsblk "$devpath"/"$disk" -no fstype) @@ -101,12 +96,23 @@ if bashio::config.has_value 'localdisks'; then if [ -d /share/"$disk" ]; then dirpath="/share"; fi # shellcheck disable=SC2015 - mount -t $type "$devpath"/"$disk" "$dirpath"/"$disk" -o $options && bashio::log.info "Success! $disk mounted to /mnt/$disk" \ + mount -t $type "$devpath"/"$disk" "$dirpath"/"$disk" -o $options && bashio::log.info "Success! $disk mounted to $dirpath/$disk" \ || ( bashio::log.fatal "Unable to mount local drives! Please check the name." rmdir /mnt/"$disk" bashio::addon.stop ) + + # Set ownership and permissions on the mount point AFTER mounting + # so that apps running as PUID/PGID can access the content + 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" + fi done fi diff --git a/jellyfin/CHANGELOG.md b/jellyfin/CHANGELOG.md index 4046938d63..c992266d06 100644 --- a/jellyfin/CHANGELOG.md +++ b/jellyfin/CHANGELOG.md @@ -1,6 +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 ## 10.11.8 (2026-04-06) - Update to latest version from linuxserver/docker-jellyfin (changelog : https://github.com/linuxserver/docker-jellyfin/releases)