You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
2.1 KiB

From 9aa224cc19989807b6e34b72af01e0a12072940c Mon Sep 17 00:00:00 2001
From: Alexander Kurtz <alexander@kurtz.be>
Date: Fri, 6 May 2016 17:25:37 +0200
Subject: [PATCH] dracut-systemd/dracut-cmdline.sh: Don't error out if there is
no root= argument.
Thanks to systemd's gpt-auto-generator [0] (which implements the Discoverable
Partitions Specification [1]), it is no longer necessary to always specify the
root= argument.
However, dracut would still refuse to boot if there was no root= argument (or
if it was set to the special value "gpt-auto" [2]). This commit stops dracut
from aborting the boot process in these cases and simply lets systemd do its
magic.
[0] https://github.com/systemd/systemd/blob/v229/src/gpt-auto-generator
[1] https://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/
[2] https://github.com/systemd/systemd/blob/v229/src/gpt-auto-generator/gpt-auto-generator.c#L928
(cherry picked from commit 016613c774baf3d30c6425a65ead05d8b55d6279)
---
modules.d/98systemd/dracut-cmdline.sh | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/modules.d/98systemd/dracut-cmdline.sh b/modules.d/98systemd/dracut-cmdline.sh
index 9d15663e..d22e4d6e 100755
--- a/modules.d/98systemd/dracut-cmdline.sh
+++ b/modules.d/98systemd/dracut-cmdline.sh
@@ -22,7 +22,12 @@ getargbool 0 rd.udev.log-priority=debug -d rd.udev.debug -d -n -y rdudevdebug &&
source_conf /etc/conf.d
-root=$(getarg root=)
+# Get the "root=" parameter from the kernel command line, but differentiate
+# between the case where it was set to the empty string and the case where it
+# wasn't specified at all.
+if ! root="$(getarg root=)"; then
+ root='UNSET'
+fi
rflags="$(getarg rootflags=)"
getargbool 0 ro && rflags="${rflags},ro"
@@ -66,9 +71,12 @@ case "$root" in
/dev/*)
root="block:${root}"
rootok=1 ;;
+ UNSET|gpt-auto)
+ # systemd's gpt-auto-generator handles this case.
+ rootok=1 ;;
esac
-[ -z "$root" ] && die "No or empty root= argument"
+[ -z "$root" ] && die "Empty root= argument"
[ -z "$rootok" ] && die "Don't know how to handle 'root=$root'"
export root rflags fstype netroot NEWROOT