forked from pool/systemd
- Add temporarily 5003-core-when-switching-root-remove-run-systemd-before-e.patch (bsc#1227580)
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1546
This commit is contained in:
parent
f130b45d7f
commit
090cfdae6a
@ -0,0 +1,51 @@
|
|||||||
|
From 437ea859ca6fa13e1b4b5075c85f6a5ebe93cd01 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Franck Bui <fbui@suse.com>
|
||||||
|
Date: Wed, 17 Jul 2024 11:02:03 +0200
|
||||||
|
Subject: [PATCH 5003/5003] core: when switching root remove /run/systemd
|
||||||
|
before executing the binary specified by init=
|
||||||
|
|
||||||
|
It's important if the binary specified by the init= boot option is not systemd
|
||||||
|
otherwise it confuses systemctl that incorrectly assumes that systemd is still
|
||||||
|
the init system due to the presence of /run/systemd/system.
|
||||||
|
|
||||||
|
Also some tools might also check the presence of /run/systemd/private to test
|
||||||
|
if systemd is running as pid1.
|
||||||
|
|
||||||
|
(cherry picked from commit 8c28dd24427598214d4464565192ec3f3b1a74a4)
|
||||||
|
---
|
||||||
|
src/core/main.c | 12 ++++++++++++
|
||||||
|
1 file changed, 12 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/core/main.c b/src/core/main.c
|
||||||
|
index 4b8a315d86..ae8272d7e7 100644
|
||||||
|
--- a/src/core/main.c
|
||||||
|
+++ b/src/core/main.c
|
||||||
|
@@ -80,6 +80,7 @@
|
||||||
|
#include "psi-util.h"
|
||||||
|
#include "random-util.h"
|
||||||
|
#include "rlimit-util.h"
|
||||||
|
+#include "rm-rf.h"
|
||||||
|
#include "seccomp-util.h"
|
||||||
|
#include "selinux-setup.h"
|
||||||
|
#include "selinux-util.h"
|
||||||
|
@@ -2037,6 +2038,17 @@ static int do_reexecute(
|
||||||
|
arg_serialization = safe_fclose(arg_serialization);
|
||||||
|
fds = fdset_free(fds);
|
||||||
|
|
||||||
|
+ /* Drop /run/systemd directory. Some of its content can be used as a flag indicating that systemd is
|
||||||
|
+ * the init system but we might be replacing it with something different. If systemd is used again it
|
||||||
|
+ * will recreate the directory and its content anyway. */
|
||||||
|
+ r = rm_rf("/run/systemd.pre-switch-root", REMOVE_ROOT|REMOVE_MISSING_OK);
|
||||||
|
+ if (r < 0)
|
||||||
|
+ log_warning_errno(r, "Failed to prepare /run/systemd.pre-switch-root/, ignoring: %m");
|
||||||
|
+
|
||||||
|
+ r = RET_NERRNO(rename("/run/systemd", "/run/systemd.pre-switch-root"));
|
||||||
|
+ if (r < 0)
|
||||||
|
+ log_warning_errno(r, "Failed to move /run/systemd/ to /run/systemd.pre-switch-root/, ignoring: %m");
|
||||||
|
+
|
||||||
|
/* Reopen the console */
|
||||||
|
(void) make_console_stdio();
|
||||||
|
|
||||||
|
--
|
||||||
|
2.35.3
|
||||||
|
|
@ -1,3 +1,8 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Jul 22 12:06:23 UTC 2024 - Franck Bui <fbui@suse.com>
|
||||||
|
|
||||||
|
- Add temporarily 5003-core-when-switching-root-remove-run-systemd-before-e.patch (bsc#1227580)
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon Jul 22 11:53:27 UTC 2024 - Franck Bui <fbui@suse.com>
|
Mon Jul 22 11:53:27 UTC 2024 - Franck Bui <fbui@suse.com>
|
||||||
|
|
||||||
|
@ -234,6 +234,7 @@ Patch: 0009-pid1-handle-console-specificities-weirdness-for-s390.patch
|
|||||||
Patch: 5001-Revert-udev-update-devlink-with-the-newer-device-nod.patch
|
Patch: 5001-Revert-udev-update-devlink-with-the-newer-device-nod.patch
|
||||||
Patch: 5002-Revert-udev-revert-workarounds-for-issues-caused-by-.patch
|
Patch: 5002-Revert-udev-revert-workarounds-for-issues-caused-by-.patch
|
||||||
%endif
|
%endif
|
||||||
|
Patch: 5003-core-when-switching-root-remove-run-systemd-before-e.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Systemd is a system and service manager, compatible with SysV and LSB
|
Systemd is a system and service manager, compatible with SysV and LSB
|
||||||
|
Loading…
Reference in New Issue
Block a user