| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
a root shell
`su dev` starts a shell as dev, and when that shell exits the script carries on
to `exec /bin/bash` - as root. So logging out of the devbox did not stop the
container, it dropped you into a second, privileged shell:
old: su dev; exec id -un -> root
new: exec runuser -u dev -> dev
runuser rather than su because this is exactly its job: root to a named user, no
password prompt, no login shell. `su - dev` would also have cd'd to /home/dev
and thrown away WORKDIR=/workspace. The environment was not the problem, su
sets USER, LOGNAME, HOME and PATH on its own.
exec is the other half: the shell replaces the entrypoint instead of being its
child, so the container's lifetime is the shell's lifetime and signals reach it
directly instead of queueing behind a root script that is waiting on su.
Verified the drop happens on both storage paths (native filesystem and
loop-mounted ext4) with the stub harness.
---
Co-Authored-By: pi <pi@pi.dev>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- /dev/net/tun, which rootless podman opens for the container network, and
/dev/fuse for the fuse-overlayfs fallback. Both world-readable, since it is
the dev user who opens them; mknod alone would leave them 0600 root.
- modprobe of loop, overlay, veth and bridge. Nothing else does this: there is
no systemd in the guest, so no systemd-modules-load.service, and a kata guest
kernel does not necessarily have them built in.
- delegation of the cgroup tree. Without systemd there is no user@1000.service
and nothing performs the delegation rootless podman needs to create a cgroup
for a container, which shows up as "Failed to add conmon to cgroupfs sandbox
cgroup" and no --memory/--cpus/--pids-limit. Enabling the controllers for
children and chowning /sys/fs/cgroup is all delegation is. Guarded on
/proc/self/cgroup being 0::/, so it never hands over a host tree visible
through --cgroupns=host.
Co-Authored-By: pi <pi@pi.dev>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Podman's overlay storage driver cannot be built on virtiofs, which is what the
graphroots sit on in a kata guest, so nested podman fails with "mount overlay:
invalid argument". The loop-mounted ext4 that was supposed to fix it never
happened, for two independent reasons:
- `df -PT "$STORAGE"` runs before anything has created $STORAGE, and df exits 1
on a nonexistent path, so the test is never true. mkdir -p was inside the if.
- even when df did answer, `cut -d' ' -f2` returns an empty string, because df
separates its columns with runs of spaces rather than single ones.
Once it does fire, three more things go wrong: truncate and mkfs run
unconditionally, so every start wipes every image and container; the ext4 is
root-owned, so the dev user gets EACCES on its own graphroot; and a failed
--make-rshared is swallowed with `|| true`, which leaves nested containers
without the shared mount propagation they need.
Also covers 9p, fuse, nfs, cifs and an overlay root, all of which need the loop
just as much as virtiofs does, and treats ext*/xfs/btrfs/f2fs/tmpfs as the
native case they are.
Co-Authored-By: pi <pi@pi.dev>
|
| |
|
|
|
|
|
| |
"#/bin/bash" is not a shebang, so the script is not executable as written; it is
only ever worked because something else hands it to an interpreter.
Co-Authored-By: pi <pi@pi.dev>
|
| |
|