From c1ebf6e8ba22524e8c1dca847e851f7a30e704cc Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Thu, 25 Aug 2022 17:31:05 +0000 Subject: [PATCH] Sync /etc/kernel/cmdline generation with 2.06-52.fc38 Resolves: #1969362 Signed-off-by: Robbie Harwood --- ...sh-don-t-dup-rhgb-quiet-check-mtimes.patch | 36 ++++++++++++ 0288-squish-give-up-on-rhgb-quiet.patch | 26 +++++++++ ...write-etc-kernel-cmdline-if-writable.patch | 58 +++++++++++++++++++ grub.patches | 3 + grub2.spec | 6 +- 5 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 0287-squish-don-t-dup-rhgb-quiet-check-mtimes.patch create mode 100644 0288-squish-give-up-on-rhgb-quiet.patch create mode 100644 0289-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch diff --git a/0287-squish-don-t-dup-rhgb-quiet-check-mtimes.patch b/0287-squish-don-t-dup-rhgb-quiet-check-mtimes.patch new file mode 100644 index 0000000..9498f71 --- /dev/null +++ b/0287-squish-don-t-dup-rhgb-quiet-check-mtimes.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Robbie Harwood +Date: Wed, 17 Aug 2022 10:26:07 -0400 +Subject: [PATCH] squish: don't dup rhgb quiet, check mtimes + +Signed-off-by: Robbie Harwood +(cherry picked from commit 275a0487c74e309cfd0a8c670740f6c34e729c45) +--- + util/grub.d/10_linux.in | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index ec529eb814..becf5ba9c6 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -166,10 +166,16 @@ update_bls_cmdline() + local cmdline="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" + local -a files=($(get_sorted_bls)) + +- if [[ ! -f /etc/kernel/cmdline ]]; then +- # anaconda has the correct information to do this during install; +- # afterward, grubby will take care of syncing on updates. +- echo "$cmdline rhgb quiet" > /etc/kernel/cmdline ++ if [[ ! -f /etc/kernel/cmdline ]] || ++ [[ /etc/kernel/cmdline -ot /etc/default/grub ]]; then ++ # anaconda has the correct information to create this during install; ++ # afterward, grubby will take care of syncing on updates. If the user ++ # has modified /etc/default/grub, try to cope. ++ if [[ ! "$cmdline" =~ "rhgb quiet" ]]; then ++ # ensure these only show up once ++ cmdline="$cmdline rhgb quiet" ++ fi ++ echo "$cmdline" > /etc/kernel/cmdline + fi + + for bls in "${files[@]}"; do diff --git a/0288-squish-give-up-on-rhgb-quiet.patch b/0288-squish-give-up-on-rhgb-quiet.patch new file mode 100644 index 0000000..6e994ed --- /dev/null +++ b/0288-squish-give-up-on-rhgb-quiet.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Robbie Harwood +Date: Wed, 17 Aug 2022 11:30:30 -0400 +Subject: [PATCH] squish: give up on rhgb quiet + +Signed-off-by: Robbie Harwood +(cherry picked from commit 12354f586f0748efc5c016b7d2053330f784ab4e) +--- + util/grub.d/10_linux.in | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index becf5ba9c6..5a7e5326da 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -171,10 +171,6 @@ update_bls_cmdline() + # anaconda has the correct information to create this during install; + # afterward, grubby will take care of syncing on updates. If the user + # has modified /etc/default/grub, try to cope. +- if [[ ! "$cmdline" =~ "rhgb quiet" ]]; then +- # ensure these only show up once +- cmdline="$cmdline rhgb quiet" +- fi + echo "$cmdline" > /etc/kernel/cmdline + fi + diff --git a/0289-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch b/0289-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch new file mode 100644 index 0000000..e1e6a87 --- /dev/null +++ b/0289-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch @@ -0,0 +1,58 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jonathan Lebon +Date: Wed, 17 Aug 2022 10:26:03 -0400 +Subject: [PATCH] squish: BLS: only write /etc/kernel/cmdline if writable + +On OSTree systems, `grub2-mkconfig` is run with `/etc` mounted read-only +because as part of the promise of transactional updates, we want to make +sure that we're not modifying the current deployment's state (`/etc` or +`/var`). + +This conflicts with 0837dcdf1 ("BLS: create /etc/kernel/cmdline during +mkconfig") which wants to write to `/etc/kernel/cmdline`. I'm not +exactly sure on the background there, but based on the comment I think +the intent is to fulfill grubby's expectation that the file exists. + +However, in systems like Silverblue, kernel arguments are managed by the +rpm-ostree stack and grubby is not shipped at all. + +Adjust the script slightly so that we only write `/etc/kernel/cmdline` +if the parent directory is writable. + +In the future, we're hoping to simplify things further on rpm-ostree +systems by not running `grub2-mkconfig` at all since libostree already +directly writes BLS entries. Doing that would also have avoided this, +but ratcheting it into existing systems needs more careful thought. + +Signed-off-by: Jonathan Lebon + +Fixes: https://github.com/fedora-silverblue/issue-tracker/issues/322 +(cherry picked from commit 3c3d1a3c4a2dc4adfb38c2724618fefc913a63fc) +--- + util/grub.d/10_linux.in | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index 5a7e5326da..b1b9255c32 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -166,12 +166,13 @@ update_bls_cmdline() + local cmdline="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" + local -a files=($(get_sorted_bls)) + +- if [[ ! -f /etc/kernel/cmdline ]] || +- [[ /etc/kernel/cmdline -ot /etc/default/grub ]]; then +- # anaconda has the correct information to create this during install; +- # afterward, grubby will take care of syncing on updates. If the user +- # has modified /etc/default/grub, try to cope. +- echo "$cmdline" > /etc/kernel/cmdline ++ if [ -w /etc/kernel ] && ++ [[ ! -f /etc/kernel/cmdline || ++ /etc/kernel/cmdline -ot /etc/default/grub ]]; then ++ # anaconda has the correct information to create this during install; ++ # afterward, grubby will take care of syncing on updates. If the user ++ # has modified /etc/default/grub, try to cope. ++ echo "$cmdline" > /etc/kernel/cmdline + fi + + for bls in "${files[@]}"; do diff --git a/grub.patches b/grub.patches index 81ad803..c08b18b 100644 --- a/grub.patches +++ b/grub.patches @@ -284,3 +284,6 @@ Patch0283: 0283-efi-allocate-the-initrd-within-the-bounds-expressed-.patch Patch0284: 0284-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch Patch0285: 0285-BLS-create-etc-kernel-cmdline-during-mkconfig.patch Patch0286: 0286-ieee1275-implement-vec5-for-cas-negotiation.patch +Patch0287: 0287-squish-don-t-dup-rhgb-quiet-check-mtimes.patch +Patch0288: 0288-squish-give-up-on-rhgb-quiet.patch +Patch0289: 0289-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch diff --git a/grub2.spec b/grub2.spec index 711fe9d..97f3882 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 45%{?dist} +Release: 46%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -532,6 +532,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Thu Aug 25 2022 Robbie Harwood - 2.06-46 +- Sync /etc/kernel/cmdline generation with 2.06-52.fc38 +- Resolves: #1969362 + * Thu Aug 25 2022 Robbie Harowod - 2.06-45 - ieee1275: implement vec5 for cas negotiation - Resolves: #2121192