Skip to content

vminit: pre-reqs for a read-only erofs rootfs mounted via virtio-pmem#209

Closed
djs55 wants to merge 1 commit into
containerd:mainfrom
djs55:djs55/erofs-pmem-rootfs
Closed

vminit: pre-reqs for a read-only erofs rootfs mounted via virtio-pmem#209
djs55 wants to merge 1 commit into
containerd:mainfrom
djs55:djs55/erofs-pmem-rootfs

Conversation

@djs55
Copy link
Copy Markdown
Contributor

@djs55 djs55 commented May 29, 2026

I'm experimenting with switching to a read-only erofs rootfs. I hit 2 issues:

  1. Handle EBUSY on the devtmpfs /dev mount.

    With a real rootfs and CONFIG_DEVTMPFS_MOUNT=y, the kernel auto-mounts devtmpfs at /dev before running init, so vminitd's own mount attempt returns EBUSY. Treat EBUSY as success — the devices are already present.

    With a cpio initramfs (tmpfs rootfs) /dev was never in the archive so the kernel couldn't auto-mount there and this path always did a fresh mount. The EBUSY check is a no-op in that case.

  2. Add tmpfs mounts for /etc and /mnt.

    An erofs rootfs is read-only. vminitd writes resolv.conf to /etc and the container shim creates bind-mount target directories under /mnt. Mounting a tmpfs over each provides the writable scratch space they need. On a writable rootfs (tmpfs initramfs) these mounts are equivalent to what was already there.

When booting from a real rootfs (erofs image exposed as a virtio-pmem
device) rather than a tmpfs initramfs, systemMounts needs two changes:

1. Handle EBUSY on the devtmpfs /dev mount.

   With a real rootfs and CONFIG_DEVTMPFS_MOUNT=y, the kernel
   auto-mounts devtmpfs at /dev before running init, so vminitd's own
   mount attempt returns EBUSY. Treat EBUSY as success — the devices
   are already present.

   With a cpio initramfs (tmpfs rootfs) /dev was never in the archive
   so the kernel couldn't auto-mount there and this path always did a
   fresh mount. The EBUSY check is a no-op in that case.

2. Add tmpfs mounts for /etc and /mnt.

   An erofs rootfs is read-only. vminitd writes resolv.conf to /etc and
   the container shim creates bind-mount target directories under /mnt.
   Mounting a tmpfs over each provides the writable scratch space they
   need. On a writable rootfs (tmpfs initramfs) these mounts are
   equivalent to what was already there.

Signed-off-by: David Scott <dave@recoil.org>
Copilot AI review requested due to automatic review settings May 29, 2026 09:46
@djs55
Copy link
Copy Markdown
Contributor Author

djs55 commented May 29, 2026

ah, looks like it's already being covered by #208 , I'll close!

@djs55 djs55 closed this May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant