[Unit]
Description=Emergency Shell
DefaultDependencies=no
+Wants=shutdown.target umount.target
+After=shutdown.target umount.target
[Service]
ExecStart=/bin/sh
Restart=restart-always
RestartSec=0
KillMode=process-group
+
+# Bash ignores SIGTERM, so we send SIGHUP first, to ensure that bash
+# terminates cleanly.
+ExecStop=/bin/kill -HUP $(MAINPID)