diff --git a/debian/patches/apertis/Force-the-call-of-systemd-journal-flush-before-var-u.patch b/debian/patches/apertis/Force-the-call-of-systemd-journal-flush-before-var-u.patch new file mode 100644 index 0000000000000000000000000000000000000000..986abbd6d6171e097955c9a8e0561fbc44fcc498 --- /dev/null +++ b/debian/patches/apertis/Force-the-call-of-systemd-journal-flush-before-var-u.patch @@ -0,0 +1,41 @@ +From f09e75bfb76f747e966b5ee9c5843a66177871dd Mon Sep 17 00:00:00 2001 +From: Denis Pynkin <denis.pynkin@collabora.com> +Date: Tue, 17 Nov 2020 20:03:17 +0300 +Subject: [PATCH] Force the call of systemd-journal-flush before `/var` unmount + +The problem with failed `/var` unmount placed on separate partition +have a long story: https://github.com/systemd/systemd/issues/867 +According messages after the fix integrated into upstream -- there are +some corner cases which aren't fully fixed by patches adding [relinquish +options](https://gitlab.apertis.org/pkg/systemd/-/merge_requests/26) + +In case of ostree-based images we have a similar issue since `/var` is +bind-mounted in initramfs. Systemd is trying to unmount `/var` on +shutdown, however `ExecStop=` command from `systemd-journal-flush` +service is not executed during shutdown. +By adding `PartOf=var.mount` into service file we force the +`systemd-journal-flush.service` to be called prior the `/var` unmount. +This allow to unlock the bind-mount, since `journald` have a chance to +re-link it's journal into `/run` with `journalctl +--smart-relinquish-var` call. + +Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com> +--- + units/systemd-journal-flush.service.in | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/units/systemd-journal-flush.service.in b/units/systemd-journal-flush.service.in +index bacfe51..c10eece 100644 +--- a/units/systemd-journal-flush.service.in ++++ b/units/systemd-journal-flush.service.in +@@ -15,6 +15,7 @@ Requires=systemd-journald.service + After=systemd-journald.service systemd-remount-fs.service + Before=systemd-tmpfiles-setup.service + RequiresMountsFor=/var/log/journal ++PartOf=var.mount + + [Service] + ExecStart=@rootbindir@/journalctl --flush +-- +2.25.4 + diff --git a/debian/patches/series b/debian/patches/series index a30715a741abcdd698d8c1929ea303fe7ac8c0fb..0df46ac3e5fb9c58f0bc3ce92c647f22c5ad0df7 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -84,3 +84,4 @@ sd-boot-fix-menu-ordering-with-boot-counting.patch apertis/0101-basic-cap-list-parse-print-numerical-capabilities.patch apertis/0102-basic-capability-util-let-cap_last_cap-return-unsign.patch apertis/0103-basic-cap-list-reduce-scope-of-variables.patch +apertis/Force-the-call-of-systemd-journal-flush-before-var-u.patch