daandemeyer / rpms / systemd

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