refactor: rename to agentos, hand-picked /etc, user presets at first boot
os / os (push) Waiting to run

- Rename the image from agent to agentos (ImageId, hostname, CI, docs).
- mkosi.finalize only copies /etc to /usr/share/factory/etc. The hand-written
  tmpfiles.d/factory-etc.conf links the 24 entries the image needs.
- /etc/systemd is writable: PID 1 applies the system presets at first boot
  and preset-global.service the user presets, as in ParticleOS.
- claude-remote runs in the user manager of agent, enabled by a user preset.
- Root has no /var subvolume, and the verity partitions shrink to 16M.
- Style pass over comments, CLAUDE.md and AGENTS.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Job79andClaude Opus 5.5 committed 2026-11-22 15:48:42 +01:00
1 parent 186d133cbc
commit 1707500c05
25 files changed
+253 -249

No files matched your search

+57 -69
View File
@@ -1,12 +1,12 @@
# mkosi.conf builds a Fedora VM image that runs Claude Code in the background.
# /usr is read-only and replaced whole by updates. The root filesystem holds
# the state.
# 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, and links it into /etc at 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.
@@ -14,41 +14,61 @@
Distribution=fedora
Release=45
[Build]
# ToolsTree builds with mkosi's own Fedora tools, the same on every host,
# so the host needs only mkosi and git (for mkosi.version). The tools land in
# mkosi.tools/.
ToolsTree=yes
ToolsTreeRelease=%r
Incremental=yes
CacheDirectory=mkosi.cache
[Output]
Format=disk
ImageId=agent
# Output writes agentos_<version>.* 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_<version>.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 # It has no drivers or firmware VMs don't need.
systemd # It is the init and service manager.
dbus-broker # It is D-Bus, for the user manager and podman.
systemd-udev # It has udev, sysupdate, repart and cryptsetup.
systemd-networkd # It runs DHCP on every network card.
systemd-resolved # It resolves DNS names.
systemd-container # It has systemd-pull and gnupg2 for sysupdate.
systemd-boot-unsigned # It is the boot loader, which mkosi signs.
util-linux # It has login, for the console login.
shadow-utils # It has newuidmap for rootless podman.
systemd-pam # It gives logins a session and user manager.
openssh-server # It lets you log in once there is a key.
zram-generator-defaults # It sets up compressed swap in RAM.
podman # It runs Claude's tools in containers.
claude-code # It comes from mkosi.sandbox/etc/yum.repos.d.
git-core # It brings openssh-clients to push over ssh.
# The rest are basic command-line tools Claude uses on the host.
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
@@ -58,43 +78,19 @@ Packages=
findutils
procps-ng
iproute
WithDocs=no
Locale=C.UTF-8
# Hostname is agent- and four hex digits of the machine ID.
Hostname=agent-????
# UnifiedKernelImageFormat names the UKI in the ESP agent_<version>.efi, which
# matches the MatchPattern= of mkosi.extra/usr/lib/sysupdate.d/20-uki.transfer.
UnifiedKernelImageFormat=%i_%v
KernelCommandLine=
# The console shows on the serial port and the screen. The screen
# comes last, so systemd-firstboot asks for the root password there.
console=ttyS0,115200n8
console=tty0
quiet
# The initrd finds the root filesystem by its partition type
# (mkosi.extra/usr/lib/repart.d/50-root.conf) and mounts it writable.
rw
# 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.
systemd.image_policy=root=encrypted+absent:usr=verity:esp=unprotected
# The mount rate limit is raised from 5, which holds back mounts at
# boot and delays / and /usr by up to a second each.
systemd.setenv=SYSTEMD_REPART_MKFS_OPTIONS_BTRFS=--metadata=single
SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_BURST=50
# KernelInitrdModules are the modules 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.
KernelInitrdModules=
virtio_scsi
nvme
dm-verity
dm-crypt
erofs
# 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/*
@@ -109,31 +105,23 @@ KernelModules=
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. Without
# hwdb.d, systemd-hwdb-update can't build it again at boot.
RemoveFiles=
/usr/lib/modules/*/System.map
/usr/lib/udev/hwdb.bin
/usr/lib/udev/hwdb.d
[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).
# Validation signs the boot chain with mkosi.key, so the TPM unlocks the root
# filesystem only for our UKIs.
SecureBoot=yes
# SignExpectedPcr signs the PCR 11 values that each UKI will measure, with
# mkosi.key. The TPM then unlocks the root filesystem only for UKIs we signed,
# also after updates (mkosi.extra/usr/lib/repart.d/50-root.conf).
SignExpectedPcr=yes
[Runtime]
# Runtime sets up the test VM of mkosi vm.
# 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
QemuArgs=-serial chardev:console
Credentials=passwd.plaintext-password.root=root
KernelCommandLineExtra=systemd.firstboot=no