From b96380fa98b8ed796a427d71e4604a8d6bb1fd04 Mon Sep 17 00:00:00 2001 From: Leo Sandoval Date: Thu, 31 Jul 2025 11:42:54 -0600 Subject: [PATCH] 20-grub.install: Skip BLS removal when entry type is type2 UKI(package is kernel-uki-virt) is a single, bootable file that bundles everything needed to start a Linux system. It contains its own bootable stub and bypasses GRUB2 completely. The kernel-core and kernel-uki-virt can coexist in one machine. And both of them call kernel-install remove upon package removal and this leads to the complete removal of both the traditional kernel & its artifacts(initramfs, BLS entry file,...). For example, if the customer remove kernel-uki-virt, currently it also removes BLS entry which causes the regular kernel fails to boot up. In https://github.com/systemd/systemd/pull/37897 it added --entry-type=type1|type2 option to kernel-install. type1 stands for normal kernel, type2 stands for uki. When kernel-install is invoked with --entry-type=type2 which is for UKI, we should not remove the BLS entry. Resolves: #RHEL-104167 Signed-off-by: Yuxin Sun Signed-off-by: Leo Sandoval --- 20-grub.install | 6 ++++++ grub2.spec | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/20-grub.install b/20-grub.install index 650b519..699fff7 100755 --- a/20-grub.install +++ b/20-grub.install @@ -186,6 +186,12 @@ case "$COMMAND" in ;; remove) + # If the boot entry type is type2, we are not removing the BLS entry + if [[ "x${KERNEL_INSTALL_BOOT_ENTRY_TYPE}" = "xtype2" ]]; then + [ "${KERNEL_INSTALL_VERBOSE}" -gt 0 ] && echo "The boot entry type is type2. Skip removing BLS entry." + exit 0 + fi + if [[ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]] || [[ ! -f /sbin/new-kernel-pkg ]]; then BLS_TARGET="${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf" BLS_FAKE_TARGET="${BLS_DIR}/ffffffffffffffffffffffffffffffff-${KERNEL_VERSION}.conf" diff --git a/grub2.spec b/grub2.spec index 63c827b..74a947e 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.12 -Release: 24%{?dist} +Release: 25%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPL-3.0-or-later URL: http://www.gnu.org/software/grub/ @@ -574,6 +574,10 @@ fi %endif %changelog +* Thu Jul 31 2025 Leo Sandoval 2.12-25 +- 20-grub.install: Skip BLS removal when entry type is type2 +- Resolves: #RHEL-104167 + * Tue Jul 29 2025 Nicolas Frayer 2.12-24 - spec/posttrans: move grub config stub creation out of spec - Resolves: #RHEL-69943