Fix for grub-switch-to-blscfg
Hi,
We've discovered that there are some inconsistencies in the grub-switch-to-blscfg tool, that lead to generating invalid BLS configs, when /boot is not a separate partition.
The attached patch fixes it.
P. S. There is also a secondary issue, which this patch also fixes: the broken "options" line generated by mkbls(). But it's automatically replaced with the correct one by the subsequent call to "grub2-mkconfig" in the main code, so it's more for the purity of the code, rather than out of practical necessity.
Signature · 2 lines
Best regards, Konstantin mailto:[email protected]
From 6c94c020205da3445a9e718210cd9a63de90a4e7 Mon Sep 17 00:00:00 2001
From: Konstantin Vlasov <[email protected]>
Date: Wed, 24 May 2023 19:16:31 +0300
Subject: [PATCH] Fixed grub-switch-to-blscfg
Two issues are fixed:
1. mkbls() always puts vmlinuz and initrd in the partition's root, which may not be the case when separate /boot is not used.
2. mkbls() is called twice, and both times incorrectly. It expects 3 arguments,
namely: kernelver, datetime, kernelopts. But the first time (for the main entry) it's called with additional bootprefix argument inserted between the 2nd and 3rd; and the second time (for the rescue entry) it's called with 3 arguments, but 3rd being bootprefix instead of kernel options.
--- util/grub-switch-to-blscfg.in | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
util/grub-switch-to-blscfg.in +4 -3
@@ -190,6 +190,7 @@ fi mkbls() { local kernelver=$1 && shift local datetime=$1 && shift + local bootprefix=$1 && shift local kernelopts=$1 && shift local debugname=""
@@ -209,8 +210,8 @@ mkbls() { cat <<EOF title ${NAME} (${kernelver}) ${VERSION}${debugname} version ${kernelver}${debugid} -linux /vmlinuz-${kernelver} -initrd /initramfs-${kernelver}.img +linux ${bootprefix}/vmlinuz-${kernelver} +initrd ${bootprefix}/initramfs-${kernelver}.img options ${kernelopts} grub_users \$grub_users grub_arg --unrestricted
@@ -252,7 +253,7 @@ copy_bls() { done if [ -f "/boot/vmlinuz-0-rescue-${MACHINE_ID}" ]; then - mkbls "0-rescue-${MACHINE_ID}" "0" "${bootprefix}" >"${blsdir}/${MACHINE_ID}-0-rescue.conf" + mkbls "0-rescue-${MACHINE_ID}" "0" "${bootprefix}" "${cmdline}" >"${blsdir}/${MACHINE_ID}-0-rescue.conf" fi }
Signature · 1 line
2.24.4
Hello Konstantin!
Quoted 5 lines · Konstantin Vlasov via Grub-devel
We've discovered that there are some inconsistencies in the grub-switch-to-blscfg tool, that lead to generating invalid BLS configs, when /boot is not a separate partition.
The attached patch fixes it.
Please send patches in-line using the git-send-email feature.
Also, I would suggest splitting up the patch into two as they fix two logically independent issues. »Fixed grub-switch-to-blscfg« is also not a very good title for a commit message.
Adrian
Signature · 4 lines
.''`. John Paul Adrian Glaubitz : :' : Debian Developer `. `' Physicist `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Hi,
Quoted 6 lines · Konstantin Vlasov via Grub-devel
Hi,
We've discovered that there are some inconsistencies in the grub-switch-to-blscfg tool, that lead to generating invalid BLS configs, when /boot is not a separate partition.
Quoted 7 lines
The attached patch fixes it.
P. S. There is also a secondary issue, which this patch also fixes: the broken "options" line generated by
mkbls(). But it's automatically replaced with the correct one by the subsequent call to "grub2-mkconfig" in the main code, so it's more for the purity of the code, rather than out of practical necessity.
Thanks for the patch. Sadly the BLS support is not in the GRUB upstream yet. So, simply it will not apply. I suggest sending the patch to the GRUB maintainers of distro which you are using.
Daniel
Hi, Daniel.
Quoted 7 lines
Quoted 7 lines
We've discovered that there are some inconsistencies in the grub-switch-to-blscfg tool, that lead to generating invalid BLS configs, when /boot is not a separate partition.
The attached patch fixes it.
Quoted 8 lines
Quoted 4 lines
P. S. There is also a secondary issue, which this patch also fixes: the broken "options" line generated by
mkbls(). But it's automatically replaced with the correct one by the subsequent call to "grub2-mkconfig" in the main code, so it's more for the purity of the code, rather than out of practical necessity.Thanks for the patch. Sadly the BLS support is not in the GRUB upstream yet. So, simply it will not apply. I suggest sending the patch to the GRUB maintainers of distro which you are using.
Oh, sorry, I didn't realize it could be a custom addition, and didn't check with the actual upstream repository. Indeed, it's added by a separate patch in the RHEL package version which I was using.
I'll be more thorough next time.
Signature · 2 lines
Best regards, Konstantin mailto:[email protected]