journal: don't remove the flushed flag when journald is stopped
authorFranck Bui <fbui@suse.com>
Wed, 1 Dec 2021 07:51:48 +0000 (08:51 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 11 Jan 2022 18:14:30 +0000 (19:14 +0100)
commit8800d99d4fe4781b6ed265580b795b4a78a36fe8
tree7001516c2aa96b860e1cfc2a3d642baf6d76b646
parent4d4b70277539f21c0dcbbac37bc75abe4c01d00f
journal: don't remove the flushed flag when journald is stopped

Due to the fact that systemd-journal-flush.service has
"Requires=systemd-journald.service", this service is stopped too when journald
is requested to do so.

However stopping systemd-journal-flush.service implies that journald
relinquishes /var hence implicitly switching back to the volatile storage
mode and removing /run/systemd/journal/flushed.

If journald is started afterwards, it will run in volatile storage mode
regardless of the value of 'Storage=' as it believes now that /var is not yet
ready (because the flushed flag is missing).

Because this flag is mainly an indication for journald that the initialization
of /var/log/journal (during the boot process) has been done,
systemd-journal-flush.service shouldn't be tied to the state of journald itself
but to the state of /var/log/journal, hence to the state of the system.

(cherry picked from commit d5ee050ffc9d413253932d9340ade8c8fb111092)
units/systemd-journal-flush.service