What a build VM downloads failed on a network's first hiccup: curl's --retry 3 skips a connection cut mid-transfer (exit 18) and waits for ever on a stall, apt's retries were off, and oh-my-bash's clone had none. - devvm-fetch: each try has --connect-timeout 20 and a stall limit (--speed-limit 1024 --speed-time 30), and any failure is tried again, five tries in all, from where it stopped (-C -): curl's own --retry, --retry-all-errors included, starts again from nothing (measured on curl 8.7). A server that can't resume (33, 36) starts it again; a file that came whole and checks out ends the loop; a file that doesn't check out is fetched again from nothing once, as a resume may have joined two versions. A redirect goes only to https (--proto-redir =https), so no try or resume moves to plain http. TestDevvmFetchTries runs it against a server that cuts, ignores ranges, changes the file, fails and redirects to http. - apt.sh: package lists still fail fast (exit 75 when no source answers), and once they're in, the build's installs get Acquire::Retries "3", with apt's own backoff. - crane (oci/build.sh, the --from conversion, which has no devvm-fetch): --retry 5 --retry-all-errors --retry-delay 2 and the same timeouts. - oh-my-bash: the clone is tried five times in all, with git's low-speed limit. Docs: images.md's Building and Base's packages, customizing.md's devvm-fetch; the CHANGELOG's second highlight, which says which downloads resume, and What to do 1, which names the layers and --from bases that rebuild and pull again; the release page's A first run on a bad network. Image keys change: base's (base.sh, apt.sh, omb.sh), every layer's (apt.sh is in each), and a --from conversion's (oci/build.sh). Tool images' keys don't (shared-tools/build.sh is unchanged). Co-Authored-By: Claude Opus 5.5 <[email protected]>
oci
These scripts turn a container image into a disk that Lima boots directly, for --from (Starting from a container image). devvm runs them in a throwaway VM booted from Ubuntu's cloud image, so the conversion doesn't need Docker.
| File | What |
|---|---|
build.sh |
runs in the build VM as root: crane pulls the image and flattens its layers, bootify.sh runs in a chroot of it, and mke2fs writes the disk. Writes the kernel, initramfs and disk Lima boots, the kernel command line, the image's libc (which builds of the shared tools its VMs get) and, for glibc, its version (which the shared tools' needs are checked against). When the build VM trusts your company's CAs, it's given guest/ca.sh, which it runs in the chroot so bootify.sh's downloads trust them too, and runs again afterwards so the image keeps none of them |
bootify.sh |
in the chroot, for Debian, Ubuntu or Alpine: adds a kernel and initramfs, an init system, cloud-init, sshd and sudo, and pre-creates the Lima guest user, after removing an image's user that has its uid (Ubuntu's ubuntu, 1000) |
kernel.sh |
on arm64, turns a distro's vmlinuz into the uncompressed Image Lima's vz needs; elsewhere it copies it as is |
try.sh OUTDIR NAME |
boots a converted image as a throwaway Lima VM and runs the checks devvm relies on: init system, cloud-init, user, sudo, a writable host mount and port forwarding. macOS only (vz). The VM is left running: limactl delete -f NAME |
As in every image script, the downloads are pinned at the top of build.sh with their version and checksum. build.sh checks them with sha256sum, because the build VM has no devvm-fetch. devvm puts its prelude, assets/prelude.sh, before build.sh in the copy it gives the build VM, and build.sh takes its architecture and each pinned checksum from it ($devvm_arch, devvm_sha).
The container image's own code runs as root in the build VM, so devvm treats everything it writes as hostile. The build VM gets only a vm/ subfolder of devvm's temp folder, and build.sh, bootify.sh and kernel.sh read-only, which are the scripts base's key hashes. devvm checks what the build VM wrote only once the build VM is deleted. It refuses outputs that aren't regular files, because a symlink could point Lima at a host file. It also refuses a libc other than gnu or musl, a glibc version that isn't two numbers such as 2.36, and a kernel command line with anything but letters, digits, spaces and =,./:_-.
Gotchas
- Delete
/.dockerenv, or cloud-init thinks it's in a container. hosts,hostnameandresolv.confare only placeholders in Docker images.- Debian kernels need the virtio drivers listed for the initramfs.
- Container images have empty apt lists:
layers/apt.sh beginfetches them from the image's own sources beforebase.shruns. bootify.shruns in a chroot inside a running VM: apt there would start services, sobuild.shadds apolicy-rc.dwhile it runs.- The build VM is a fresh cloud image: its first boot may run apt (unattended-upgrades), so
build.shuses no apt itself.