Seal /etc: read-only root with /etc and /usr, state on /var

The root filesystem (/etc and /usr) is now one read-only erofs partition behind dm-verity,
updated A/B as a whole, so /etc can no longer drift from the image (stale CA certificates,
frozen Fedora defaults). All state lives on a new /var partition, mounted by /etc/fstab.

What used to be written to /etc at runtime:
- machine ID: from the VM's firmware UUID (systemd.machine_id=firmware); /etc/machine-id is
  empty, so no boot counts as the first.
- root password: gitea-runner-setup writes a shadow file to /var/lib/shadow, which
  etc-shadow.mount puts over /etc/shadow.
- hostname and runner.env: runner.env moves to /var/lib/gitea-runner and holds the runner's
  name; gitea-runner.service sets it as the (transient) hostname, and DHCP no longer does.

Hosts installed before this change must be reinstalled: updates can't change the partition
layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V27snrGfdvwU7pMNBiDpHv
This commit is contained in:
Job79andClaude Opus 5.5 committed 2026-11-14 12:12:10 +01:00
1 parent c2ec9ddb29
commit b0a49de3e6
25 files changed
+96 -63

No files matched your search

+8 -6
View File
@@ -1,6 +1,8 @@
# git-runner: a Fedora VM image that runs the Gitea Actions runner, built with mkosi.
# mkosi.extra/ is copied to /, mkosi.repart/ defines the disk, mkosi.prepare adds the runner,
# mkosi.images/job/ is the job image.
# The root filesystem, /etc included, is read-only and replaced whole by updates; all state
# lives on /var.
[Config]
Dependencies=job
@@ -13,7 +15,7 @@ Release=45
Format=disk
ImageId=git-runner
OutputDirectory=mkosi.output
# The UKI and /usr partitions are published as updates (systemd-sysupdate).
# The UKI and root partitions are published as updates (systemd-sysupdate).
SplitArtifacts=uki,partitions
[Content]
@@ -47,13 +49,14 @@ WithDocs=no
Locale=C.UTF-8
# The UKI's file name in the ESP, as systemd-sysupdate names the ones it installs.
UnifiedKernelImageFormat=%i_%v
# A writable root, the console on screen and serial port, no systemd-firstboot questions
# (gitea-runner-setup asks its own), and KSPP hardening (the last four).
# The console on screen and serial port, the machine ID from the VM's firmware (/etc is read-only;
# mkosi.extra/etc/machine-id is empty, so no boot counts as the first), no systemd-firstboot
# questions (gitea-runner-setup asks its own), and KSPP hardening (the last four).
KernelCommandLine=
rw
console=tty0
console=ttyS0,115200n8
quiet
systemd.machine_id=firmware
systemd.firstboot=no
slab_nomerge
init_on_alloc=1
@@ -90,8 +93,7 @@ KernelModules=
ipvlan
# - System.map only for debugging the kernel
# - udev hwdb hardware names and quirks, nothing a VM needs
# - homed, userdbd, nsresourced unused services; removing their units also stops them
# on hosts installed before (/etc keeps them enabled)
# - homed, userdbd, nsresourced unused services
RemoveFiles=
/usr/lib/modules/*/System.map
/usr/lib/udev/hwdb.bin