daandemeyer / rpms / systemd

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