ad54c5
From 96116c784edda6675c80fdf95823188c72b28652 Mon Sep 17 00:00:00 2001
c2f1e0
From: Lukas Nykryn <lnykryn@redhat.com>
ad54c5
Date: Mon, 18 Jul 2022 16:29:27 +0200
ad54c5
Subject: [PATCH] fix(98dracut-systemd): partly revert "emergency mode: use
ad54c5
 sulogin"
c2f1e0
ad54c5
Partly reverts 32f68c1f9ac3720e8ce4b95a09c0ce680d5da786
ad54c5
In RHEL we don't want to have a password to log in into emergency mode.
c2f1e0
c2f1e0
RHEL-only
c2f1e0
ad54c5
Resolves: #2057365
c2f1e0
---
ad54c5
 modules.d/98dracut-systemd/dracut-emergency.sh | 2 +-
ad54c5
 modules.d/98dracut-systemd/module-setup.sh     | 2 --
ad54c5
 modules.d/99base/module-setup.sh               | 8 ++------
ad54c5
 3 files changed, 3 insertions(+), 9 deletions(-)
c2f1e0
ad54c5
diff --git a/modules.d/98dracut-systemd/dracut-emergency.sh b/modules.d/98dracut-systemd/dracut-emergency.sh
ad54c5
index c6637a5c..48062f49 100755
ad54c5
--- a/modules.d/98dracut-systemd/dracut-emergency.sh
ad54c5
+++ b/modules.d/98dracut-systemd/dracut-emergency.sh
ad54c5
@@ -34,7 +34,7 @@ if getargbool 1 rd.shell -d -y rdshell || getarg rd.break -d rdbreak; then
ad54c5
     done < /proc/consoles
ad54c5
     [ -f /etc/profile ] && . /etc/profile
ad54c5
     [ -z "$PS1" ] && export PS1="$_name:\${PWD}# "
ad54c5
-    exec sulogin -e
ad54c5
+    exec sh -i -l
ad54c5
 else
ad54c5
     export hook="shutdown-emergency"
ad54c5
     warn "$action has failed. To debug this issue add \"rd.shell rd.debug\" to the kernel command line."
ad54c5
diff --git a/modules.d/98dracut-systemd/module-setup.sh b/modules.d/98dracut-systemd/module-setup.sh
ad54c5
index b7da86db..6fb26efa 100755
ad54c5
--- a/modules.d/98dracut-systemd/module-setup.sh
ad54c5
+++ b/modules.d/98dracut-systemd/module-setup.sh
ad54c5
@@ -51,6 +51,4 @@ install() {
ad54c5
     done
c2f1e0
 
ad54c5
     inst_simple "$moddir/dracut-tmpfiles.conf" "$tmpfilesdir/dracut-tmpfiles.conf"
c2f1e0
-
ad54c5
-    inst_multiple sulogin
c2f1e0
 }
ad54c5
diff --git a/modules.d/99base/module-setup.sh b/modules.d/99base/module-setup.sh
ad54c5
index 10a44d91..3fa2659a 100755
ad54c5
--- a/modules.d/99base/module-setup.sh
ad54c5
+++ b/modules.d/99base/module-setup.sh
ad54c5
@@ -30,12 +30,8 @@ install() {
ad54c5
     fi
ad54c5
 
ad54c5
     # add common users in /etc/passwd, it will be used by nfs/ssh currently
ad54c5
-    # use password for hostonly images to facilitate secure sulogin in emergency console
ad54c5
-    [[ $hostonly ]] && pwshadow='x'
ad54c5
-    grep '^root:' "$initdir/etc/passwd" 2> /dev/null || echo "root:$pwshadow:0:0::/root:/bin/sh" >> "$initdir/etc/passwd"
ad54c5
-    grep '^nobody:' "$dracutsysrootdir"/etc/passwd >> "$initdir/etc/passwd"
ad54c5
-
ad54c5
-    [[ $hostonly ]] && grep '^root:' "$dracutsysrootdir"/etc/shadow >> "$initdir/etc/shadow"
ad54c5
+    grep '^root:' "$initdir/etc/passwd" 2> /dev/null || echo 'root:x:0:0::/root:/bin/sh' >> "$initdir/etc/passwd"
ad54c5
+    grep '^nobody:' /etc/passwd >> "$initdir/etc/passwd"
c2f1e0
 
ad54c5
     # install our scripts and hooks
ad54c5
     inst_script "$moddir/init.sh" "/init"