# mkosi.conf builds agentos, a Fedora VM image that runs Claude Code. The # image holds a read-only /usr. The root filesystem, which holds the state, # is made at first boot. # # The other parts of the build: # - mkosi.extra/ is copied to /. # - mkosi.repart/ defines the disk image: the ESP and the /usr partitions. # - mkosi.extra/usr/lib/repart.d/ makes the root partition at first boot. # - mkosi.finalize keeps /etc in /usr/share/factory/etc. # - mkosi.sandbox/ adds the Claude Code package repository. # - mkosi.version gives each build its version. [Distribution] Distribution=fedora Release=45 [Output] # Output writes agentos_.* to mkosi.output/. The UKI and /usr # partitions are split into the files of an update. ImageId=agentos OutputDirectory=mkosi.output SplitArtifacts=uki,partitions ManifestFormat=json [Content] # Content sets what goes into the image: # - Hostname is agentos- and four hex digits of the machine ID. # - WithDocs leaves out man pages. The image has no man to read them. # - Packages lists the packages installed into the image. # - UnifiedKernelImageFormat names the UKI agentos_.efi, which matches # the MatchPattern= of mkosi.extra/usr/lib/sysupdate.d/20-uki.transfer. # - KernelCommandLine: # - rw has the initrd mount the root filesystem writable. It finds it by its # partition type (mkosi.extra/usr/lib/repart.d/50-root.conf). # - The image policy only accepts an encrypted root filesystem (or none, at # first boot) and a verity-checked /usr. Otherwise someone with the disk # could swap in a plain root filesystem. Our UKI would boot it, and their # code could unseal the key of the real one. # - The root btrfs keeps one copy of its metadata instead of two (DUP, # mkfs.btrfs's default). On a VM disk a second copy adds little. # - The mount rate limit is raised from 5, which holds back mounts at boot # and delays / and /usr by up to a second each. # - KernelInitrdModules are what the initrd needs to find the disks of a VM, # mount /usr and unlock the root filesystem. The kernel has virtio_blk, # sd_mod, the TPM drivers and btrfs built in. # - KernelModules keeps all modules but the hardware drivers, then adds back # the drivers a VM needs (disks, network, screen) and those of podman's # networks (veth, tun). The last matching line wins. Keyboard, USB and a # basic screen are built into the kernel. # - RemoveFiles drops System.map, which is only for debugging the kernel, and # the udev hwdb, which holds hardware names and quirks a VM doesn't need. # Without hwdb.d, systemd-hwdb-update can't build it again at boot. Hostname=agentos-???? WithDocs=no Packages= kernel-core # Unlike kernel, this has no extra drivers. systemd # The init and service manager is PID 1. dbus-broker # D-Bus serves the user manager and podman. systemd-udev # Udev, sysupdate, repart, cryptsetup are here. systemd-networkd # DHCP runs on every network card. systemd-resolved # DNS names are resolved here. systemd-container # Sysupdate needs its systemd-pull and gnupg2. systemd-boot-unsigned # mkosi signs this boot loader. util-linux # The console login needs its login. shadow-utils # Rootless podman needs its newuidmap. systemd-pam # Logins get a session and user manager. openssh-server # You can log in with ssh once there is a key. zram-generator-defaults # Swap is compressed in RAM. podman # Claude runs its tools in containers. claude-code # Its repo is mkosi.sandbox/etc/yum.repos.d. git-core # Git pushes over ssh. curl tar gzip xz zstd diffutils findutils procps-ng iproute UnifiedKernelImageFormat=%i_%v KernelCommandLine= quiet rw systemd.image_policy=root=encrypted+absent:usr=verity:esp=unprotected systemd.setenv=SYSTEMD_REPART_MKFS_OPTIONS_BTRFS=--metadata=single SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_BURST=50 KernelInitrdModules= virtio_scsi nvme dm-verity dm-crypt erofs KernelModules= /* -/drivers/* /drivers/virtio/* /drivers/block/* /drivers/md/* nvme virtio_scsi virtio_net qemu_fw_cfg bochs virtio-gpu veth tun RemoveFiles= /usr/lib/modules/*/System.map /usr/lib/udev/hwdb.bin /usr/lib/udev/hwdb.d [Validation] # Validation signs the boot chain with mkosi.key, so the TPM unlocks the root # filesystem only for our UKIs. SecureBoot=yes SignExpectedPcr=yes [Runtime] # Runtime sets up the test VM of mkosi vm. Each run boots a fresh copy, with # root password root and no first boot questions. Ephemeral=yes CPUs=4 RAM=4G RuntimeSize=40G Credentials=passwd.plaintext-password.root=root KernelCommandLineExtra=systemd.firstboot=no