From f943ab6efbcdccd6f656fc868f3cf426ebdd3a33 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 27 Nov 2025 13:06:47 +0100 Subject: [PATCH] systemctl: stop showing last message from previous run --lines=1 means that we show the last message about the unit, whatever it is: $ SYSTEMD_LOG_LEVEL=debug systemctl --verbose start demo2 ... Invoking 'journalctl -q --follow --no-pager --lines=1 --synchronize-on-exit=yes --unit=demo2.service' as child. ... Directory /var/log/journal/7d16833bfa924410851e2a193bcfd4ba added. Journal effective settings seal=no keyed_hash=yes compress=ZSTD compress_threshold_bytes=8B ... Reiterating files to get inotify watches established. Considering root directory '/run/log/journal'. Considering root directory '/var/log/journal'. Considering directory '/var/log/journal/7d16833bfa924410851e2a193bcfd4ba'. Nov 26 17:24:35 rawhide systemd[1]: Finished demo2.service. ... Executing dbus call org.freedesktop.systemd1.Manager StartUnit(demo2.service, replace) ... Job for demo2.service finished. Got result done/Success for job demo2.service. journal: Sending message: {"method":"io.systemd.Journal.Synchronize","parameters":{"offline":false}} Nov 27 13:05:30 rawhide systemd[1]: Starting demo2.service... Nov 27 13:05:30 rawhide systemd[1]: demo2.service: Deactivated successfully. Nov 27 13:05:30 rawhide systemd[1]: Finished demo2.service. ... We obviously should only show _new_ messages, hence change to --lines=0. This works properly after the fix in the previous commit. Fixes #39048. --- src/shared/fork-notify.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/fork-notify.c b/src/shared/fork-notify.c index 624ddab8d15..cf014c25930 100644 --- a/src/shared/fork-notify.c +++ b/src/shared/fork-notify.c @@ -219,7 +219,7 @@ int journal_fork(RuntimeScope scope, char * const* units, PidRef *ret_pidref) { "-q", "--follow", "--no-pager", - "--lines=1", + "--lines=0", "--synchronize-on-exit=yes"); if (!argv) return log_oom_debug(); -- 2.47.3