metropolis: implement A/B updates
This implements an A/B update mechanism using two slots, A and B.
This is realized with two system partitions as well as two EFI
loaders/kernels.
The A/B system relies on two EFI loader entries. This has the advantage
that there is no preloader required, which makes the system more
reliable as well as avoiding the complexity of having an un-updatable
preloader (CoreOS has this issue where their GRUB2 crashed booting newer
kernels, sadly the issue seems lost with the migration to Fedora
CoreOS). It also means that the operator can easily override the slot
being booted via the boot loader entries. Primary disadvantage is that
it relies on EFI working somewhat to spec.
New versions are booted into only once by setting NextBoot, if the
bootup doesn't succeed, i.e. if the boot doesn't get to a cluster rejoin
the next boot will be the old slot. Once it gets to this stage the
permanent BootOrder is changed.
The EFI loaders don't know if they are slot A or B because they are
identical and relying on OptionalData in the boot entry to indicate the
slot means that if the EFI boot entries go away, recovering is very hard.
Thus the loaders look at their own file name to determine what slot they
are in. If no slot could be determined, they default to booting slot A.
It is planned to eventually use Authenticode Stamping (passing data in
fake certificates) to stamp the slot into the loader without affecting
the TPM hash logged.
Change-Id: I40de2df8ff7ff660c17d2c97f3d9eb1bd4ddf5bc
Reviewed-on: https://review.monogon.dev/c/monogon/+/1874
Tested-by: Jenkins CI
Reviewed-by: Serge Bazanski <serge@monogon.tech>
diff --git a/cloud/agent/e2e/main_test.go b/cloud/agent/e2e/main_test.go
index 100553e..27bcd03 100644
--- a/cloud/agent/e2e/main_test.go
+++ b/cloud/agent/e2e/main_test.go
@@ -166,8 +166,8 @@
t.Fatal(err)
}
defer os.Remove(rootDisk.Name())
- // Create a 5GiB sparse root disk
- if err := unix.Ftruncate(int(rootDisk.Fd()), 5*GiB); err != nil {
+ // Create a 10GiB sparse root disk
+ if err := unix.Ftruncate(int(rootDisk.Fd()), 10*GiB); err != nil {
t.Fatalf("ftruncate failed: %v", err)
}
diff --git a/cloud/agent/install.go b/cloud/agent/install.go
index 3468cc9..c8583ac 100644
--- a/cloud/agent/install.go
+++ b/cloud/agent/install.go
@@ -128,7 +128,7 @@
installParams := osimage.Params{
PartitionSize: osimage.PartitionSizeInfo{
- ESP: 128,
+ ESP: 384,
System: 4096,
Data: 128,
},