6df2a7
From 689454c727c2730b6aa89ee4c4b7676900e07f78 Mon Sep 17 00:00:00 2001
6df2a7
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
6df2a7
Date: Fri, 12 Apr 2019 16:26:59 +0200
6df2a7
Subject: [PATCH] Do not require non-empty kernel cmdline
6df2a7
6df2a7
When booting with Fedora-Server-dvd-x86_64-30-20190411.n.0.iso,
6df2a7
/proc/cmdline is empty (libvirt, qemu host with bios, not sure if that
6df2a7
matters), after installation to disk, anaconda would "crash" in kernel-core
6df2a7
%posttrans, after calling kernel-install, because dracut would fail
6df2a7
with
6df2a7
> Could not determine the kernel command line parameters.
6df2a7
> Please specify the kernel command line in /etc/kernel/cmdline!
6df2a7
6df2a7
I guess it's legitimate, even if unusual, to have no cmdline parameters.
6df2a7
Two changes are done in this patch:
6df2a7
1. do not fail if the cmdline is empty.
6df2a7
2. if /usr/lib/kernel/cmdline or /etc/kernel/cmdline are present, but
6df2a7
   empty, ignore /proc/cmdline. If there's explicit configuration to
6df2a7
   have empty cmdline, don't ignore it.
6df2a7
6df2a7
(cherry picked from commit 38b4f4b21c3c6107d7a562fcb432237464440b91)
6df2a7
6df2a7
Resolves: #1746069
6df2a7
---
6df2a7
 50-dracut.install        |  4 +---
6df2a7
 51-dracut-rescue.install | 10 +---------
6df2a7
 2 files changed, 2 insertions(+), 12 deletions(-)
6df2a7
6df2a7
diff --git a/50-dracut.install b/50-dracut.install
6df2a7
index 139ff82e..b897db84 100755
6df2a7
--- a/50-dracut.install
6df2a7
+++ b/50-dracut.install
6df2a7
@@ -35,9 +35,7 @@ case "$COMMAND" in
6df2a7
             read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
6df2a7
         elif [[ -f /usr/lib/kernel/cmdline ]]; then
6df2a7
             read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline
6df2a7
-        fi
6df2a7
-
6df2a7
-        if ! [[ ${BOOT_OPTIONS[*]} ]]; then
6df2a7
+        else
6df2a7
             read -r -d '' -a BOOT_OPTIONS < /proc/cmdline
6df2a7
         fi
6df2a7
 
6df2a7
diff --git a/51-dracut-rescue.install b/51-dracut-rescue.install
6df2a7
index 0580062f..5ac34ef3 100755
6df2a7
--- a/51-dracut-rescue.install
6df2a7
+++ b/51-dracut-rescue.install
6df2a7
@@ -47,9 +47,7 @@ if [[ -f /etc/kernel/cmdline ]]; then
6df2a7
     read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
6df2a7
 elif [[ -f /usr/lib/kernel/cmdline ]]; then
6df2a7
     read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline
6df2a7
-fi
6df2a7
-
6df2a7
-if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
6df2a7
+else
6df2a7
     read -r -d '' -a line < /proc/cmdline
6df2a7
     for i in "${line[@]}"; do
6df2a7
         [[ "${i#initrd=*}" != "$i" ]] && continue
6df2a7
@@ -57,12 +55,6 @@ if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
6df2a7
     done
6df2a7
 fi
6df2a7
 
6df2a7
-if ! [[ ${BOOT_OPTIONS[*]} ]]; then
6df2a7
-    echo "Could not determine the kernel command line parameters." >&2
6df2a7
-    echo "Please specify the kernel command line in /etc/kernel/cmdline!" >&2
6df2a7
-    exit 1
6df2a7
-fi
6df2a7
-
6df2a7
 if [[ -d "${BOOT_DIR_ABS%/*}" ]]; then
6df2a7
     BOOT_DIR="/${MACHINE_ID}/0-rescue"
6df2a7
     BOOT_ROOT=${BOOT_DIR_ABS%$BOOT_DIR}
3b5284