From 0557da4982bbd0eab06b945bd9686865086bce1f Mon Sep 17 00:00:00 2001 From: Mathieu Tortuyaux Date: Thu, 10 Aug 2023 14:31:30 +0200 Subject: [PATCH] sys-apps/systemd: add systemd patch from v252.12 If fixes an issue with Systemd service restart when the main process is being killed by a SIGHUP signal. See also: https://github.com/flatcar/Flatcar/issues/1157 Commit-Ref: https://github.com/systemd/systemd-stable/commit/34e834f496338fdc2a8a8cc771cba4082079cf9a Signed-off-by: Mathieu Tortuyaux --- .../2023-08-10-systemd-restart-service.md | 1 + ...-when-resetting-PID-also-reset-known.patch | 40 +++++++++++++++++++ ...252.11.ebuild => systemd-252.11-r1.ebuild} | 1 + 3 files changed, 42 insertions(+) create mode 100644 changelog/bugfixes/2023-08-10-systemd-restart-service.md create mode 100644 sdk_container/src/third_party/coreos-overlay/sys-apps/systemd/files/0008-Revert-core-service-when-resetting-PID-also-reset-known.patch rename sdk_container/src/third_party/coreos-overlay/sys-apps/systemd/{systemd-252.11.ebuild => systemd-252.11-r1.ebuild} (99%) diff --git a/changelog/bugfixes/2023-08-10-systemd-restart-service.md b/changelog/bugfixes/2023-08-10-systemd-restart-service.md new file mode 100644 index 00000000000..34421354e02 --- /dev/null +++ b/changelog/bugfixes/2023-08-10-systemd-restart-service.md @@ -0,0 +1 @@ +- Fixed the restart of Systemd services when the main process is being killed by a SIGHUP signal ([flatcar#1157](https://github.com/flatcar/Flatcar/issues/1157)) diff --git a/sdk_container/src/third_party/coreos-overlay/sys-apps/systemd/files/0008-Revert-core-service-when-resetting-PID-also-reset-known.patch b/sdk_container/src/third_party/coreos-overlay/sys-apps/systemd/files/0008-Revert-core-service-when-resetting-PID-also-reset-known.patch new file mode 100644 index 00000000000..b7938941090 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/sys-apps/systemd/files/0008-Revert-core-service-when-resetting-PID-also-reset-known.patch @@ -0,0 +1,40 @@ +From 34e834f496338fdc2a8a8cc771cba4082079cf9a Mon Sep 17 00:00:00 2001 +From: msizanoen +Date: Mon, 12 Jun 2023 10:30:12 +0700 +Subject: [PATCH] Revert "core/service: when resetting PID also reset known + flag" + +This reverts commit ff32060f2ed37b68dc26256b05e2e69013b0ecfe. + +This change is incorrect as we don't want to mark the PID as invalid but +only mark it as dead. + +The change in question also breaks user level socket activation for +`podman.service` as the termination of the main `podman system service` +process is not properly handled, causing any application accessing the +socket to hang. + +This is because the user-level `podman.service` unit also hosts two +non-main processes: `rootlessport` and `rootlessport-child` which causes +the `cgroup_good` check to still succeed. + +The original submitter of this commit is recommended to find another +more correct way to fix the cgroupsv1 issue on CentOS 8. + +(cherry picked from commit f29f0877c5abfd03060838d1812ea6fdff3b0b37) +--- + src/core/service.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/src/core/service.c b/src/core/service.c +index c05f13c765..211f72900e 100644 +--- a/src/core/service.c ++++ b/src/core/service.c +@@ -3529,7 +3529,6 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) { + return; + + s->main_pid = 0; +- s->main_pid_known = false; + exec_status_exit(&s->main_exec_status, &s->exec_context, pid, code, status); + + if (s->main_command) { diff --git a/sdk_container/src/third_party/coreos-overlay/sys-apps/systemd/systemd-252.11.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-apps/systemd/systemd-252.11-r1.ebuild similarity index 99% rename from sdk_container/src/third_party/coreos-overlay/sys-apps/systemd/systemd-252.11.ebuild rename to sdk_container/src/third_party/coreos-overlay/sys-apps/systemd/systemd-252.11-r1.ebuild index 6e743db7f62..796f927fde1 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-apps/systemd/systemd-252.11.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/sys-apps/systemd/systemd-252.11-r1.ebuild @@ -248,6 +248,7 @@ src_prepare() { "${FILESDIR}/0005-systemd-Disable-SELinux-permissions-checks.patch" "${FILESDIR}/0006-Revert-getty-Pass-tty-to-use-by-agetty-via-stdin.patch" "${FILESDIR}/0007-units-Keep-using-old-journal-file-format.patch" + "${FILESDIR}/0008-Revert-core-service-when-resetting-PID-also-reset-known.patch" ) if ! use vanilla; then