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