Compare commits

...

3 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
e95820921d 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>
2026-05-22 15:12:34 +00:00
copilot-swe-agent[bot]
00f7b604fe 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>
2026-05-22 15:02:51 +00:00
copilot-swe-agent[bot]
fe4120bbdf Initial plan 2026-05-22 14:59:31 +00:00
2 changed files with 14 additions and 6 deletions

View File

@@ -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,24 @@ 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
)
# 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')"
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 <mountpoint> (on the host)."
fi
fi
done
fi

View File

@@ -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)
- 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)