- if (retries > 0)
- log_info("Action still required, %d tries left", retries);
- else {
- log_error("Tried enough but still action required need_umount=%d, need_swapoff=%d, need_loop_detach=%d", need_umount, need_swapoff, need_loop_detach);
- r = -EBUSY;
- goto error;
- }
+ log_warning("Cannot finalize remaining file systems and devices, trying to kill remaining processes.");
+ ultimate_send_signal(SIGTERM);
+ ultimate_send_signal(SIGKILL);
+ killed_everbody = true;
+ }
+
+ log_debug("Couldn't finalize remaining file systems and devices after %u retries, trying again.", retries+1);
+ }
+
+ if (retries >= FINALIZE_ATTEMPTS)
+ log_error("Too many iterations, giving up.");
+
+ execute_directory(SYSTEM_SHUTDOWN_PATH, NULL, NULL);
+
+ /* If we are in a container, just exit, this will kill our
+ * container for good. */
+ if (in_container) {
+ log_error("Exiting container.");
+ exit(0);
+ }
+
+ if (access("/run/initramfs/shutdown", X_OK) == 0) {
+
+ if (prepare_new_root() >= 0 &&
+ pivot_to_new_root() >= 0) {
+ execv("/shutdown", argv);
+ log_error("Failed to execute shutdown binary: %m");