chiark / gitweb /
Do no isolate in case of emergency or severe problems
[elogind.git] / src / fsck / fsck.c
index 833f3f74a66718905635e0a4a8f6013ceb29793f..f298cf7b9ab82d2f5f00c9a655d34942e94d9b4b 100644 (file)
 #include "special.h"
 #include "bus-errors.h"
 #include "virt.h"
+#include "fileio.h"
 
 static bool arg_skip = false;
 static bool arg_force = 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;
         DBusError error;
-        const char *mode, *basic_target = "basic.target";
+        const char *mode = "replace", *basic_target = "basic.target";
         DBusConnection *bus = NULL;
 
         assert(target);
@@ -55,11 +56,6 @@ static void start_target(const char *target, bool isolate) {
                 goto finish;
         }
 
-        if (isolate)
-                mode = "isolate";
-        else
-                mode = "replace";
-
         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"))) {
@@ -128,11 +124,14 @@ static int parse_proc_cmdline(void) {
                         arg_skip = true;
                 else if (startswith(w, "fsck"))
                         log_warning("Invalid fsck parameter. Ignoring.");
-#if defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA) || defined(TARGET_MAGEIA)
-                else if (strneq(w, "fastboot", l))
+#ifdef HAVE_SYSV_COMPAT
+                else if (strneq(w, "fastboot", l)) {
+                        log_error("Please pass 'fsck.mode=skip' rather than 'fastboot' on the kernel command line.");
                         arg_skip = true;
-                else if (strneq(w, "forcefsck", l))
+                } else if (strneq(w, "forcefsck", l)) {
+                        log_error("Please pass 'fsck.mode=force' rather than 'forcefsck' on the kernel command line.");
                         arg_force = true;
+                }
 #endif
         }
 
@@ -141,11 +140,17 @@ static int parse_proc_cmdline(void) {
 }
 
 static void test_files(void) {
-        if (access("/fastboot", F_OK) >= 0)
+#ifdef HAVE_SYSV_COMPAT
+        if (access("/fastboot", F_OK) >= 0) {
+                log_error("Please pass 'fsck.mode=skip' on the kernel command line rather than creating /fastboot on the root file system.");
                 arg_skip = true;
+        }
 
-        if (access("/forcefsck", F_OK) >= 0)
+        if (access("/forcefsck", F_OK) >= 0) {
+                log_error("Please pass 'fsck.mode=force' on the kernel command line rather than creating /forcefsck on the root file system.");
                 arg_force = true;
+        }
+#endif
 
         if (access("/run/systemd/show-status", F_OK) >= 0 || plymouth_running())
                 arg_show_progress = true;
@@ -297,7 +302,7 @@ int main(int argc, char *argv[]) {
                 }
 
                 if (!(udev = udev_new())) {
-                        log_error("Out of memory");
+                        log_oom();
                         goto finish;
                 }
 
@@ -379,10 +384,10 @@ int main(int argc, char *argv[]) {
 
                 if (status.si_code == CLD_EXITED && (status.si_status & 2) && root_directory)
                         /* 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))
                         /* Some other problem */
-                        start_target(SPECIAL_EMERGENCY_TARGET, true);
+                        start_target(SPECIAL_EMERGENCY_TARGET);
                 else {
                         r = EXIT_SUCCESS;
                         log_warning("Ignoring error.");