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.
--
Best regards,
Konstantin mailto:konstantin.vla...@virtuozzo.com
From 6c94c020205da3445a9e718210cd9a63de90a4e7 Mon Sep 17 00:00:00 2001
From: Konstantin Vlasov <kvla...@virtuozzo.com>
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(-)
diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in
index a851424..9081e4b 100644
--- a/util/grub-switch-to-blscfg.in
+++ b/util/grub-switch-to-blscfg.in
@@ -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
}
--
2.24.4
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel