Skip to content

Mac VM image

The disk image the Mac runner's Lima VM (vz, arm64) boots: Garden Linux's lima platform plus the allmyram feature in deploy/vmimage/, made with Garden Linux's own builder at a pinned release (experiment 24). To rebuild it, see How to build the Mac VM image.

Contents

The image is the OS layer only: Garden Linux, containerd, runc, the CNI plugins, nftables, rsync, gVisor's runsc and shim, deploy/linux's units, the egress rules and the CNI network, and allmyram's users with fixed ids. It changes when those are bumped, not with allmyram. The allmyram and allmyram-warden binaries and the VM's warden.json come from the runner through the share at every boot.

Build outputs

In dist/vmimage/, named for the Garden Linux release <tag> and IMAGE_REVISION in build.sh (<rev>):

File Contents
allmyram-vm-<tag>-<rev>.raw.zst the disk image, zstd -10; what the runner downloads and pins by sha512
allmyram-vm-<tag>-<rev>.raw the same unpacked and sparse, for check.sh
SHA512SUMS sums of the images
manifest.txt every package and version
release.txt the image's /etc/os-release
build.log everything the build steps printed

Pins

  • Garden Linux 2150.15.0 at commit fb5e4ef5 (gl_tag, gl_commit in build.sh), which fixes the package set: the builder bootstraps from the release's own apt suite.
  • The builder image that tag's build script names (ghcr.io/gardenlinux/builder:0196add0…); build.sh checks it.
  • gVisor's aarch64 release tarball, by the sha512 in deploy/linux/install.sh.
  • The build VM's Debian 13 cloud image, by the sha512 in build-vm.yaml.
  • The image itself, by File, URL and SHA512 in internal/vmimage/vmimage.go.

The allmyram feature

feature/allmyram, on top of lima (info.yaml, pkg.include, pkg.exclude, file.include, exec.config, fstab.mod):

  • /usr on its own ext4 partition, mounted read-only (fstab.mod, from the gardener feature). Lima's guest agent goes under /var/usrlocal (guestInstallPrefix in the runner's Lima template).
  • init_on_free=0 on the kernel command line. Garden Linux's cloud kernel zeroes every free page at boot, and under vz the Mac keeps every page the guest touched: without it the VM holds all of its RAM.
  • containerd's config. It doesn't yet name a runsc config, so runsc runs on its defaults; the next image build should pin overlay2 = "root:self" through /etc/containerd/allmyram-runsc.toml, as Linux runners do (experiment 30).
  • sysusers with fixed ids: allmyram-warden 880, allmyram-proxy 881, allmyram-job 882, allmyram-share 883; tmpfiles, including a boot-only rule that drops the egress network's cached CNI results.
  • The warden's vm.conf drop-in (see Mac runner).
  • The job data disk: xfsprogs, allmyram-data-makefs.service, var-lib-allmyram-warden.mount and the warden's data-disk.conf drop-in.
  • exec.config: runs sysusers, checks containerd's config and runsc, enables containerd, the three allmyram units and the data disk's mount, and masks nftables.service (its /etc/nftables.conf flushes every ruleset), cni-dhcp.socket and cni-dhcp.service. They are masked rather than disabled because a fresh instance's first boot runs systemd's preset-all.

Binaries at boot

  • Before it starts the VM, the runner writes allmyram, allmyram-warden, warden.json and a SHA256SUMS of the three into <share>/bin.
  • At every boot allmyram-binaries.service, a oneshot ordered before the warden and the proxy, runs /usr/libexec/allmyram/copy-binaries. It copies the binaries into /var/lib/allmyram/bin and warden.json to /etc/allmyram/warden.json, and checks each copy against SHA256SUMS. A missing file, a missing sum or a mismatch fails the unit and leaves no copy.
  • The warden's and the proxy's binaries.conf drop-ins require that unit, so neither starts without a checked set. Their units are deploy/linux's, unchanged: /usr/local/bin/allmyram and allmyram-warden link to the copies.
  • cloud-init's mounts module mounts the share from Lima's user-data. On a later boot it is an fstab mount unit, which allmyram-binaries requires (RequiresMountsFor=). On an instance's first boot cloud-init's network stage writes and mounts it, so the unit also runs after cloud-init-network.service.

The job data disk

  • A Lima disk named allmyram-data, which the runner creates blank in its Lima home (limactl disk create allmyram-data --size 100GiB --format raw, sparse on APFS) and attaches with format: false, mount: false. Lima keeps a disk apart from the instance, and limactl delete leaves it.
  • vz attaches it as the second virtio disk, vdb at PCI slot 7, with no serial; the image names it /dev/disk/by-path/pci-0000:00:07.0.
  • At every boot allmyram-data-makefs.service runs systemd-makefs xfs on it, which formats only a disk with no filesystem or other signature, and var-lib-allmyram-warden.mount mounts it at /var/lib/allmyram/warden before local-fs.target.
  • The warden requires the mount (RequiresMountsFor=): without the data disk it doesn't start.
  • XFS gives reflink clones (cp --reflink=always); ext4 has none.
  • Lima's own formatting (format: true) isn't used: Lima formats and mounts from cloud-final.service, after multi-user.target, by which time the warden would have started on the empty mount point.

Idle footprint

The footprint of the VM's Virtualization.framework process 90 s after limactl start returned, on warm boots, with 4 CPUs and 8 GiB, measured by check.sh or spike/lima_footprint.py idle --at 90. Experiment 24's image idled at 771–789 MB; that is the bar a change must not raise. Footprints vary by about 20 MB between boots of the same image.

Image Warm boots, MB at 90 s
Experiment 24's image (check.sh's red run) 777
Binaries copied from the share with install 814, 819, 805, 822, 822
Copied with dd nocache (kept) 788, 776, 793
systemd-networkd-wait-online.service masked (kept; userspace boot 2.4 s against 4.4 s) 785, 775, 765, 784
auditd, sysstat, systemd-cron and rng-tools5 in pkg.exclude (not kept: about 45 MB higher with 288 packages against 298; why wasn't looked into) 812, 836, 823, 826
Revision 1, with /usr/local/bin linked to the copies 783 before the links, 781 after
Revision 1 with a blank data disk attached and not mounted 785
Revision 2: the job data disk, XFS, mounted 792