Skip to content

Commit 4d59746

Browse files
ssahanitapakund
authored andcommitted
systemd: core/manager: run generators directly when we are in initrd
lvm with latest systemd and dracut doesn't boot up. Upstream issues for reference: - dracut: dracutdevs/dracut#2211 - systemd: systemd/systemd#26488 Temporary patch applied until this issue is resolved systemd/systemd#26494 See systemd/systemd#26488 (comment) Change-Id: I1964ff2a82b7c2d6c53e02b4368a8d5d6f9a03a1 Signed-off-by: Tapas Kundu <tkundu@vmware.com> Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/20134
1 parent acf6c69 commit 4d59746

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
From 6b25470ee28843a49c50442e9d8a98edc842ceca Mon Sep 17 00:00:00 2001
2+
From: Yu Watanabe <watanabe.yu+github@gmail.com>
3+
Date: Mon, 20 Feb 2023 12:00:30 +0900
4+
Subject: [PATCH] core/manager: run generators directly when we are in initrd
5+
6+
Some initrd system write files at ourside of /run, /etc, or other
7+
allowed places. This is a kind of workaround, but in most cases, such
8+
sandboxing is not necessary as the filesystem is on ramfs when we are in
9+
initrd.
10+
11+
Fixes #26488.
12+
---
13+
src/core/manager.c | 4 ++--
14+
1 file changed, 2 insertions(+), 2 deletions(-)
15+
16+
diff --git a/src/core/manager.c b/src/core/manager.c
17+
index 7b394794b0d4..306477c6e6c2 100644
18+
--- a/src/core/manager.c
19+
+++ b/src/core/manager.c
20+
@@ -3822,8 +3822,8 @@ static int manager_run_generators(Manager *m) {
21+
/* If we are the system manager, we fork and invoke the generators in a sanitized mount namespace. If
22+
* we are the user manager, let's just execute the generators directly. We might not have the
23+
* necessary privileges, and the system manager has already mounted /tmp/ and everything else for us.
24+
- */
25+
- if (MANAGER_IS_USER(m)) {
26+
+ * If we are in initrd, let's also execute the generators directly, as we are in ramfs. */
27+
+ if (MANAGER_IS_USER(m) || in_initrd()) {
28+
r = manager_execute_generators(m, paths, /* remount_ro= */ false);
29+
goto finish;
30+
}

SPECS/systemd/systemd.spec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Name: systemd
44
URL: http://www.freedesktop.org/wiki/Software/systemd
55
Version: 253
6-
Release: 1%{?dist}
6+
Release: 2%{?dist}
77
License: LGPLv2+ and GPLv2+ and MIT
88
Summary: System and Service Manager
99
Group: System Environment/Security
@@ -17,7 +17,9 @@ Source1: 99-vmware-hotplug.rules
1717
Source2: 50-security-hardening.conf
1818
Source3: %{name}.cfg
1919
Source4: 99-dhcp-en.network
20+
%ifarch x86_64
2021
Source5: 10-rdrand-rng.conf
22+
%endif
2123
Source6: 10-defaults.preset
2224

2325
Source11: macros.sysusers
@@ -28,6 +30,7 @@ Source14: sysusers.generate-pre.sh
2830
Patch0: enoX-uses-instance-number-for-vmware-hv.patch
2931
Patch1: fetch-dns-servers-from-environment.patch
3032
Patch2: use-bfq-scheduler.patch
33+
Patch3: systemd-issue-26494.patch
3134

3235
Requires: Linux-PAM
3336
Requires: bzip2
@@ -705,6 +708,8 @@ fi
705708
%files lang -f ../%{name}.lang
706709

707710
%changelog
711+
* Wed Mar 29 2023 Susant Sahani <ssahani@vmware.com> 253-2
712+
- https://github.com/systemd/systemd/pull/26494.patch.
708713
* Thu Feb 16 2023 Susant Sahani <ssahani@vmware.com> 253-1
709714
- Version bump.
710715
* Tue Feb 07 2023 Shreenidhi Shedi <sshedi@vmware.com> 252.4-9

0 commit comments

Comments
 (0)