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 26, 2021
1 parent 09a2b1f commit 89066d5
Show file tree
Hide file tree
Showing 4 changed files with 20 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/misc-ro
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,10 @@ if find ${tmpd}/usr/{bin,sbin,libexec} ! -perm -0111 | grep -v clevis-luks-commo
fi
rm -r ${tmpd}
ok "All initrd scripts are executable"

# 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"
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 89066d5

Please sign in to comment.