fix(build): fix Debian 13 root ownership from host before customization

This commit is contained in:
CanbiZ (MickLesk)
2026-01-28 14:44:00 +01:00
parent 032dfacce2
commit b35437c391

View File

@@ -3878,6 +3878,17 @@ EOF
fix_gpu_gids
# Fix Debian 13 LXC template bug where / is owned by nobody:nogroup
# This must be done from the host as unprivileged containers cannot chown /
local rootfs
rootfs=$(pct config "$CTID" | grep -E '^rootfs:' | sed 's/rootfs: //' | cut -d',' -f1)
if [[ -n "$rootfs" ]]; then
local mount_point="/var/lib/lxc/${CTID}/rootfs"
if [[ -d "$mount_point" ]] && [[ "$(stat -c '%U' "$mount_point")" != "root" ]]; then
chown root:root "$mount_point" 2>/dev/null || true
fi
fi
# Continue with standard container setup
msg_info "Customizing LXC Container"