# Agent image # # A Fedora VM image that runs Claude Code in the background. mkosi.extra/ is # copied to /, mkosi.repart/ defines the disk and mkosi.sandbox/ adds the # Claude Code package repository. The root filesystem, /etc included, is # read-only and replaced whole by updates. All state lives on /var. Claude # can't change the OS, so it runs its tools in containers. # mkosi.extra/etc/claude-code/ sets Claude Code up for that: # managed-settings.json lets it run without permission prompts, and CLAUDE.md # tells it about this machine. [Distribution] Distribution=fedora Release=45 [Output] Format=disk ImageId=agent OutputDirectory=mkosi.output SplitArtifacts=uki,partitions # ManifestFormat lists the packages and versions in the image, to tell which # builds a CVE affects. .gitea/workflows/os.yml publishes it with the image. ManifestFormat=json [Build] # PackageCacheDirectory keeps downloaded packages between builds, also when # mkosi runs in a throwaway container (AGENTS.md). dnf still installs the # newest versions. PackageCacheDirectory=mkosi.pkgcache [Content] Bootable=yes Bootloader=systemd-boot # Packages is systemd with its network services, plus: # - kernel-core has no drivers or firmware beyond what VMs need. # - systemd-container has systemd-pull, which systemd-sysupdate downloads with. # - gnupg2 checks the signature of updates. # - systemd-boot-unsigned is the boot loader, which mkosi signs. # - util-linux and shadow-utils give the console login, the setup and # newuidmap for rootless podman. # - systemd-pam gives login sessions: Claude's user manager and its D-Bus, # which rootless podman needs. # - openssh-server lets you log in with ssh keys. # - zram-generator-defaults sets up compressed swap in RAM. # - podman and podman-docker run Claude's toolchains in containers. # - claude-code comes from mkosi.sandbox/etc/yum.repos.d. # - git-core and openssh-clients let Claude Code use git and push over ssh. # - The rest are basic command-line tools Claude uses on the host. Packages= kernel-core systemd dbus-broker systemd-udev systemd-networkd systemd-resolved systemd-container gnupg2 systemd-boot-unsigned util-linux shadow-utils systemd-pam openssh-server zram-generator-defaults podman podman-docker claude-code git-core openssh-clients curl tar gzip xz zstd diffutils findutils procps-ng iproute WithDocs=no Locale=C.UTF-8 # UnifiedKernelImageFormat names UKIs the way systemd-sysupdate names the ones # it installs. UnifiedKernelImageFormat=%i_%v # KernelCommandLine sets: # - console= shows the console on the screen and on the serial port. # - systemd.machine_id=firmware takes the machine ID from the VM's firmware. # mkosi.extra/etc/machine-id is empty, so no boot counts as the first. # - systemd.firstboot=no leaves the questions to agent-setup. # - SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_BURST lets systemd handle more mount # changes per second. At the default of 5, it holds back mounts at boot and # delays / and /var by up to a second each. The kernel passes it to systemd # as environment. KernelCommandLine= console=tty0 console=ttyS0,115200n8 quiet systemd.machine_id=firmware systemd.firstboot=no SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_BURST=50 # KernelInitrdModules are the modules the initrd needs to find and mount the # disks of a VM. KernelInitrdModules= virtio_blk virtio_scsi sd_mod nvme dm-verity erofs ext4 # KernelModules keeps all modules but the hardware drivers, then the drivers a # VM needs (disks, network, screen) and those of rootless podman's networks # (pasta). The last matching line wins. Keyboard, USB and a basic screen are # built into the kernel. KernelModules= /* -/drivers/* /drivers/virtio/* /drivers/block/* /drivers/md/* nvme virtio_scsi sd_mod virtio_net qemu_fw_cfg bochs virtio-gpu veth tun # RemoveFiles drops what the image doesn't use: # - System.map is only for debugging the kernel. # - The udev hwdb holds hardware names and quirks, nothing a VM needs. # - homed, userdbd and nsresourced are unused services. # - sshd-keygen would write host keys to the read-only /etc. sshd uses one host # key on /var instead (mkosi.extra/etc/ssh/sshd_config.d). # - /afs is the mount point for the AFS network filesystem. # - /buildroot holds dnf's lock file, left by mkosi: it passes dnf5 # persistdir=/buildroot/var/lib/dnf and dnf5 puts the install root in front # of it again. RemoveFiles= /usr/lib/modules/*/System.map /usr/lib/udev/hwdb.bin /usr/lib/udev/hwdb.d /usr/lib/systemd/system/systemd-homed* /usr/lib/systemd/system/systemd-userdbd.* /usr/lib/systemd/system/systemd-nsresourced.* /usr/lib/systemd/system/sshd-keygen* /afs /buildroot [Validation] # SecureBoot signs systemd-boot and the UKI, and puts our keys on the ESP. # systemd-boot enrolls them at first boot if the firmware is in setup mode (no # keys enrolled; in Proxmox, an EFI disk without pre-enrolled keys). mkosi.key # is the SECUREBOOT_KEY secret, which .gitea/workflows/os.yml writes. SecureBoot=yes SecureBootKey=mkosi.key SecureBootCertificate=mkosi.crt [Runtime] # Runtime sets up the test VM of mkosi vm (AGENTS.md). Ephemeral boots a copy, # so test runs don't change the built image. Credentials answer the setup # (mkosi.extra/usr/libexec/agent-setup). mkosi ssh logs in as root with # mkosi.key, which mkosi also authorizes for root in the VM. Ephemeral=yes CPUs=4 RAM=8G RuntimeSize=40G # QemuArgs joins the serial port to the console mkosi vm shows (hvc0). The UKI # doesn't use hvc0: with Secure Boot, systemd-stub ignores the console= mkosi # passes. QemuArgs=-serial chardev:console Credentials=agent.password=root agent.hostname=agent-test