From 72f15bdd89c28e065f3d952ea562ae1b5a2af7f8 Mon Sep 17 00:00:00 2001 From: Marta Lewandowska Date: Thu, 11 Jan 2024 10:07:32 +0100 Subject: [PATCH] Don't overwrite vars that start with GRUB_CMDLINE_LINUX When updating args for ALL kernels, grubby clobbers all variables in /etc/default/grub that start with GRUB_CMDLINE_LINUX and renders that line multiple times, for each variable that exists. This breaks using recovery mode. Fix so this doesn't happen anymore. Resolves: #RHEL-21301 Signed-off-by: Marta Lewandowska Signed-off-by: Nicolas Frayer --- grubby-bls | 2 +- grubby.spec | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/grubby-bls b/grubby-bls index 3c2544a..fef62db 100755 --- a/grubby-bls +++ b/grubby-bls @@ -500,7 +500,7 @@ update_bls_fragment() { if [[ -n $old_args ]]; then opts="$(update_args "${old_args}" "${remove_args}" "${add_args}")" opts="$(echo "$opts" | sed -e 's/\//\\\//g')" - sed -i -e "s/^GRUB_CMDLINE_LINUX.*/GRUB_CMDLINE_LINUX=\\\"${opts}\\\"/" "${grub_etc_default}" + sed -i -e "s/^GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\\\"${opts}\\\"/" "${grub_etc_default}" fi fi diff --git a/grubby.spec b/grubby.spec index d83cd91..658ec91 100644 --- a/grubby.spec +++ b/grubby.spec @@ -1,6 +1,6 @@ Name: grubby Version: 8.40 -Release: 63%{?dist} +Release: 64%{?dist} Summary: Command line tool for updating bootloader configs License: GPLv2+ URL: https://github.com/rhinstaller/grubby @@ -131,6 +131,10 @@ current boot environment. %{_mandir}/man8/*.8* %changelog +* Wed Jan 10 2024 Marta Lewandowska - 8.40-64 +- Do not overwrite all vars that start with GRUB_CMDLINE_LINUX +- Resolves: #RHEL-21301 + * Tue Feb 21 2023 Marta Lewandowska - 8.40-63 - remove root= when not copying default - Resolves: #2127453