2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-09-05 04:27:55 +00:00

feat(xCAT-server): kickstart EL10 riscv64 nodes around the anaconda boot loader gap

The EL10 anaconda has no RISC-V EFI platform: on riscv64 it asks for the
x86 UEFI boot loader packages (grub2-efi-x64, shim-x64), which do not
exist, and registers the UEFI boot entry as \EFI\<distro>\shimx64.efi,
so a kickstart install stops at the missing packages and, once tolerated,
leaves a system the firmware cannot boot.

Add riscv64 templates for the rocky10/rhels10 compute and service
profiles that are the shared templates plus %packages --ignoremissing and
a %post fix-up, riscv64 package lists that add grub2-efi-riscv64 and
efibootmgr to the shared lists, and the fix-up itself
(post.rhels10.riscv64): it copies \EFI\<distro>\grubriscv64.efi to the
removable-media path \EFI\BOOT\BOOTRISCV64.EFI and re-points the UEFI
boot entry at grubriscv64.efi, so the installed node boots from disk with
or without usable NVRAM. Reinstalling a node replaces that entry instead
of adding another one.

The %post of a kickstart is a single shell script, into which xCAT
splices every #INCLUDE, and post.rhels10/post.rhels8 end it with
"exit 0"; the fix-up is therefore included ahead of them. The shared
templates and other architectures are unchanged.
This commit is contained in:
Vinícius Ferrão
2026-08-20 19:43:11 -03:00
parent df712ee153
commit bef5bd5eef
9 changed files with 403 additions and 0 deletions
@@ -0,0 +1,16 @@
@Minimal Install
kernel
chrony
net-tools
nfs-utils
openssh-server
openssl
rsync
util-linux
wget
python3
tar
bzip2
perl-interpreter
grub2-efi-riscv64
efibootmgr
@@ -0,0 +1,70 @@
# Use text install
text
# Use network installation
%include /tmp/repos
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8
# Network information
#KICKSTARTNET#
# Root password
rootpw --iscrypted #CRYPT:passwd:key=system,username=root:password#
# Not run the Setup Agent on first boot
firstboot --disable
# Do not configure the X Window System
skipx
# System services
#services --enabled="chronyd"
# System timezone
timezone #TABLE:site:key=timezone:value# --utc
# Partition clearing information
zerombr
clearpart --all --initlabel
#XCAT_PARTITION_START#
%include /tmp/partitionfile
#XCAT_PARTITION_END#
# Do not configure any iptables rules
firewall --disable
selinux --disable
reboot
# riscv64: the EL10 anaconda has no RISC-V EFI platform and always asks for the
# x86 UEFI boot loader packages (grub2-efi-x64, shim-x64), which do not exist
# for riscv64; tolerate that. The riscv64 package list pulls grub2-efi-riscv64
# and efibootmgr in explicitly.
%packages --ignoremissing
#INCLUDE_DEFAULT_PKGLIST#
%end
%pre
{
echo "Running Kickstart Pre-installation script..."
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.rhels10#
} &>>/tmp/pre-install.log
%end
%post --interpreter=/bin/bash
mkdir -p /var/log/xcat/
cat /tmp/pre-install.log >>/var/log/xcat/xcat.log
{
echo "Running Kickstart Post-installation script..."
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.xcat.rhels10#
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.rhels10.riscv64#
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.rhels10#
} &>>/var/log/xcat/xcat.log
%end
# --ignoremissing above also hides a missing grub2-efi-riscv64, which would leave the
# node with no boot loader at all. Fail the installation instead of rebooting into
# firmware that has nothing to load.
%post --erroronfail --interpreter=/bin/bash
if [ ! -f /boot/efi/EFI/BOOT/BOOTRISCV64.EFI ] &&
! ls /boot/efi/EFI/*/grubriscv64.efi >/dev/null 2>&1; then
echo "riscv64: no grub2 UEFI boot loader on the ESP; grub2-efi-riscv64 is missing" \
>>/var/log/xcat/xcat.log
exit 1
fi
%end
@@ -0,0 +1,21 @@
@Minimal Install
kernel
chrony
net-tools
nfs-utils
openssh-server
openssl
rsync
util-linux
wget
mariadb-connector-odbc
perl-DBD-MySQL
perl-DBD-Pg
unixODBC
python3
tar
bzip2
perl-interpreter
perl-lib
grub2-efi-riscv64
efibootmgr
@@ -0,0 +1,70 @@
# Use text install
text
# Use network installation
%include /tmp/repos
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8
# Network information
#KICKSTARTNET#
# Root password
rootpw --iscrypted #CRYPT:passwd:key=system,username=root:password#
# Not run the Setup Agent on first boot
firstboot --disable
# Do not configure the X Window System
skipx
# System services
#services --enabled="chronyd"
# System timezone
timezone #TABLE:site:key=timezone:value# --utc
# Partition clearing information
zerombr
clearpart --all --initlabel
#XCAT_PARTITION_START#
%include /tmp/partitionfile
#XCAT_PARTITION_END#
# Do not configure any iptables rules
firewall --disable
selinux --disable
reboot
# riscv64: the EL10 anaconda has no RISC-V EFI platform and always asks for the
# x86 UEFI boot loader packages (grub2-efi-x64, shim-x64), which do not exist
# for riscv64; tolerate that. The riscv64 package list pulls grub2-efi-riscv64
# and efibootmgr in explicitly.
%packages --ignoremissing
#INCLUDE_DEFAULT_PKGLIST#
%end
%pre
{
echo "Running Kickstart Pre-installation script..."
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.rhels10#
} &>>/tmp/pre-install.log
%end
%post --interpreter=/bin/bash
mkdir -p /var/log/xcat/
cat /tmp/pre-install.log >>/var/log/xcat/xcat.log
{
echo "Running Kickstart Post-installation script..."
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.xcat.rhels10#
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.rhels10.riscv64#
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.rhels10#
} &>>/var/log/xcat/xcat.log
%end
# --ignoremissing above also hides a missing grub2-efi-riscv64, which would leave the
# node with no boot loader at all. Fail the installation instead of rebooting into
# firmware that has nothing to load.
%post --erroronfail --interpreter=/bin/bash
if [ ! -f /boot/efi/EFI/BOOT/BOOTRISCV64.EFI ] &&
! ls /boot/efi/EFI/*/grubriscv64.efi >/dev/null 2>&1; then
echo "riscv64: no grub2 UEFI boot loader on the ESP; grub2-efi-riscv64 is missing" \
>>/var/log/xcat/xcat.log
exit 1
fi
%end
@@ -0,0 +1,16 @@
@Minimal Install
kernel
chrony
net-tools
nfs-utils
openssh-server
openssl
rsync
util-linux
wget
python3
tar
bzip2
perl-interpreter
grub2-efi-riscv64
efibootmgr
@@ -0,0 +1,70 @@
# Use text install
text
# Use network installation
%include /tmp/repos
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8
# Network information
#KICKSTARTNET#
# Root password
rootpw --iscrypted #CRYPT:passwd:key=system,username=root:password#
# Not run the Setup Agent on first boot
firstboot --disable
# Do not configure the X Window System
skipx
# System services
#services --enabled="chronyd"
# System timezone
timezone #TABLE:site:key=timezone:value# --utc
# Partition clearing information
zerombr
clearpart --all --initlabel
#XCAT_PARTITION_START#
%include /tmp/partitionfile
#XCAT_PARTITION_END#
# Do not configure any iptables rules
firewall --disable
selinux --disable
reboot
# riscv64: the EL10 anaconda has no RISC-V EFI platform and always asks for the
# x86 UEFI boot loader packages (grub2-efi-x64, shim-x64), which do not exist
# for riscv64; tolerate that. The riscv64 package list pulls grub2-efi-riscv64
# and efibootmgr in explicitly.
%packages --ignoremissing
#INCLUDE_DEFAULT_PKGLIST#
%end
%pre
{
echo "Running Kickstart Pre-installation script..."
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.rhels10#
} &>>/tmp/pre-install.log
%end
%post --interpreter=/bin/bash
mkdir -p /var/log/xcat/
cat /tmp/pre-install.log >>/var/log/xcat/xcat.log
{
echo "Running Kickstart Post-installation script..."
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.xcat.rhels10#
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.rhels10.riscv64#
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.rhels10#
} &>>/var/log/xcat/xcat.log
%end
# --ignoremissing above also hides a missing grub2-efi-riscv64, which would leave the
# node with no boot loader at all. Fail the installation instead of rebooting into
# firmware that has nothing to load.
%post --erroronfail --interpreter=/bin/bash
if [ ! -f /boot/efi/EFI/BOOT/BOOTRISCV64.EFI ] &&
! ls /boot/efi/EFI/*/grubriscv64.efi >/dev/null 2>&1; then
echo "riscv64: no grub2 UEFI boot loader on the ESP; grub2-efi-riscv64 is missing" \
>>/var/log/xcat/xcat.log
exit 1
fi
%end
@@ -0,0 +1,19 @@
@^minimal-environment
chrony
net-tools
nfs-utils
openssh-server
rsync
util-linux
wget
mariadb-connector-odbc
perl-DBD-MySQL
perl-DBD-Pg
unixODBC
python3
tar
bzip2
perl-interpreter
perl-lib
grub2-efi-riscv64
efibootmgr
@@ -0,0 +1,70 @@
# Use text install
text
# Use network installation
%include /tmp/repos
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8
# Network information
#KICKSTARTNET#
# Root password
rootpw --iscrypted #CRYPT:passwd:key=system,username=root:password#
# Not run the Setup Agent on first boot
firstboot --disable
# Do not configure the X Window System
skipx
# System services
#services --enabled="chronyd"
# System timezone
timezone #TABLE:site:key=timezone:value# --utc
# Partition clearing information
zerombr
clearpart --all --initlabel
#XCAT_PARTITION_START#
%include /tmp/partitionfile
#XCAT_PARTITION_END#
# Do not configure any iptables rules
firewall --disable
selinux --disable
reboot
# riscv64: the EL10 anaconda has no RISC-V EFI platform and always asks for the
# x86 UEFI boot loader packages (grub2-efi-x64, shim-x64), which do not exist
# for riscv64; tolerate that. The riscv64 package list pulls grub2-efi-riscv64
# and efibootmgr in explicitly.
%packages --ignoremissing
#INCLUDE_DEFAULT_PKGLIST#
%end
%pre
{
echo "Running Kickstart Pre-installation script..."
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.rhels8#
} &>>/tmp/pre-install.log
%end
%post --interpreter=/bin/bash
mkdir -p /var/log/xcat/
cat /tmp/pre-install.log >>/var/log/xcat/xcat.log
{
echo "Running Kickstart Post-installation script..."
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.xcat.ng#
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.rhels10.riscv64#
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.rhels8#
} &>>/var/log/xcat/xcat.log
%end
# --ignoremissing above also hides a missing grub2-efi-riscv64, which would leave the
# node with no boot loader at all. Fail the installation instead of rebooting into
# firmware that has nothing to load.
%post --erroronfail --interpreter=/bin/bash
if [ ! -f /boot/efi/EFI/BOOT/BOOTRISCV64.EFI ] &&
! ls /boot/efi/EFI/*/grubriscv64.efi >/dev/null 2>&1; then
echo "riscv64: no grub2 UEFI boot loader on the ESP; grub2-efi-riscv64 is missing" \
>>/var/log/xcat/xcat.log
exit 1
fi
%end
@@ -0,0 +1,51 @@
# riscv64 UEFI boot entry fix-up for EL10 kickstart installs.
#
# The EL10 anaconda has no RISC-V EFI platform: it asks for the x86 boot
# loader packages (grub2-efi-x64, shim-x64; tolerated with --ignoremissing)
# and registers the UEFI boot entry as \EFI\<distro>\shimx64.efi, which does
# not exist on riscv64, so the firmware cannot boot the installed system.
# grub2-efi-riscv64 (from the riscv64 package list) provides
# \EFI\<distro>\grubriscv64.efi and anaconda still writes the ESP grub.cfg
# stub next to it, so point the boot entry at that image and also place the
# removable-media fallback loader \EFI\BOOT\BOOTRISCV64.EFI for firmware
# without usable NVRAM entries. Runs in the installed system chroot.
if [ "$(uname -m)" = "riscv64" ] && [ -d /boot/efi/EFI ]; then
grubefi=""
for candidate in /boot/efi/EFI/*/grubriscv64.efi; do
[ -f "$candidate" ] || continue
grubefi="$candidate"
break
done
if [ -n "$grubefi" ]; then
vendordir="$(basename "$(dirname "$grubefi")")"
mkdir -p /boot/efi/EFI/BOOT
cp -f "$grubefi" /boot/efi/EFI/BOOT/BOOTRISCV64.EFI
echo "riscv64: installed \\EFI\\BOOT\\BOOTRISCV64.EFI from \\EFI\\$vendordir\\grubriscv64.efi"
if command -v efibootmgr >/dev/null 2>&1 && efibootmgr >/dev/null 2>&1; then
espdev="$(findmnt -no SOURCE /boot/efi 2>/dev/null)"
# lsblk pads its output, and efibootmgr wants bare values
disk="$(lsblk -no PKNAME "$espdev" 2>/dev/null | head -1 | tr -d '[:space:]')"
part="$(lsblk -no PARTN "$espdev" 2>/dev/null | head -1 | tr -d '[:space:]')"
if [ -n "$disk" ] && [ -n "$part" ]; then
# drop the x86 entries anaconda created for this install, and any
# riscv64 entry a previous provisioning of this node left behind, so
# reinstalling does not fill the firmware variable store with copies
for bootnum in $(efibootmgr -v 2>/dev/null | awk '/\\EFI\\[^\\]+\\(shimx64|grubx64|grubriscv64)\.efi/ { sub(/^Boot/, "", $1); sub(/\*$/, "", $1); print $1 }'); do
efibootmgr -q -b "$bootnum" -B || true
done
label="$(. /etc/os-release 2>/dev/null; echo "${NAME:-Linux}")"
if efibootmgr -q -c -d "/dev/$disk" -p "$part" -L "$label" -l "\\EFI\\$vendordir\\grubriscv64.efi"; then
echo "riscv64: UEFI boot entry \"$label\" -> \\EFI\\$vendordir\\grubriscv64.efi on /dev/$disk part $part"
else
echo "riscv64: efibootmgr could not create the boot entry; the firmware will use \\EFI\\BOOT\\BOOTRISCV64.EFI"
fi
else
echo "riscv64: could not determine the ESP disk/partition; the firmware will use \\EFI\\BOOT\\BOOTRISCV64.EFI"
fi
else
echo "riscv64: efibootmgr unavailable; the firmware will use \\EFI\\BOOT\\BOOTRISCV64.EFI"
fi
else
echo "riscv64: no \\EFI\\*\\grubriscv64.efi on the ESP; is grub2-efi-riscv64 in the package list?"
fi
fi