Skip to content

23. The smallest VM image

22's image (fedora-bootc:45 standard, 567 packages with sssd,

NetworkManager, podman, rpm-ostree and dnf5) idles at 1314 MB against Debian's 700 MB. Gavin (2026-11-24): build up from what the VM must hold instead of trimming a distribution. The base keeps systemd and glibc, so deploy/linux's units carry over (Alpine is out). After #22, an unclean stop recreates the whole instance from the cached raw, so the separate /var disk goes.

What Fedora's bootc tooling offers

Read from the pinned base itself (quay.io/fedora/fedora-bootc@sha256:d440aea8…) and from bootc-base-imagectl's source and documentation (gitlab.com/fedora/bootc/base-images, bootc-base-imagectl.md):

  • The standard image carries /usr/libexec/bootc-base-imagectl, whose build-rootfs --manifest=NAME [--install PKG]... [--exclude PKG]... [--no-docs] SOURCE_ROOT TARGET composes a root filesystem with rpm-ostree from the manifests in /usr/share/doc/bootc-base-imagectl/manifests. Its documented use is a builder stage, then FROM scratch and COPY --from=builder /target-rootfs/ /, plus LABEL containers.bootc 1 and CMD ["/sbin/init"].
  • bootc-base-imagectl list in this base: minimal ("Effectively just bootc, systemd, kernel, and dnf as a starting point"), standard (#22's base), iot, fedora-eln, and a hidden minimal-plus (minimal plus podman, NetworkManager, openssh, sudo, rpm-ostree, linux-firmware, fwupd and others).
  • minimal is: kernel, systemd, systemd-pam, dbus, bootc, ostree, nss-altfiles, bootupd with grub2-efi-aa64, shim and efibootmgr, xfsprogs, e2fsprogs, dosfstools, coreutils, dnf, selinux-policy-targeted, container-selinux, tpm2-tools, and from Fedora's own include fedora-repos-archive, systemd-resolved and kmscon; weak dependencies off; composefs root, read-only sysroot; a generic initramfs (hostonly=no).

What Lima 2.3.0's boot requires

Read from Lima's v2.3.0 source (pkg/cidata/cidata.TEMPLATE.d/, pkg/hostagent/requirements.go, pkg/driver/vz/vz_driver_darwin.go):

  • The host waits for three things over SSH, as the instance's user with Lima's key: an SSH connection, /run/lima-ssh-ready holding this boot's instance ID, and /run/lima-boot-done holding it. The first is sshd; the other two are written by Lima's boot scripts (07-etc-environment.sh and boot.sh). The host pins whatever host key the guest shows on its first boot.
  • Something must read the cidata disk. It is an ISO labelled cidata holding cloud-init NoCloud data: user-data (the user with its uid, home, shell, NOPASSWD:ALL sudo, locked password and SSH keys; an fstab line per virtiofs mount; a per-boot script at /var/lib/cloud/scripts/per-boot/00-lima.boot.sh that mounts the disk and runs its boot.sh; a ssh_deletekeys: false drop-in), network-config (DHCP on the NIC matched by MAC, DNS 192.168.5.3 under vz), meta-data (instance ID, hostname). Lima ships no other reader for Linux guests (its noCloudInit path is WSL2's). cloud-init is the reader Lima is written for; a few lines of shell reading the same files would also do, at the price of tracking Lima's user-data by hand.
  • boot.sh runs every script in boot.Linux/. For this template (vz, virtiofs, no containerd, no additional disks, no provisioning, passwordless sudo) they need: modprobe (kmod), sed, grep, awk, find, mount, sha256sum, install, sysctl (procps-ng), systemctl and loginctl with systemd-logind running (it enables linger for the Lima user), usermod (shadow-utils) when the user's uid is under 1000, semodule only under SELinux when present, and sudo (the guest agent is installed with sudo lima-guestagent install-systemd). 30-install-packages.sh installs rsync and tar through dnf when they are missing, and does nothing when no package manager it knows is present. 09-host-dns-setup.sh needs iptables only when the host resolver has a local port, which vz never sets (DNS is the gateway's 192.168.5.3).
  • The guest agent (Lima's lima-guestagent, installed from cidata under guestInstallPrefix at every boot, run by systemd as root) carries the warden socket's forward to the Mac.
  • limactl stop asks the VM to stop through Virtualization.framework and waits; it falls back to shutdown -h now over SSH only when the request cannot be made. The guest must act on that request (systemd-logind's power key handling).

The must-have list

Each package or unit, and why the VM holds it. Anything else must justify itself; dependencies come with what needs them.

Package or unit Why
kernel, systemd (with udev, journald, logind), dbus, glibc, bash, coreutils kernel and init; logind for Lima's linger and the stop request; dbus for systemctl and logind
bootc, ostree, bootupd, grub2-efi-aa64, shim, nss-altfiles the bootc image itself: image-builder installs it with bootc install, the boot loader and the composefs root come from these
selinux-policy-targeted, container-selinux SELinux enforcing, #15's and #22's stance; container-selinux labels containerd's and the pods' files
cloud-init reads Lima's cidata: the user and its SSH key, the share's fstab line, the per-boot hook that runs Lima's boot.sh
systemd-networkd, systemd-resolved DHCP on Lima's NIC and DNS (in place of NetworkManager); cloud-init renders network-config to networkd
openssh-server Lima's only way in
sudo Lima's boot script installs the guest agent through sudo; cloud-init writes the user's NOPASSWD rule; limactl shell <vm> sudo
shadow-utils, procps-ng, util-linux, kmod, sed, grep, gawk, findutils what cloud-init and Lima's boot scripts call (above)
containerd, containernetworking-plugins (bridge, host-local, loopback) the CRI runtime and the jobs' network (05-allmyram-egress.conflist)
runsc, containerd-shim-runsc-v1 (gVisor, from the pinned tarball) every job runs in gVisor
allmyram-warden, allmyram (proxy) the warden and the egress proxy
nftables, iproute allmyram-egress.service: the bridge (ip) and egress.nft
allmyram.slice, allmyram-egress, allmyram-warden, allmyram-proxy units, warden-vm.conf, warden.json, sysusers and tmpfiles deploy/linux as #22 baked it, with the proxy ordered after containerd
ca-certificates containerd pulls images over TLS
Lima's guest agent (from cidata, under /var/usrlocal) the warden socket's forward

Off the list, compared with #22: NetworkManager, sssd, podman, skopeo, crun, criu, rpm-ostree, dnf5, cri-tools, rsync, linux-firmware, fwupd, polkit, lvm2, cryptsetup, zram-generator, var.mount and its formatter, the guest agent drop-in, and the second disk. minimal keeps dnf, tpm2-tools and kmscon; whether --exclude can drop them is part of the build.

Predictions

Written before running. Lima 2.3.0, vmType: vz, arm64, 4 CPUs, 8 GiB, footprint from footprint <pid> of the instance's Virtualization.framework process, as #17, #18 and #22.

Question Expected
1a. Floor: minimal as Fedora ships it, no Lima reader (the VM boots, Lima never gets SSH), idle 250–350 MB (8 GiB's page structures ~128 MB, the kernel, a generic initramfs unpacked then freed, systemd)
1b. Stock Debian 13 Lima image, idle 450–550 MB
1c. Stock Fedora 45 Lima image, idle (#22: 1053 MB) 1000–1100 MB
2. Where #22's 1314 MB goes the guest's own count (#22: 464 MiB used, 383 MiB cache) leaves ~450 MB the guest touched and freed (boot, initramfs, dnf and cloud-init's Python) plus the page structures; of the units, containerd, NetworkManager, sssd and the guest agent are the largest at 20–60 MB each
3. Smallest image: checks 1, 2 and 4 of #22 (boot with SELinux enforcing, a gVisor job with forced egress, hard kill mid-job then recreate the instance from the cached raw and the next job works) passes after one to three small fixes (cloud-init's network rendering without NetworkManager; a tool Lima's boot scripts call that minimal lacks)
4a. Its idle footprint 450–600 MB
4b. Warm start (limactl start), and start → warden job exited (#22: 8.4–9.9 s, 8.6–10.1 s) 6–8 s, 6.5–8.5 s
4c. Fresh instance (create, start) → warden job exited (#22: 16.5–16.9 s) 12–15 s
4d. Packages (#22: 567) 230–290
4e. Image: raw allocated, zstd -10 (#22: 2.8 GiB in the build VM, 1.26 GB) 1.5–2 GiB, 550–750 MB
5. Proxy with After=containerd.service no failed first start at any boot

Setup (2026-11-24)

  • The MacBook (32 GB) and Lima 2.3.0 as in #22. VMs in scratch LIMA_HOMEs (/private/tmp/claude-501/v23b for the build VM, /private/tmp/claude-501/v23 for the rest); one VM running at a time while measuring.
  • Images, all from spike/vmimage-min/Containerfile on the same pinned base as #22, built by spike/vmimage/build.sh --image-dir spike/vmimage-min (which gained --image-dir, --target, and per-image podman-build.args and image-builder.args):
  • floor: --target floor, bootc-base-imagectl build-rootfs --manifest=minimal exactly as Fedora composes it. No sshd and no cidata reader, so Lima never reaches it; it boots and idles.
  • B: allmyram-manifest.yaml (minimal less dnf and kmscon, plus rpm, which the compose needs) with the must-have list added by --install, then #22's users, gVisor, binaries, config and units, the proxy ordered after containerd, networkd enabled, bootupd's bootloader-update.service disabled.
  • C (the result): B plus an initramfs for this VM only (dracut-lima.conf), Lima's SELinux module installed at build (lima-sshd-session.cil), and systemd-networkd-wait-online disabled.
  • Lima: spike/lima_vmimage_min.yaml, #22's template without the second disk: 4 CPUs, 8 GiB, disk: 20GiB, guestInstallPrefix: /var/usrlocal, the share, the socket forward, the ports rule. Stock images: spike/lima_stock.yaml (template:_images/debian-13 or fedora-45, Lima's containerd off, no mounts). #22's image rerun from its raw in /private/tmp/claude-501/v22out with spike/lima_bootc.yaml.
  • Scripts: spike/lima_footprint.py idle reads footprint of the instance's Virtualization.framework process 30, 60 and 90 s after limactl start returns (for the floor, after the VM process appears), after a stop and start unless said otherwise; inside lists /proc/meminfo and each cgroup's memory. spike/lima_vm_reset.py (check, warm, fresh, kill) is lima_bootc_var.py without the /var disk: an unclean stop is answered by limactl delete and limactl create from the cached raw. spike/lima_egress_check.py --image --tools-dir runs #18's probe with crictl 1.29.0 (cri-tools' release tarball, sha256 checked) from the share, since the image has no crictl.

Raw results

What it took (each now in the Containerfile or the build files):

Problem Evidence Fix
build-rootfs can't run in a plain podman build bwrap: Creating new namespace failed: Operation not permitted --cap-add=all --security-opt=label=type:container_runtime_t --device=/dev/fuse
image-builder runs osbuild inside the image, which has no Python bwrap: execvp /run/osbuild/runner/org.osbuild.linux: No such file or directory --bootc-build-ref the pinned base (by a local tag: given the digest, image-builder looks for the arm64 manifest's digest and doesn't find it)
no tar in the image tar: command not found gVisor unpacked in a builder stage
no network, so no SSH Lima waited on 192.168.5.15:22; Fedora's presets leave systemd-networkd disabled enable it
dnf in the image Lima's 30-install-packages.sh runs dnf install tar rsync whenever dnf exists; it fails on the read-only root, and Lima's boot script and cloud-init-main fail with it a manifest without dnf (--exclude dnf5 fails: minimal names /usr/bin/dnf)
bootloader-update.service fails at every boot bootupctl: Parsing "/sysroot/.bootc-aleph.json": invalid type: null: bootc writes a null timestamp for an image with no org.opencontainers.image.created label disabled; the VM is never updated in place

Packages (rpm -qa from the image's database): floor 239; C 271 (#22: 567). C over the floor: cloud-init and 26 Python packages, openssh-server, sudo, systemd-networkd, containerd, runc, containernetworking-plugins, nftables, iproute, shadow-utils and their libraries; the floor's dnf5 and its 9 libraries, fedora-repos-archive, kmscon and its 3 libraries are gone.

1. Boot, share, socket, SELinux (image C, lima_vm_reset.py check, fresh instance): SELinux enforcing; / composefs read-only, touch /usr/bin/x refused; /var is the deployment's var on the root disk; the share mounted context=nfs_t, written by VM root and read on the Mac; the socket 0600 on the Mac; a warden job exit 0, Completed, uid 882 in gVisor, its CRI log read on the Mac; containerd, egress, warden, proxy, cloud-final and the guest agent active; no failed units; AVC denials 0. Lima reached SSH through vsock (systemd's sshd-vsock.socket, from systemd-ssh-generator): "Detected SSH server is listening on the vsock port".

2. Forced egress (lima_egress_check.py --image): as #18 and #22. https://example.com through the proxy 200 (the real proxy logged "decision":"allow","rule":"public"); 1.1.1.1:443 and IPv6 network unreachable; the canary at the gateway, the VM and the Mac's three addresses, and the VM's sshd network unreachable; 10.78.0.1:22 and :53 timed out (iifname "allmyram-e0" drop counted 25 packets); the canary saw nothing.

4. Hard kill, recreate the instance (lima_vm_reset.py kill: a warden job sleep 600 running, kill -9 of the VM's process, limactl delete --force, limactl create from the cached raw, limactl start). Twice: once ~70 s into the VM's life, once 15 s after a start (where #22's /etc broke). Both: recreate 0.30–0.31 s, warden reachable 7.8–8.8 s after limactl start, same image digest, a new machine-id, the next job exit 0, the killed run unknown to the warden.

5. The proxy after containerd. No failed start in any boot of C (a fresh boot and two warm boots checked in the journal): the proxy's main process started ~1 ms after containerd became active.

Times (image C):

Case limactl start (s) start → warden job exited (s)
Warm (4) 7.73–7.79 7.98–8.06
Fresh instance (4; limactl create 0.26–0.34 s; alpine pulled each time) 7.82–9.92 11.78–14.13

In the guest (systemd-analyze, warm): kernel 0.09–0.12 s, initrd 1.36–1.56 s, userspace 3.3–3.9 s. Image B's fresh start took 14.3 s with 9.7 s of userspace: Lima's boot script rebuilt the SELinux policy to add its module (~4 s) and systemd-networkd-wait-online took 1.7 s.

Idle footprint at 8 GiB (MB, footprint; warm boots unless said):

VM 30 / 60 / 90 s
Floor: minimal as Fedora ships it, first boot 927 / 927 / 927
Floor, warm (two boots) 806 / 806, and 831 (plateau of a sampled boot)
Stock Debian 13 (Lima's image, no containerd) 664 / 666 / 665
Stock Fedora 45 (Lima's image, no containerd) 1097 / 1097 / 1097
#22's image, this method (two boots) 1364 / 1364 / 1364, 1350 / 1350
B (two boots) 1150 / 1150 / 1150, 1170 / 1170 / 1170
C (three boots) 1102 / 1101 / 1101, 1095 / 1095 / 1095, 1067 / 1067 / 1067
C, a fresh instance's first boot 1198 / 1198 / 1198

Where the memory goes (lima_footprint.py inside, warm, idle, no job yet; MiB unless said):

Debian 13 stock #22 C
Outside the guest's MemTotal (kernel, page structures, reserved) 252 287 287
Guest used (MemTotal − MemFree) 311 686 573
of which page cache 133 355 312
of which anonymous 49 167 115
of which slab 42 90 82
Host footprint (MB) 665 1350–1364 1067–1102
Footprint the guest can't see (≈ footprint − the two above) ~100 ~380 ~225
Initramfs (compressed, as freed at boot) 17.6 MB 95.5 MB 18.2 MB

C's cgroups: containerd 100 (71 of it file pages: its 37 MB binary and its data), systemd itself 110 (75 file), the proxy 31 (28: its 30 MB binary), the guest agent 30, udevd 23, the user session 16, the warden 14, journald 12, logind 9, sshd 10; the rest of system.slice's 220 file pages (~70) belongs to units that have exited: cloud-init's Python and Lima's boot scripts. cloud-init-main (which runs every stage in cloud-init 26) peaks at 143–170 MB per boot; on a fresh instance of B, where Lima's boot script rebuilt the SELinux policy inside it, at 390 MB. #22 has the same core plus NetworkManager 16, udisks2 23, polkit 10, chronyd 9, kmscon 8, irqbalance, gssproxy and avahi.

The host keeps what the guest touched. vz's balloon (Lima attaches VZVirtioTraditionalMemoryBalloonDevice) offers feature bits 0 and 2 only (/sys/bus/virtio/devices/virtio7/features), no free page reporting. In C, echo 3 > drop_caches freed ~360 MiB in the guest and the footprint stayed at 1124 MB. So boot-time work counts in full: the footprint of a floor boot, sampled every 0.5 s, was 144 MB before the kernel (firmware, GRUB), 572 MB half a second into the kernel (page structures for 8 GiB, the 61 MB generic initramfs unpacked to 110 MB with 1894 modules), then 831 MB once userspace settled. Freed pages count until the guest reuses them.

Image (C): raw 10 GiB apparent, 1.63 GiB allocated in the build VM, zstd -10 614,875,471 bytes (B 637,110,025; floor 469,750,846; #22 1,258,592,401). zstd -d --sparse on the Mac left 4.46 GiB allocated. Partitions as #22. Build with the base and layers cached: 230 s (podman build 73 s, image-builder 115 s, unpack 31 s); no cold build was timed.

Other findings. gVisor (the pinned release-20261116.0 and master) supports host pages of 4K and 64K only (hostarch.IsSupportedPageSize), so Fedora's 16K-page kernel, which would match the Mac's 16K pages, can't run the jobs. Regenerating the initramfs in the Containerfile logs dracut-install: ERROR: installing '/root' (in this base /root links to /var/roothome); the image boots regardless. One start of the build VM hung after SSH was found on vsock and needed limactl stop --force; the next start was fine.

What we learned

  • The smallest image passes the gate's checks: boot with SELinux enforcing, forced egress unchanged, a hard kill answered by recreating the instance. Six small fixes, all in the build or one unit each.
  • Fedora's floor is above Debian's whole VM. minimal, kernel and systemd only, idles at 806–927 MB; stock Debian 13 idles at 665 and #18's Debian with containerd and gVisor at 700. Fedora's boot (a generic 110 MB initramfs, 35 MiB more outside MemTotal than Debian's cloud kernel) costs ~150–250 MB before anything of ours runs.
  • C idles at 1067–1102 MB, 250–300 MB under #22 (1350–1364 by this method) and ~150–300 MB over the floor. Above the floor: containerd 100, the proxy 31, the guest agent 30, the warden 14, sshd and the session 25, and cloud-init (a 143–170 MB peak each boot, ~70 MB of Python left in the cache). C's changes over B (mostly the VM's own initramfs, 61 → 18 MB compressed) saved 50–100 MB warm; baking Lima's SELinux module cut a fresh instance's start by ~4 s and cloud-init's peak from 390 to 170 MB.
  • What the guest touches at boot stays on the Mac. No free page reporting under vz, so transient work (initramfs, cloud-init, a policy rebuild) is paid for as long as the VM runs. Smaller means touching less, not only holding less.
  • C starts faster than #22: warm 7.7–7.8 s (#22 8.4–9.9 s, #17's Debian 4.6–6.8 s), fresh instance to a finished job 11.8–14.1 s (#22 16.5–16.9 s). 271 packages, 615 MB compressed.

What it changes

  • For Gavin before Tasks 11+: a Fedora bootc VM can be cut to ~1.1 GB idle, not to Debian's 0.7 GB; the floor alone is 0.8–0.9 GB. Choices: take C (~400 MB more than Debian per running VM, for a pinned read-only OS); try replacing cloud-init with a small cidata reader (an estimated 100–150 MB, not built here, at the cost of tracking Lima's user-data by hand); or the plan's fallback, a baked Debian raw reset by recreating the instance.
  • If C goes forward, Tasks 11+ build from spike/vmimage-min: its own manifest, the must-have list, the VM's own initramfs, Lima's SELinux module baked in, networkd, no dnf, no second disk, the proxy after containerd (which deploy/linux/allmyram-proxy.service should get too).
  • The build needs extra podman privileges and a separate build root for image-builder; both are in spike/vmimage-min/*.args.

Why Fedora holds more than Debian (2026-11-25)

Gavin (2026-11-25): why does a Fedora VM hold almost twice the memory of a Debian VM on the Mac? The above broke image C down but measured Debian as a total only. This gives stock Debian 13 and the floor image the same breakdown, then changes one thing at a time.

Setup

  • Same Mac, Lima 2.3.0, vz, 4 CPUs, 8 GiB, scratch LIMA_HOME /private/tmp/claude-501/v23c, one VM running at a time while measuring.
  • Images: stock Debian 13 (debian-13-genericcloud-arm64-20261103-2651) and stock Fedora 45 (Fedora-Cloud-Base-Generic-45-1.4), copied from Lima's download cache and booted by path through spike/lima_image_file.yaml (lima_stock.yaml's settings, a local image file; the cache was unchanged afterwards). The floor from /private/tmp/claude-501/v23out/floor with disk: 20GiB as before.
  • Footprint through boot: lima_footprint.py idle --from-process --every 0.5 --until 90 (the floor: --no-ready ... --until 120), the footprint of the VM process every 0.5 s from its appearance. The figure below is the one at 90 s.
  • Inside: lima_footprint.py inside over SSH for Debian and Fedora, just after the 90 s sample: /proc/meminfo, the kernel's boot memory lines, the LSMs and SELinux state, each cgroup's memory.current (anon, file, kernel) and memory.peak. The floor has no sshd, so spike/floor_probe.sh install-probe put the same script (lima_footprint.py probe) in the deployment's /etc, run by amr-probe.service, which sleeps 95 s and writes to /dev/hvc0; lima_footprint.py serial reads it from serialv.log, which Lima truncates at each start. The probe unit itself holds 2–4 MiB.
  • Kernel and initramfs: lima_footprint.py describe (in the VM, or on the floor's root mounted in a helper VM): the kernel package, its config file, and the initramfs unpacked in /var/tmp.
  • Changes: spike/floor_probe.sh attaches the stopped floor's disk on a loop device in a helper VM (stock Fedora 45 with the Lima home mounted) and edits the boot entry's options or swaps the initramfs. Debian's generic kernel came from apt-get install linux-image-arm64, which also brought the cloud kernel to the same version (6.12.118), measured first; GRUB_DEFAULT then picked the generic one.
  • Stock images and the floor: a fresh instance's first boot (not counted), then three boots, each after a stop (for the floor, which Lima never reaches, limactl stop --force). The floor's changes: three boots each, starting right after the change. Debian's kernels: one boot after the change not counted, then three. "Unseen" is the footprint less the guest's used memory (MemTotal − MemFree) and the memory outside MemTotal (8192 MiB − MemTotal): pages the guest touched and has since freed, plus the VZ process's own.
  • Raw output: /private/tmp/claude-501/v23c-out/ (<case>-boot<N>.jsonl, <case>-inside<N>.jsonl, *-describe.jsonl, kernel configs, summary.md).

Raw results

Side by side (three boots each, range; MiB unless said):

Debian 13 stock Fedora floor Fedora 45 stock
Footprint at 90 s (MB) 666–680 (mean 673) 831–870 (853) 1081–1112 (1094)
First boot (MB) 1146 920 1233
Outside MemTotal 252 287 286
Guest used (MemTotal − MemFree) 286–303 285–293 578–589
page cache (Cached) 130–131 124 312
Buffers 12 3 2
anonymous (AnonPages) 53–63 43–46 94–99
slab 42 61–62 85–87
of which unreclaimable 30–31 47–48 64–66
VmallocUsed 8 10 39
KernelStack, PageTables, Percpu, Shmem 1, 1, 1, 0 1–2, 1, 1, 0 2, 2, 1, 0
Unseen (MB) 88–116 223–270 163–206

Kernel and initramfs:

Debian 13 stock Fedora floor Fedora 45 stock
Kernel package linux-image-6.12.115+deb13.1-cloud-arm64 kernel-core-7.3.4-300.fc45 kernel-core-7.2.11-300.fc45
Config =y / =m 1900 / 1085 3582 / 5712 3552 / 5646
Modules on disk 1083 5648 2912
Image: code + rwdata + rodata + init + bss (Memory: line) 30.2 MiB 76.1 MiB 74.8 MiB
Reserved at boot (Memory: line) 270 MiB 360 MiB 348 MiB
Per-CPU area 34 pages/CPU 59 pages/CPU 58 pages/CPU
Initramfs (zstd) 18.0 MB 60.9 MB 49.8 MB
Unpacked: bytes, files, modules 46.6 MB, 416, 280 109.4 MB, 3370, 1894 101.4 MB, 3047, 1551
Modules loaded at idle 68 19 45
LSMs lockdown, capability, landlock, yama, apparmor, tomoyo, bpf, ipe, ima, evm lockdown, capability, yama, selinux, bpf, landlock, ipe, ima, evm as the floor
SELinux absent enforcing enforcing
mem auto-init heap alloc on, free off the same the same

Debian's initramfs-tools already uses MODULES=most; its cloud kernel has few modules to include. Config lines that differ and touch memory (none tested): NR_CPUS 512 / 4096, NODES_SHIFT 4 / 9, HZ 250 / 1000, transparent huge pages always / madvise, DEFERRED_STRUCT_PAGE_INIT y / n, PAGE_OWNER n / y (off unless page_owner=on), ZSWAP n / y. Both have INIT_ON_ALLOC_DEFAULT_ON, SHUFFLE_PAGE_ALLOCATOR, 4K pages and a 64 MiB CMA area and 64 MB swiotlb buffer.

Cgroups (current / peak, MiB, three boots):

Debian 13 stock Fedora floor Fedora 45 stock
init.scope (PID 1 and generators) 3.7–3.8 / 13.7–15.4 96.8–98 / 100–102 (anon 17–18, file 73.5) 66.8–67.7 / 86–88 (anon 18–19, file 42.7)
system.slice 158–170 / 189 88–93 / 176–216 234–238 / 411–433
systemd-udevd 6.1 / 17–18 25–26 / 100–139 23 / 120–139
systemd-journald 4.4–5.4 / 12–13 17–19 / 26–28 10–12 / 18–20
Lima's guest agent 37–47 – 28.5–29.4
NetworkManager, kmscon, chronyd – –, 10–11, – 25, 15.5–19, 9.4–9.7

On the floor, page cache by place (one more boot with probe --diag, fincore): composefs's backing objects 92 MB (the largest a fully cached 15.9 MB object, the size of /usr/bin/bootc; the floor runs bootc-systemd-generator at every boot), /etc 18 MB (/etc/udev/hwdb.bin 13.9 MB, written by the first boot because /usr is read-only; the SELinux policy 3.9 MB), /var 17 MB (the journal). Through the composefs mount fincore sees nothing.

Through boot. Every boot shows the same shape in the 0.5 s samples: ~145 MB in the firmware and GRUB, a jump as the kernel starts (page structures for 8 GiB, the kernel, the initramfs) to a level held for 0.5–1.5 s, then growth as the real root's userspace starts, then flat from 5–7 s on. Per case, three boots (MB):

Case Held after the kernel starts Settled Userspace added
Debian 13 stock (cloud kernel 6.12.115) 552–569 664–680 ~110
Debian, cloud kernel 6.12.118 549–574 663–680 ~105
Debian, generic kernel 6.12.118 696–700 796–801 ~100
Fedora floor 563–597 831–870 ~270
Floor, selinux=0 583–602 700–733 ~120
Floor, image C's initramfs 476–488 787–789 ~300
Floor, both 464–488 620–656 ~155
Fedora 45 stock (no clear level: it keeps rising) ~550–600 1081–1112 ~500

One change at a time (footprint at 90 s, three boots each):

Change Footprint (MB) vs its base Guest used (MiB) Unseen (MB)
Floor as built 831–870 (853) 285–293 223–270
Floor, selinux=0 700–733 (717) −136 260–266 126–158
Floor, image C's initramfs (18.6 MB, 49 MB unpacked, 68 modules) 787–789 (788) −65 277–286 186–198
Floor, both 622–658 (642) −211 261–266 42–80
Debian, cloud kernel 6.12.118 663–680 (670) 284–304 92–101
Debian, generic kernel 6.12.118 (37.7 MB initramfs, 68 MB unpacked, 1330 modules) 796–801 (798) +128 312–317 197–200

With SELinux off: systemd-udevd's peak 100–139 → 37–41 MiB, system.slice's peak 176–216 → 98–104, PID 1's anonymous memory 17–18 → 5, slab 61–62 → 49–50, init.scope file pages 73.5 → 69; the level held after the kernel starts is unchanged, the userspace phase adds ~150 MB less. The small initramfs changed none of the cgroups (they start after it); it lowered the level held after the kernel starts by ~90–110 MB, and userspace then added ~30 MB more than before, so ~65 MB stayed saved (the guest reuses pages it freed before touching new ones, so a lower early level is partly refilled later). Debian's generic kernel left the cgroups as they were (udevd peak 18 → 22, 68 → 85 modules loaded); all of its 128 MB is in the level held after the kernel starts, 5 MiB of it outside MemTotal.

What we learned

  • The floor holds what Debian holds; it touched more getting there. Inside, both use ~290 MiB at idle, with similar page cache. The floor's extra ~180 MB is boot work the guest freed and the Mac kept (unseen 223–270 MB against 88–116), plus 35 MiB more outside MemTotal.
  • SELinux is the largest single part: ~136 MB. Enforcing at boot, udevd's cgroup peaks 60–100 MiB higher, PID 1 keeps 13 MiB more anonymous memory, and the kernel 12 MiB more slab. Which code in udevd allocates that peak was not traced.
  • The generic initramfs costs ~65 MB on Fedora, and the reverse holds: Debian with its generic kernel and a 38 MB initramfs costs 128 MB more. Both land as the kernel starts, before any unit runs. On Fedora the early saving is ~100 MB, of which userspace later refills ~30.
  • The floor's gap to Debian opens in userspace. The level held after the kernel starts is only ~10–30 MB above Debian's; userspace then adds ~270 MB on the floor against ~110 on Debian, and ~120 on the floor without SELinux.
  • Fedora's kernel is larger: 76 MiB of image against 30, 59 per-CPU pages against 34, 35 MiB more outside MemTotal. Not changed here (it would mean building a kernel).
  • Without SELinux and with a small initramfs the floor idles at 622–658 MB, under stock Debian's 666–680 (which also runs cloud-init, sshd and Lima's guest agent).
  • Stock Fedora's "almost twice" (1094 against 673) is mostly its userspace: ~300 MB more held in the guest (page cache +180 MiB, anon +40, slab +44, vmalloc +31; units Debian doesn't run, such as NetworkManager 25, kmscon 16–19 and chronyd 9, and system.slice and init.scope holding ~140 MiB more between them), ~85 MB more unseen, 34 MiB more outside MemTotal. Its userspace phase adds ~500 MB against Debian's ~110. Image C already dropped most of that userspace; what C still carries over Debian's base is SELinux, the larger kernel, and our own services.
  • First boots cost more on every image (Debian 1146, Fedora 1233, floor 920 MB). Debian's first probe found 404 MiB of page cache in system.slice, against ~103 on later boots; the floor's first boot writes /etc/udev/hwdb.bin.