|
Harald Hoyer |
afa7aa |
From 4c2d98c75b0dd3dad45430becb78c9d40bc6be1b Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
afa7aa |
From: Martin Wilck <mwilck@suse.com>
|
|
Harald Hoyer |
afa7aa |
Date: Mon, 9 Oct 2017 14:39:12 +0200
|
|
Harald Hoyer |
afa7aa |
Subject: [PATCH] emergency.service: use Type=idle
|
|
Harald Hoyer |
afa7aa |
MIME-Version: 1.0
|
|
Harald Hoyer |
afa7aa |
Content-Type: text/plain; charset=UTF-8
|
|
Harald Hoyer |
afa7aa |
Content-Transfer-Encoding: 8bit
|
|
Harald Hoyer |
afa7aa |
|
|
Harald Hoyer |
afa7aa |
Type=oneshot, as currently set in dracut's emergency service file,
|
|
Harald Hoyer |
afa7aa |
causes an awkward situation if emergency mode is entered e.g. because
|
|
Harald Hoyer |
afa7aa |
of a root device timeout, and the root device appears later because it
|
|
Harald Hoyer |
afa7aa |
just has taken longer than the timeout. In that situation, my
|
|
Harald Hoyer |
afa7aa |
expectation (backed by past positive experience) is that the user should
|
|
Harald Hoyer |
afa7aa |
be able to simply exit the emergency shell and resume normal boot.
|
|
Harald Hoyer |
afa7aa |
|
|
Harald Hoyer |
afa7aa |
:/# systemctl status sysroot.mount
|
|
Harald Hoyer |
afa7aa |
● sysroot.mount - /sysroot
|
|
Harald Hoyer |
afa7aa |
Loaded: loaded (/proc/cmdline; bad; vendor preset: enabled)
|
|
Harald Hoyer |
afa7aa |
Active: active (mounted) since Mon 2017-10-09 14:32:15 CEST; 16s ago
|
|
Harald Hoyer |
afa7aa |
Where: /sysroot
|
|
Harald Hoyer |
afa7aa |
What: /dev/mapper/3600601600a30200024fbbaf3f500e411-part5
|
|
Harald Hoyer |
afa7aa |
Docs: man:fstab(5)
|
|
Harald Hoyer |
afa7aa |
man:systemd-fstab-generator(8)
|
|
Harald Hoyer |
afa7aa |
Process: 1873 ExecMount=/usr/bin/mount /dev/disk/by-uuid/63751805-6abc-46a3-a66f-427920dece4d /sysroot -o ro (code=exited, status=0/SUCCESS)
|
|
Harald Hoyer |
afa7aa |
Tasks: 0 (limit: 512)
|
|
Harald Hoyer |
afa7aa |
|
|
Harald Hoyer |
afa7aa |
:/# systemctl list-jobs
|
|
Harald Hoyer |
afa7aa |
JOB UNIT TYPE STATE
|
|
Harald Hoyer |
afa7aa |
56 emergency.target start waiting
|
|
Harald Hoyer |
afa7aa |
57 emergency.service start running
|
|
Harald Hoyer |
afa7aa |
|
|
Harald Hoyer |
afa7aa |
2 jobs listed.
|
|
Harald Hoyer |
afa7aa |
:/# exit
|
|
Harald Hoyer |
afa7aa |
logout
|
|
Harald Hoyer |
afa7aa |
Failed to start default.target: Transaction is destructive.
|
|
Harald Hoyer |
afa7aa |
|
|
Harald Hoyer |
afa7aa |
(system keeps idling from this point on, user has no chance to
|
|
Harald Hoyer |
afa7aa |
do anything).
|
|
Harald Hoyer |
afa7aa |
|
|
Harald Hoyer |
afa7aa |
This results from the combination of two effects:
|
|
Harald Hoyer |
afa7aa |
1) initrd-root-fs.target sets "OnFailureJobMode=replace-irreversibly",
|
|
Harald Hoyer |
afa7aa |
2) emergency.service's Type=oneshot causes the start jobs for both
|
|
Harald Hoyer |
afa7aa |
emergency.service and emergency.target to persist while the user is in
|
|
Harald Hoyer |
afa7aa |
the emergency shell.
|
|
Harald Hoyer |
afa7aa |
|
|
Harald Hoyer |
afa7aa |
When the shell is exited, systemd tries to isolate "initrd.target"
|
|
Harald Hoyer |
afa7aa |
again, but this fails with "the transaction is destructive" error
|
|
Harald Hoyer |
afa7aa |
because of the still pending jobs.
|
|
Harald Hoyer |
afa7aa |
|
|
Harald Hoyer |
afa7aa |
This patch fixes this by changing the Type of "emergency.service" from
|
|
Harald Hoyer |
afa7aa |
"oneshot" to "idle".
|
|
Harald Hoyer |
afa7aa |
---
|
|
Harald Hoyer |
afa7aa |
modules.d/98dracut-systemd/emergency.service | 2 +-
|
|
Harald Hoyer |
afa7aa |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
Harald Hoyer |
afa7aa |
|
|
Harald Hoyer |
afa7aa |
diff --git a/modules.d/98dracut-systemd/emergency.service b/modules.d/98dracut-systemd/emergency.service
|
|
Harald Hoyer |
afa7aa |
index 288aac39..100146a3 100644
|
|
Harald Hoyer |
afa7aa |
--- a/modules.d/98dracut-systemd/emergency.service
|
|
Harald Hoyer |
afa7aa |
+++ b/modules.d/98dracut-systemd/emergency.service
|
|
Harald Hoyer |
afa7aa |
@@ -17,7 +17,7 @@ Environment=NEWROOT=/sysroot
|
|
Harald Hoyer |
afa7aa |
WorkingDirectory=/
|
|
Harald Hoyer |
afa7aa |
ExecStart=/bin/dracut-emergency
|
|
Harald Hoyer |
afa7aa |
ExecStopPost=-/usr/bin/systemctl --fail --no-block default
|
|
Harald Hoyer |
afa7aa |
-Type=oneshot
|
|
Harald Hoyer |
afa7aa |
+Type=idle
|
|
Harald Hoyer |
afa7aa |
StandardInput=tty-force
|
|
Harald Hoyer |
afa7aa |
StandardOutput=inherit
|
|
Harald Hoyer |
afa7aa |
StandardError=inherit
|
|
Harald Hoyer |
afa7aa |
|