naccyde / rpms / systemd

Forked from rpms/systemd a year ago
Clone
4fbe94
From 6240d78097c6f828aa2ca3b50ac322b41dc41fd1 Mon Sep 17 00:00:00 2001
4fbe94
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
4fbe94
Date: Fri, 23 Aug 2019 11:34:45 +0200
4fbe94
Subject: [PATCH] kernel-install: do not require non-empty kernel cmdline
4fbe94
4fbe94
When booting with Fedora-Server-dvd-x86_64-30-20190411.n.0.iso,
4fbe94
/proc/cmdline is empty (libvirt, qemu host with bios, not sure if that
4fbe94
matters), after installation to disk, anaconda would "crash" in kernel-core
4fbe94
%posttrans, after calling kernel-install, because dracut would fail
4fbe94
with
4fbe94
4fbe94
> Could not determine the kernel command line parameters.
4fbe94
> Please specify the kernel command line in /etc/kernel/cmdline!
4fbe94
4fbe94
I guess it's legitimate, even if unusual, to have no cmdline parameters.
4fbe94
Two changes are done in this patch:
4fbe94
4fbe94
1. do not fail if the cmdline is empty.
4fbe94
2. if /usr/lib/kernel/cmdline or /etc/kernel/cmdline are present, but
4fbe94
   empty, ignore /proc/cmdline. If there's explicit configuration to
4fbe94
   have empty cmdline, don't ignore it.
4fbe94
4fbe94
The same change was done in dracut:
4fbe94
https://github.com/dracutdevs/dracut/pull/561.
4fbe94
4fbe94
(cherry picked from commit 88e1306af6380794842fb31108ba67895799fab4)
4fbe94
4fbe94
Resolves: #1701454
4fbe94
---
4fbe94
 src/kernel-install/90-loaderentry.install | 14 ++++----------
4fbe94
 1 file changed, 4 insertions(+), 10 deletions(-)
4fbe94
4fbe94
diff --git a/src/kernel-install/90-loaderentry.install b/src/kernel-install/90-loaderentry.install
4fbe94
index a271cdb8a0..1619301536 100644
4fbe94
--- a/src/kernel-install/90-loaderentry.install
4fbe94
+++ b/src/kernel-install/90-loaderentry.install
4fbe94
@@ -43,13 +43,13 @@ if ! [[ $PRETTY_NAME ]]; then
4fbe94
     PRETTY_NAME="Linux $KERNEL_VERSION"
4fbe94
 fi
4fbe94
 
4fbe94
-declare -a BOOT_OPTIONS
4fbe94
-
4fbe94
 if [[ -f /etc/kernel/cmdline ]]; then
4fbe94
     read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
4fbe94
-fi
4fbe94
+elif [[ -f /usr/lib/kernel/cmdline ]]; then
4fbe94
+    read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline
4fbe94
+else
4fbe94
+    declare -a BOOT_OPTIONS
4fbe94
 
4fbe94
-if ! [[ ${BOOT_OPTIONS[*]} ]]; then
4fbe94
     read -r -d '' -a line < /proc/cmdline
4fbe94
     for i in "${line[@]}"; do
4fbe94
         [[ "${i#initrd=*}" != "$i" ]] && continue
4fbe94
@@ -57,12 +57,6 @@ if ! [[ ${BOOT_OPTIONS[*]} ]]; then
4fbe94
     done
4fbe94
 fi
4fbe94
 
4fbe94
-if ! [[ ${BOOT_OPTIONS[*]} ]]; then
4fbe94
-    echo "Could not determine the kernel command line parameters." >&2
4fbe94
-    echo "Please specify the kernel command line in /etc/kernel/cmdline!" >&2
4fbe94
-    exit 1
4fbe94
-fi
4fbe94
-
4fbe94
 cp "$KERNEL_IMAGE" "$BOOT_DIR_ABS/linux" &&
4fbe94
    chown root:root "$BOOT_DIR_ABS/linux" &&
4fbe94
    chmod 0644 "$BOOT_DIR_ABS/linux" || {