661545
From 1be885f0e0f7023d1adc09fb0b247935c1a0b3bd Mon Sep 17 00:00:00 2001
661545
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
661545
Date: Sat, 28 Jan 2017 21:18:31 -0500
661545
Subject: [PATCH] systemctl: always avoid being killed when doing switch-root
661545
661545
The same logic as described in acc28e2e3037d689d6481e applies to any time we are
661545
switching root, to just set the flag unconditionally.
661545
661545
(cherry picked from commit b3ad0ff48c154ed056a6bded2adac609395a9439)
661545
661545
Related: #1754053
661545
---
661545
 src/systemctl/systemctl.c | 8 +++-----
661545
 1 file changed, 3 insertions(+), 5 deletions(-)
661545
661545
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
661545
index f84b92ccbe..0928e2972a 100644
661545
--- a/src/systemctl/systemctl.c
661545
+++ b/src/systemctl/systemctl.c
661545
@@ -5062,11 +5062,9 @@ static int switch_root(sd_bus *bus, char **args) {
661545
         }
661545
 
661545
         /* Instruct PID1 to exclude us from its killing spree applied during
661545
-         * the transition from the initrd to the main system otherwise we would
661545
-         * exit with a failure status even though the switch to the new root
661545
-         * has succeed. */
661545
-        if (in_initrd())
661545
-                argv_cmdline[0] = '@';
661545
+         * the transition. Otherwise we would exit with a failure status even
661545
+         * though the switch to the new root has succeed. */
661545
+        argv_cmdline[0] = '@';
661545
 
661545
         log_debug("Switching root - root: %s; init: %s", root, strna(init));
661545