From fd174d9ff0132d6f291385875a5c1fbef9fa0a16 Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Fri, 1 Oct 2021 17:37:54 -0400 Subject: [PATCH] coreos-boot-edit: persist boot UUID in /run The new `boot` karg will only show up on the second boot and onwards. So for the first boot, let's persist it in `/run` to tell `coreos-boot-mount-generator` the UUID to use. --- .../lib/dracut/modules.d/35coreos-ignition/coreos-boot-edit.sh | 3 +++ .../lib/systemd/system-generators/coreos-boot-mount-generator | 3 +++ 2 files changed, 6 insertions(+) diff --git a/overlay.d/05core/usr/lib/dracut/modules.d/35coreos-ignition/coreos-boot-edit.sh b/overlay.d/05core/usr/lib/dracut/modules.d/35coreos-ignition/coreos-boot-edit.sh index 1f759b4599..4116f03217 100755 --- a/overlay.d/05core/usr/lib/dracut/modules.d/35coreos-ignition/coreos-boot-edit.sh +++ b/overlay.d/05core/usr/lib/dracut/modules.d/35coreos-ignition/coreos-boot-edit.sh @@ -45,4 +45,7 @@ if [ -z "${boot}" ]; then exit 1 fi rdcore kargs --boot-mount ${bootmnt} --append boot=UUID=${UUID} + # but also put it in /run for the first boot real root mount + mkdir -p /run/coreos + echo "${UUID}" > /run/coreos/bootfs_uuid fi diff --git a/overlay.d/05core/usr/lib/systemd/system-generators/coreos-boot-mount-generator b/overlay.d/05core/usr/lib/systemd/system-generators/coreos-boot-mount-generator index 43dfcd087d..5724fdcb26 100755 --- a/overlay.d/05core/usr/lib/systemd/system-generators/coreos-boot-mount-generator +++ b/overlay.d/05core/usr/lib/systemd/system-generators/coreos-boot-mount-generator @@ -102,6 +102,9 @@ elif [ -n "${bootkarg}" ]; then /dev/*) bootdev=$bootkarg;; *) echo "Unknown boot karg '${bootkarg}'; falling back to ${bootdev}";; esac +# This is used for the first boot only +elif [ -f /run/coreos/bootfs_uuid ]; then + bootdev=/dev/disk/by-uuid/$(cat /run/coreos/bootfs_uuid) fi # We mount read-only by default mostly to protect