#include "path-util.h"
#include "switch-root.h"
#include "capability.h"
+#include "killall.h"
#include "mount-setup.h"
#include "loopback-setup.h"
* rebooted while we do that */
watchdog_close(true);
- /* Reopen the console */
- make_console_stdio();
-
if (switch_root_dir) {
+ /* Kill all remaining processes from the initrd */
+ broadcast_signal(SIGTERM);
+ broadcast_signal(SIGKILL);
+
+ /* And switch root */
r = switch_root(switch_root_dir);
if (r < 0)
log_error("Failed to switch root, ignoring: %s", strerror(-r));
fds = NULL;
}
+ /* Reopen the console */
+ make_console_stdio();
+
for (j = 1, i = 1; j < argc; j++)
args[i++] = argv[j];
args[i++] = NULL;