From 5e4e37259edf0c2f67a574e3efeea6087176090f Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Fri, 3 Mar 2023 12:26:51 -0600 Subject: [PATCH] Fix overlay file ownerships By default, `tar` copies file ownership UID/GID. This works fine when the build is running in a rootless container, since the source UID/GID numbers are mapped to 0/0 inside the container. In other scenarios, though, such as building in a microvm with the source directory on a shared filesystem, the original numbers are preserved. We need to explicitly state that the files must be owned by root. --- build-rootfs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build-rootfs.sh b/build-rootfs.sh index d657f24..6ebf243 100755 --- a/build-rootfs.sh +++ b/build-rootfs.sh @@ -59,8 +59,8 @@ while read name; do fi done < busybox.symlinks -tar -c -C overlay . \ - | tar -x --keep-newer-files -C /mnt/gentoo +tar -c -C overlay --owner=root --group=root . \ + | tar -x -C /mnt/gentoo cp -uv /usr/${target}/usr/bin/grub-editenv /mnt/gentoo/usr/bin/