From af4f1536b6e498b88c1b07d00fc047184453839a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 27 Sep 2023 17:05:21 +0200 Subject: [PATCH] Rename installed kernel to match name used in boot entry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- 20-grub.install | 7 ++++++- grub2.spec | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) 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