Skip to content

Commit e2ecc2d

Browse files
committed
base/dracut-lib.sh: "halt" the machine in systemd mode for die()
and only go in emergency shell if "rd.debug" is specified https://bugzilla.redhat.com/show_bug.cgi?id=1053655
1 parent b40e38d commit e2ecc2d

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

modules.d/99base/dracut-lib.sh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,8 +437,15 @@ die() {
437437
echo "warn dracut: Refusing to continue";
438438
} >> $hookdir/emergency/01-die.sh
439439
[ -d /run/initramfs ] || mkdir -p -- /run/initramfs
440+
440441
> /run/initramfs/.die
441-
emergency_shell
442+
443+
getargbool 0 "rd.debug=" && emergency_shell
444+
445+
if [ -n "$DRACUT_SYSTEMD" ]; then
446+
systemctl --no-block --force halt
447+
fi
448+
442449
exit 1
443450
}
444451

@@ -1052,7 +1059,13 @@ emergency_shell()
10521059
# cause a kernel panic
10531060
exit 1
10541061
fi
1055-
[ -e /run/initramfs/.die ] && exit 1
1062+
1063+
if [ -e /run/initramfs/.die ]; then
1064+
if [ -n "$DRACUT_SYSTEMD" ]; then
1065+
systemctl --no-block --force halt
1066+
fi
1067+
exit 1
1068+
fi
10561069
}
10571070

10581071
action_on_fail()

0 commit comments

Comments
 (0)