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
@@ -0,0 +1,15 @@
|
||||
# The root filesystem, slot A: /etc and /usr, read-only erofs protected by dm-verity (roothash= in
|
||||
# the UKI). Updates replace it whole. /var, the state, is its own partition (30-var.conf).
|
||||
[Partition]
|
||||
Type=root
|
||||
Label=%M_%A
|
||||
Format=erofs
|
||||
Compression=zstd
|
||||
CopyFiles=/
|
||||
ExcludeFilesTarget=/var/
|
||||
Verity=data
|
||||
VerityMatchKey=root
|
||||
SizeMinBytes=1G
|
||||
SizeMaxBytes=1G
|
||||
# The file name holds the partition UUID, which roothash= finds the root by; updates keep it (@u in sysupdate.d).
|
||||
SplitName=%t.%U
|
||||
@@ -1,13 +0,0 @@
|
||||
# /usr, slot A: read-only erofs, protected by dm-verity (usrhash= in the UKI).
|
||||
[Partition]
|
||||
Type=usr
|
||||
Label=%M_%A
|
||||
Format=erofs
|
||||
Compression=zstd
|
||||
CopyFiles=/usr:/
|
||||
Verity=data
|
||||
VerityMatchKey=usr
|
||||
SizeMinBytes=1G
|
||||
SizeMaxBytes=1G
|
||||
# The file name holds the partition UUID, which usrhash= finds /usr by; updates keep it (@u in sysupdate.d).
|
||||
SplitName=%t.%U
|
||||
@@ -1,9 +1,9 @@
|
||||
# dm-verity hashes of /usr, slot A.
|
||||
# dm-verity hashes of the root filesystem, slot A.
|
||||
[Partition]
|
||||
Type=usr-verity
|
||||
Type=root-verity
|
||||
Label=%M_%A_verity
|
||||
Verity=hash
|
||||
VerityMatchKey=usr
|
||||
VerityMatchKey=root
|
||||
SizeMinBytes=64M
|
||||
SizeMaxBytes=64M
|
||||
SplitName=%t.%U
|
||||
@@ -0,0 +1,7 @@
|
||||
# The root filesystem, slot B: empty until systemd-sysupdate writes the next version.
|
||||
[Partition]
|
||||
Type=root
|
||||
Label=_empty
|
||||
SizeMinBytes=1G
|
||||
SizeMaxBytes=1G
|
||||
SplitName=-
|
||||
@@ -1,7 +0,0 @@
|
||||
# /usr, slot B: empty until systemd-sysupdate writes the next version.
|
||||
[Partition]
|
||||
Type=usr
|
||||
Label=_empty
|
||||
SizeMinBytes=1G
|
||||
SizeMaxBytes=1G
|
||||
SplitName=-
|
||||
@@ -1,6 +1,6 @@
|
||||
# dm-verity hashes of /usr, slot B.
|
||||
# dm-verity hashes of the root filesystem, slot B.
|
||||
[Partition]
|
||||
Type=usr-verity
|
||||
Type=root-verity
|
||||
Label=_empty
|
||||
SizeMinBytes=64M
|
||||
SizeMaxBytes=64M
|
||||
@@ -1,8 +0,0 @@
|
||||
# The root filesystem: /etc and /var, kept across updates. Grows to fill the disk at boot.
|
||||
[Partition]
|
||||
Type=root
|
||||
Format=ext4
|
||||
CopyFiles=/
|
||||
ExcludeFilesTarget=/usr/
|
||||
Minimize=guess
|
||||
GrowFileSystem=yes
|
||||
@@ -0,0 +1,9 @@
|
||||
# /var: the state that updates keep (the runner's registration, the root password, logs, base
|
||||
# images). Mounted by /etc/fstab, which also grows it to fill the disk at boot.
|
||||
[Partition]
|
||||
Type=var
|
||||
Label=var
|
||||
Format=ext4
|
||||
CopyFiles=/var:/
|
||||
Minimize=guess
|
||||
SplitName=-
|
||||
Reference in new issue
Block a user