Skip to content

Commit

Permalink
coreos-boot-edit: persist boot UUID in /run
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jlebon committed Oct 21, 2021
1 parent 7fb9df6 commit d1c79d7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions tests/kola/root-reprovision/luks/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ if ! grep prjquota <<< "${rootflags}"; then
fi
ok "root mounted with prjquota"

# while we're here, sanity-check that boot is mounted by UUID
if ! systemctl cat boot.mount | grep -q What=/dev/disk/by-uuid; then
systemctl cat boot.mount
fatal "boot mounted not by UUID"
fi
ok "boot mounted by UUID"

case "${AUTOPKGTEST_REBOOT_MARK:-}" in
"")
# check that ignition-ostree-growfs ran
Expand Down

0 comments on commit d1c79d7

Please sign in to comment.