summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorŁukasz Stelmach <stlman@poczta.fm>2015-09-26 20:15:13 +0200
committerŁukasz Stelmach <stlman@poczta.fm>2015-09-27 22:17:27 +0200
commit48db40b32332671de99e0f99c18d62f6bca91072 (patch)
tree0288f00a503e063b50bd0b074974edece6dc18e4 /src
parent049077a789afb7a2e17817f694e55acfaf48de39 (diff)
fsck: start reboot.target irreversibly
In some situations rebooting after fixing rootfs fails because the job for reboot.target gets canceled. To avoid this the "mode" parameter of the StartUnitReplace() call needs to be set to "replace-irreversibly".
Diffstat (limited to 'src')
-rw-r--r--src/fsck/fsck.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c
index bd3051f30d..9a7ac3250b 100644
--- a/src/fsck/fsck.c
+++ b/src/fsck/fsck.c
@@ -60,7 +60,7 @@ static bool arg_force = false;
static bool arg_show_progress = false;
static const char *arg_repair = "-a";
-static void start_target(const char *target) {
+static void start_target(const char *target, const char *mode) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
int r;
@@ -83,7 +83,7 @@ static void start_target(const char *target) {
"StartUnitReplace",
&error,
NULL,
- "sss", "basic.target", target, "replace");
+ "sss", "basic.target", target, mode);
/* Don't print a warning if we aren't called during startup */
if (r < 0 && !sd_bus_error_has_name(&error, BUS_ERROR_NO_SUCH_JOB))
@@ -463,10 +463,10 @@ int main(int argc, char *argv[]) {
if (status.si_code == CLD_EXITED && (status.si_status & FSCK_SYSTEM_SHOULD_REBOOT) && root_directory)
/* System should be rebooted. */
- start_target(SPECIAL_REBOOT_TARGET);
+ start_target(SPECIAL_REBOOT_TARGET, "replace-irreversibly");
else if (status.si_code == CLD_EXITED && (status.si_status & (FSCK_SYSTEM_SHOULD_REBOOT | FSCK_ERRORS_LEFT_UNCORRECTED)))
/* Some other problem */
- start_target(SPECIAL_EMERGENCY_TARGET);
+ start_target(SPECIAL_EMERGENCY_TARGET, "replace");
else {
log_warning("Ignoring error.");
r = 0;