From af4f1536b6e498b88c1b07d00fc047184453839a Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Oct 03 2023 15:12:39 +0000 Subject: Rename installed kernel to match name used in boot entry The mkbls() function would write 'linux /vmlinuz-${kernelver}' into the boot loader entry. But the code that actually copies the file would use the original file name with a version suffix ('cp -aT "$i" "/boot/${i##*/}-${KERNEL_VERSION}"'). In case of a local kernel build calling /sbin/installkernel this file name was e.g. 'bzImage', so we would end up with '/bzImage-${KERNEL_VERSION}', which of course doesn't match '/vmlinuz-*'. The script would later call 'grub2-mkrel' on the name taken from the boot entry which would fail because the file does not exist. Rename the argument to "vmlinuz", so that both parts match. Tested by doing a local kernel build with 'sudo make install' at the end. Signed-off-by: Zbigniew Jędrzejewski-Szmek --- diff --git a/20-grub.install b/20-grub.install index 8a86cc0..952322f 100755 --- a/20-grub.install +++ b/20-grub.install @@ -54,8 +54,13 @@ EOF case "$COMMAND" in add) if [[ "${KERNEL_DIR}" != "/boot" ]]; then + # rename to match the name used in the pseudo-BLS snippet above + rm -f "/boot/vmlinuz-${KERNEL_VERSION}" + cp -aT "${KERNEL_IMAGE}" "/boot/vmlinuz-${KERNEL_VERSION}" + command -v restorecon &>/dev/null && \ + restorecon -R "/boot/vmlinuz-${KERNEL_VERSION}" + for i in \ - "$KERNEL_IMAGE" \ "$KERNEL_DIR"/System.map \ "$KERNEL_DIR"/config \ "$KERNEL_DIR"/zImage.stub \ diff --git a/grub2.spec b/grub2.spec index 74cf971..a99ce0e 100644 --- a/grub2.spec +++ b/grub2.spec @@ -17,7 +17,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 102%{?dist} +Release: 103%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -548,6 +548,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Fri Sep 29 2023 Zbigniew Jedrzejewski-Szmek - 1:2.06-103 +- Rename installed kernel to match name used in boot entry +- Resolves: #2239008 + * Fri Sep 29 2023 Nicolas Frayer - 2.06-102 - ofdisk: Fix missing #include in ofdisk.c