Skip to content

Commit bc4f90f

Browse files
committed
kickstart: Fix multi-ESP install and GRUB boot on RAID 1
Three issues prevented a successful Anaconda-based bootc install onto a RAID 1 array with per-disk ESP partitions: 1. Bind mount failure during ostreecontainer payload install: Anaconda mounts the root FS at /mnt/sysimage and then tries to bind-mount /mnt/sysimage/boot/efi2 and /boot/efi3 into /mnt/sysroot. However, it does not create the mount point directories for the secondary ESPs before the bind mount, causing: mount: /mnt/sysroot/boot/efi2: special device /mnt/sysimage/boot/efi2 does not exist. Fix: add a %pre-install script that creates the directories after the root FS is mounted but before the payload runs. 2. Empty secondary ESPs after installation: Anaconda only installs the bootloader (shim, GRUB, grub.cfg) to the primary ESP at /boot/efi. The secondary ESPs (efi2, efi3) are formatted and mounted but receive no bootloader files. Additionally, the 'noauto' fsoption causes Anaconda to unmount them before %post. Fix: add a %post --nochroot script that explicitly mounts each secondary ESP by device path and copies the full EFI directory tree from the primary ESP. 3. GRUB cannot find the kernel on the RAID root filesystem: The GRUB EFI binary shipped with CentOS Stream 10 does not include the mdraid1x module. GRUB's grub.cfg uses 'search --fs-uuid' to locate the root filesystem and load the kernel from the ostree deployment path, but it cannot access the md array. Fix: add a separate /boot partition (ext4, 1G) on the primary disk. GRUB can read ext4 natively without mdraid support. The kernel and initramfs live on /boot, and the initramfs handles RAID assembly for the root filesystem during boot. Note: /boot is only on vda (not mirrored), so only disk 1 can boot independently. Full boot redundancy from any disk would require either whole-disk RAID (where GRUB reads from the raw mirror) or a GRUB build with mdraid1x support. This is a known limitation tracked in: - bootc-dev/bootc#1911 - coreos/bootupd#1077
1 parent e4fb36b commit bc4f90f

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

kickstart.cfg.in

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ part /boot/efi --fstype=efi --size=600 --ondisk=vda
1212
part /boot/efi2 --fstype=efi --size=600 --ondisk=vdb --fsoptions="noauto"
1313
part /boot/efi3 --fstype=efi --size=600 --ondisk=vdc --fsoptions="noauto"
1414

15+
part /boot --fstype=ext4 --size=1024 --ondisk=vda
16+
1517
part raid.01 --size=1 --grow --ondisk=vda
1618
part raid.02 --size=1 --grow --ondisk=vdb
1719
part raid.03 --size=1 --grow --ondisk=vdc
@@ -21,3 +23,38 @@ raid / --device=md0 --fstype=xfs --level=1 raid.01 raid.02 raid.03
2123
ostreecontainer --no-signature-verification --url=@@IMAGE_URL@@
2224

2325
poweroff
26+
27+
%pre-install
28+
# Create mount point directories for the extra ESPs.
29+
# Anaconda mounts the root FS at /mnt/sysimage before payload install,
30+
# but may not create subdirectory mount points for non-primary ESPs.
31+
mkdir -p /mnt/sysimage/boot/efi2
32+
mkdir -p /mnt/sysimage/boot/efi3
33+
%end
34+
35+
%post --nochroot --log=/mnt/sysimage/var/log/ks-post-esp-copy.log
36+
# Replicate the bootloader files from the primary ESP to the extra ESPs.
37+
# Anaconda only installs the bootloader on the primary /boot/efi; the
38+
# secondary ESPs need identical content for redundancy.
39+
#
40+
# The extra ESPs have fsoptions="noauto" so Anaconda unmounts them before
41+
# %post runs. We mount them explicitly by device path here.
42+
set -euxo pipefail
43+
44+
PRIMARY="/mnt/sysimage/boot/efi"
45+
46+
# vdb1 = efi2, vdc1 = efi3
47+
EXTRA_DEVS="/dev/vdb1 /dev/vdc1"
48+
49+
for dev in $EXTRA_DEVS; do
50+
mnt=$(mktemp -d /tmp/esp-copy.XXXXXX)
51+
echo "==> Mounting ${dev} at ${mnt}"
52+
mount "$dev" "$mnt"
53+
echo "==> Copying EFI content from ${PRIMARY} to ${mnt}"
54+
cp -a "${PRIMARY}/." "${mnt}/"
55+
echo "==> Contents of ${dev}:"
56+
ls -R "$mnt"
57+
umount "$mnt"
58+
rmdir "$mnt"
59+
done
60+
%end

0 commit comments

Comments
 (0)