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:
25 files changed
+96
-63
No files matched your search
@@ -6,3 +6,7 @@ Kind=!*
|
||||
|
||||
[Network]
|
||||
DHCP=yes
|
||||
|
||||
[DHCPv4]
|
||||
# The hostname is the runner's name (gitea-runner.service), not the DHCP server's.
|
||||
UseHostname=no
|
||||
@@ -4,6 +4,7 @@ enable systemd-resolved.service
|
||||
enable nftables.service
|
||||
enable podman.socket
|
||||
enable gitea-runner-setup.service
|
||||
enable etc-shadow.mount
|
||||
enable gitea-runner.service
|
||||
enable systemd-sysupdate-update.timer
|
||||
enable systemd-sysupdate-reboot.timer
|
||||
@@ -0,0 +1,14 @@
|
||||
# The root password. /etc is read-only, so gitea-runner-setup writes the shadow file to /var and
|
||||
# this mounts it over /etc/shadow.
|
||||
[Unit]
|
||||
Description=Root password from /var
|
||||
ConditionPathExists=/var/lib/shadow/etc/shadow
|
||||
RequiresMountsFor=/var
|
||||
|
||||
[Mount]
|
||||
What=/var/lib/shadow/etc/shadow
|
||||
Where=/etc/shadow
|
||||
Options=bind
|
||||
|
||||
[Install]
|
||||
WantedBy=local-fs.target
|
||||
@@ -1,7 +1,7 @@
|
||||
# First boot: asks for the root password and the runner's registration on the console (tty1).
|
||||
[Unit]
|
||||
Description=Gitea runner first-boot setup
|
||||
ConditionPathExists=!/etc/gitea-runner/runner.env
|
||||
ConditionPathExists=!/var/lib/gitea-runner/runner.env
|
||||
Before=getty@tty1.service kmsconvt@tty1.service
|
||||
|
||||
[Service]
|
||||
|
||||
@@ -11,8 +11,10 @@ Requires=podman.socket
|
||||
# never get the socket (see config.yaml).
|
||||
User=gitea-runner
|
||||
WorkingDirectory=/var/lib/gitea-runner
|
||||
EnvironmentFile=/etc/gitea-runner/runner.env
|
||||
EnvironmentFile=/var/lib/gitea-runner/runner.env
|
||||
Environment=DOCKER_HOST=unix:///run/podman/podman.sock
|
||||
# The hostname is the runner's name. /etc is read-only, so it is set on every start (as root: +).
|
||||
ExecStartPre=+/usr/bin/hostnamectl hostname --transient ${GITEA_RUNNER_NAME}
|
||||
# Register once; the result is kept in .runner.
|
||||
ExecStartPre=/bin/sh -c '[ -f .runner ] || exec gitea-runner register --no-interactive --config /usr/lib/gitea-runner/config.yaml --instance "$GITEA_INSTANCE_URL"'
|
||||
ExecStart=/usr/bin/gitea-runner daemon --config /usr/lib/gitea-runner/config.yaml
|
||||
|
||||
Reference in new issue
Block a user