Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coreos-boot-edit: run rdcore bind-boot #1316

Merged
merged 1 commit into from
Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,12 @@ if [ -z "${root}" ]; then
rdcore rootmap /sysroot --boot-mount ${bootmnt}
fi

# And similarly, only inject boot= if it's not already present.
boot=$(karg boot)
if [ -z "${boot}" ]; then
# XXX: `rdcore rootmap --inject-boot-karg` or maybe `rdcore bootmap`
eval $(blkid -o export "${bootdev}")
if [ -z "${UUID}" ]; then
# This should never happen
echo "Boot filesystem ${bootdev} has no UUID" >&2
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
# This does a few things:
# 1. it puts the boot UUID in /run/coreos/bootfs_uuid which is used by the real
# root for mounting the bootfs in this boot
# 2. it adds a boot=UUID= karg which is used by the real root for mounting the
# bootfs in subsequent boots
# 3. it create a .root_uuid stamp file on the bootfs or fails if one exists
# 4. it adds GRUB bootuuid.cfg dropins so that GRUB selects the boot filesystem
# by UUID
rdcore bind-boot /sysroot ${bootmnt}
bgilbert marked this conversation as resolved.
Show resolved Hide resolved
15 changes: 13 additions & 2 deletions tests/kola/reboot/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ if ! systemctl cat boot.mount | grep -q What=/dev/disk/by-uuid; then
fi
ok "boot mounted by UUID"

# check that we took ownership of the bootfs
[ -f /boot/.root_uuid ]

# check for the UUID dropins
[ -f /boot/grub2/bootuuid.cfg ]
mount -o ro /dev/disk/by-label/EFI-SYSTEM /boot/efi
[ -f /boot/efi/EFI/*/bootuuid.cfg ]
umount /boot/efi

case "${AUTOPKGTEST_REBOOT_MARK:-}" in
"")
ok "first boot"
Expand All @@ -35,10 +44,12 @@ case "${AUTOPKGTEST_REBOOT_MARK:-}" in

rebooted)
# check for expected default kargs
grep root=UUID= /proc/cmdline
grep root=UUID=$(cat /boot/.root_uuid) /proc/cmdline
ok "found root karg"

grep boot=UUID= /proc/cmdline
bootsrc=$(findmnt -nvr /boot -o SOURCE)
eval $(blkid -o export "${bootsrc}")
grep boot=UUID=${UUID} /proc/cmdline
ok "found boot karg"

ok "second boot"
Expand Down