<feed xmlns='http://www.w3.org/2005/Atom'>
<title>devbox/login.sh, branch ai/podman-minimal</title>
<subtitle>Unnamed repository
</subtitle>
<link rel='alternate' type='text/html' href='http://git.jnsn.dev/cgit/devbox/'/>
<entry>
<title>login.sh: drop to dev with exec instead of running su and falling through to a root shell</title>
<updated>2026-11-16T22:17:39+00:00</updated>
<author>
<name>delusionalai</name>
<email>delusionalai@users.noreply.git.jnsn.dev</email>
</author>
<published>2026-11-16T22:17:39+00:00</published>
<link rel='alternate' type='text/html' href='http://git.jnsn.dev/cgit/devbox/commit/?id=f3070d9751736de12f72038f6d4a558c68cf63f0'/>
<id>f3070d9751736de12f72038f6d4a558c68cf63f0</id>
<content type='text'>
`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   -&gt;  root
    new: exec runuser -u dev   -&gt;  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 &lt;pi@pi.dev&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`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   -&gt;  root
    new: exec runuser -u dev   -&gt;  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 &lt;pi@pi.dev&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>login.sh: give nested podman the devices, modules and cgroup tree it asks for</title>
<updated>2026-11-16T22:09:56+00:00</updated>
<author>
<name>delusionalai</name>
<email>delusionalai@users.noreply.git.jnsn.dev</email>
</author>
<published>2026-11-16T22:09:56+00:00</published>
<link rel='alternate' type='text/html' href='http://git.jnsn.dev/cgit/devbox/commit/?id=f2fd518c16eec93bebc846db9341ee5831a41bed'/>
<id>f2fd518c16eec93bebc846db9341ee5831a41bed</id>
<content type='text'>
- /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 &lt;pi@pi.dev&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- /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 &lt;pi@pi.dev&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>login.sh: put the graphroot on a filesystem overlayfs can live on</title>
<updated>2026-11-16T22:09:56+00:00</updated>
<author>
<name>delusionalai</name>
<email>delusionalai@users.noreply.git.jnsn.dev</email>
</author>
<published>2026-11-16T22:09:56+00:00</published>
<link rel='alternate' type='text/html' href='http://git.jnsn.dev/cgit/devbox/commit/?id=e237acf0f5161db48b9553db541e91e02b191f97'/>
<id>e237acf0f5161db48b9553db541e91e02b191f97</id>
<content type='text'>
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 &lt;pi@pi.dev&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;pi@pi.dev&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>INITIAL COMMIT</title>
<updated>2026-11-16T19:03:42+00:00</updated>
<author>
<name>Jesper Jensen</name>
<email>jesper@jnsn.dev</email>
</author>
<published>2026-11-16T19:03:42+00:00</published>
<link rel='alternate' type='text/html' href='http://git.jnsn.dev/cgit/devbox/commit/?id=87f0b4288fcc2de193732e7c0e96181e68bc502c'/>
<id>87f0b4288fcc2de193732e7c0e96181e68bc502c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
