]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Do not require non-empty kernel cmdline
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 12 Apr 2019 14:26:59 +0000 (16:26 +0200)
committerLukáš Nykrýn <lnykryn@redhat.com>
Tue, 27 Aug 2019 16:33:13 +0000 (18:33 +0200)
When booting with Fedora-Server-dvd-x86_64-30-20190411.n.0.iso,
/proc/cmdline is empty (libvirt, qemu host with bios, not sure if that
matters), after installation to disk, anaconda would "crash" in kernel-core
%posttrans, after calling kernel-install, because dracut would fail
with
> Could not determine the kernel command line parameters.
> Please specify the kernel command line in /etc/kernel/cmdline!

I guess it's legitimate, even if unusual, to have no cmdline parameters.
Two changes are done in this patch:
1. do not fail if the cmdline is empty.
2. if /usr/lib/kernel/cmdline or /etc/kernel/cmdline are present, but
   empty, ignore /proc/cmdline. If there's explicit configuration to
   have empty cmdline, don't ignore it.

50-dracut.install
51-dracut-rescue.install

index bbb73442b7e12ee4c82fc14616541a001d4d7503..7fe2034c098fcdbfb0b40b62a2d5bd39603b31ce 100755 (executable)
@@ -35,9 +35,7 @@ case "$COMMAND" in
             read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
         elif [[ -f /usr/lib/kernel/cmdline ]]; then
             read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline
-        fi
-
-        if ! [[ ${BOOT_OPTIONS[*]} ]]; then
+        else
             read -r -d '' -a BOOT_OPTIONS < /proc/cmdline
         fi
 
index ef8afac18899c21faf465b562a0f2981b30d8241..5016290f4bb9463d458fb6784bbe42149ea53854 100755 (executable)
@@ -47,9 +47,7 @@ if [[ -f /etc/kernel/cmdline ]]; then
     read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
 elif [[ -f /usr/lib/kernel/cmdline ]]; then
     read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline
-fi
-
-if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
+else
     read -r -d '' -a line < /proc/cmdline
     for i in "${line[@]}"; do
         [[ "${i#initrd=*}" != "$i" ]] && continue
@@ -57,12 +55,6 @@ if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
     done
 fi
 
-if ! [[ ${BOOT_OPTIONS[*]} ]]; then
-    echo "Could not determine the kernel command line parameters." >&2
-    echo "Please specify the kernel command line in /etc/kernel/cmdline!" >&2
-    exit 1
-fi
-
 if [[ -d "${BOOT_DIR_ABS%/*}" ]]; then
     BOOT_DIR="/${MACHINE_ID}/0-rescue"
     BOOT_ROOT=${BOOT_DIR_ABS%$BOOT_DIR}