From 4d5974638e7d76005c0ac1e7d000c7d4654474f9 Mon Sep 17 00:00:00 2001 From: Susant Sahani Date: Wed, 29 Mar 2023 10:14:14 +0000 Subject: [PATCH] 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: https://github.com/dracutdevs/dracut/issues/2211 - systemd: https://github.com/systemd/systemd/issues/26488 Temporary patch applied until this issue is resolved https://github.com/systemd/systemd/pull/26494 See https://github.com/systemd/systemd/issues/26488#issuecomment-1438196977 Change-Id: I1964ff2a82b7c2d6c53e02b4368a8d5d6f9a03a1 Signed-off-by: Tapas Kundu Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/20134 --- SPECS/systemd/systemd-issue-26494.patch | 30 +++++++++++++++++++++++++ SPECS/systemd/systemd.spec | 7 +++++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 SPECS/systemd/systemd-issue-26494.patch diff --git a/SPECS/systemd/systemd-issue-26494.patch b/SPECS/systemd/systemd-issue-26494.patch new file mode 100644 index 0000000000..19bc67b558 --- /dev/null +++ b/SPECS/systemd/systemd-issue-26494.patch @@ -0,0 +1,30 @@ +From 6b25470ee28843a49c50442e9d8a98edc842ceca Mon Sep 17 00:00:00 2001 +From: Yu Watanabe +Date: Mon, 20 Feb 2023 12:00:30 +0900 +Subject: [PATCH] core/manager: run generators directly when we are in initrd + +Some initrd system write files at ourside of /run, /etc, or other +allowed places. This is a kind of workaround, but in most cases, such +sandboxing is not necessary as the filesystem is on ramfs when we are in +initrd. + +Fixes #26488. +--- + src/core/manager.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/core/manager.c b/src/core/manager.c +index 7b394794b0d4..306477c6e6c2 100644 +--- a/src/core/manager.c ++++ b/src/core/manager.c +@@ -3822,8 +3822,8 @@ static int manager_run_generators(Manager *m) { + /* If we are the system manager, we fork and invoke the generators in a sanitized mount namespace. If + * we are the user manager, let's just execute the generators directly. We might not have the + * necessary privileges, and the system manager has already mounted /tmp/ and everything else for us. +- */ +- if (MANAGER_IS_USER(m)) { ++ * If we are in initrd, let's also execute the generators directly, as we are in ramfs. */ ++ if (MANAGER_IS_USER(m) || in_initrd()) { + r = manager_execute_generators(m, paths, /* remount_ro= */ false); + goto finish; + } diff --git a/SPECS/systemd/systemd.spec b/SPECS/systemd/systemd.spec index 52f3be2494..c298b61110 100644 --- a/SPECS/systemd/systemd.spec +++ b/SPECS/systemd/systemd.spec @@ -3,7 +3,7 @@ Name: systemd URL: http://www.freedesktop.org/wiki/Software/systemd Version: 253 -Release: 1%{?dist} +Release: 2%{?dist} License: LGPLv2+ and GPLv2+ and MIT Summary: System and Service Manager Group: System Environment/Security @@ -17,7 +17,9 @@ Source1: 99-vmware-hotplug.rules Source2: 50-security-hardening.conf Source3: %{name}.cfg Source4: 99-dhcp-en.network +%ifarch x86_64 Source5: 10-rdrand-rng.conf +%endif Source6: 10-defaults.preset Source11: macros.sysusers @@ -28,6 +30,7 @@ Source14: sysusers.generate-pre.sh Patch0: enoX-uses-instance-number-for-vmware-hv.patch Patch1: fetch-dns-servers-from-environment.patch Patch2: use-bfq-scheduler.patch +Patch3: systemd-issue-26494.patch Requires: Linux-PAM Requires: bzip2 @@ -705,6 +708,8 @@ fi %files lang -f ../%{name}.lang %changelog +* Wed Mar 29 2023 Susant Sahani 253-2 +- https://github.com/systemd/systemd/pull/26494.patch. * Thu Feb 16 2023 Susant Sahani 253-1 - Version bump. * Tue Feb 07 2023 Shreenidhi Shedi 252.4-9