fix: keep the mkosi workspace off overlayfs in the test container
os / os (push) Canceled after 0s

mkosi's copy_tree() leaves out all xattrs when it copies a tree with SELinux
labels to overlayfs. In the podman test container the workspace was in
/var/tmp on the container's overlayfs, and the cached tree has the host's
SELinux labels, so newuidmap and newgidmap lost their file capabilities and
rootless podman failed in the VM. A volume at /var/tmp avoids that.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V27snrrx9tfCQvBpqtSPn3
This commit is contained in:
Job79andClaude Opus 5.5 committed 2026-11-21 20:53:45 +01:00
1 parent 5255656258
commit 186d133cbc
1 file changed
+5 -1
+5 -1
View File
@@ -65,7 +65,7 @@ RUN dnf install -y mkosi git-core
CMD ["/sbin/init"] CMD ["/sbin/init"]
END END
podman run -d --name mkosi --privileged --systemd=always -v <repo>:/repo \ podman run -d --name mkosi --privileged --systemd=always -v <repo>:/repo \
-v mkosi-cache:/root/.cache/mkosi -w /repo mkosi-vm -v mkosi-cache:/root/.cache/mkosi -v mkosi-work:/var/tmp -w /repo mkosi-vm
podman exec mkosi mkosi genkey # Run this once, if there is no mkosi.key. podman exec mkosi mkosi genkey # Run this once, if there is no mkosi.key.
podman exec -d -t mkosi sh -c 'mkosi -f vm > mkosi.output/vm.log 2>&1' podman exec -d -t mkosi sh -c 'mkosi -f vm > mkosi.output/vm.log 2>&1'
podman exec mkosi mkosi ssh -- systemctl --failed podman exec mkosi mkosi ssh -- systemctl --failed
@@ -74,6 +74,10 @@ podman exec mkosi mkosi ssh -- systemctl --failed
podman resolves paths on the host, so `<repo>` is the repository's path there. podman resolves paths on the host, so `<repo>` is the repository's path there.
The volume `mkosi-cache` keeps mkosi's package cache when the container is The volume `mkosi-cache` keeps mkosi's package cache when the container is
made again, so builds don't download every package anew. made again, so builds don't download every package anew.
The volume `mkosi-work` keeps mkosi's workspace in /var/tmp off the
container's overlayfs. mkosi copies a tree with SELinux labels (as files from
the host have) to overlayfs without any xattrs. That drops the file
capabilities of newuidmap and newgidmap, and rootless podman fails in the VM.
`mkosi vm` needs a terminal, hence `-d -t`; its console goes to the log. `mkosi vm` needs a terminal, hence `-d -t`; its console goes to the log.
`mkosi ssh` runs a command as root, once the VM has booted. For the user `mkosi ssh` runs a command as root, once the VM has booted. For the user
`agent`, run `su - agent -c '<command>'`. `agent`, run `su - agent -c '<command>'`.