1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-26 14:04:03 +03:00

Do no isolate in case of emergency or severe problems

This patch changes local-fs.target and systemd-fsck to not use
"isolate" when going into emergency.
This fixes https://bugzilla.redhat.com/show_bug.cgi?id=810722

The motivation is, that when something wents wrong, we should
keep everything as it is, to let the user fix the problem. When
isolating we stop a lot of services and therefore change the
system heavily so that it gets harder for the user to fix.

An example is a crypted partition. When the fsck in a crypted
partition fails, it previously used "emergency/start/isolate"
which stops cryptsetup. Therefore if the user tries to fsck
e.g. /dev/mapper/luks-356c20ae-c7a2-4f1c-ae1d-1d290a91b691
as printed by the failing fsck, then it will not find this
device (because it got closed).

So please apply this patch to let the user see the failing
situation.

Thanks!

[zj: removed dead isolate param from start_target().]

https://bugs.freedesktop.org/show_bug.cgi?id=49463
https://bugzilla.redhat.com/show_bug.cgi?id=810722
This commit is contained in:
Dr. Tilmann Bubeck 2012-05-04 10:32:47 +02:00 committed by Zbigniew Jędrzejewski-Szmek
parent 9607d9470e
commit 80cfe9e163
2 changed files with 5 additions and 10 deletions

View File

@ -41,10 +41,10 @@ static bool arg_skip = false;
static bool arg_force = false; static bool arg_force = false;
static bool arg_show_progress = false; static bool arg_show_progress = false;
static void start_target(const char *target, bool isolate) { static void start_target(const char *target) {
DBusMessage *m = NULL, *reply = NULL; DBusMessage *m = NULL, *reply = NULL;
DBusError error; DBusError error;
const char *mode, *basic_target = "basic.target"; const char *mode = "replace", *basic_target = "basic.target";
DBusConnection *bus = NULL; DBusConnection *bus = NULL;
assert(target); assert(target);
@ -56,11 +56,6 @@ static void start_target(const char *target, bool isolate) {
goto finish; goto finish;
} }
if (isolate)
mode = "isolate";
else
mode = "replace";
log_info("Running request %s/start/%s", target, mode); log_info("Running request %s/start/%s", target, mode);
if (!(m = dbus_message_new_method_call("org.freedesktop.systemd1", "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", "StartUnitReplace"))) { if (!(m = dbus_message_new_method_call("org.freedesktop.systemd1", "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", "StartUnitReplace"))) {
@ -389,10 +384,10 @@ int main(int argc, char *argv[]) {
if (status.si_code == CLD_EXITED && (status.si_status & 2) && root_directory) if (status.si_code == CLD_EXITED && (status.si_status & 2) && root_directory)
/* System should be rebooted. */ /* System should be rebooted. */
start_target(SPECIAL_REBOOT_TARGET, false); start_target(SPECIAL_REBOOT_TARGET);
else if (status.si_code == CLD_EXITED && (status.si_status & 6)) else if (status.si_code == CLD_EXITED && (status.si_status & 6))
/* Some other problem */ /* Some other problem */
start_target(SPECIAL_EMERGENCY_TARGET, true); start_target(SPECIAL_EMERGENCY_TARGET);
else { else {
r = EXIT_SUCCESS; r = EXIT_SUCCESS;
log_warning("Ignoring error."); log_warning("Ignoring error.");

View File

@ -10,4 +10,4 @@ Description=Local File Systems
Documentation=man:systemd.special(7) Documentation=man:systemd.special(7)
After=local-fs-pre.target After=local-fs-pre.target
OnFailure=emergency.target OnFailure=emergency.target
OnFailureIsolate=yes OnFailureIsolate=no