Description of problem: journalctl --follow will exit immediately if there are initially no matching entries. Instead, it should block until a matching entry is appended to the journal. Example: If you have a new service unit that has never been started, the following will not give the expected result: term1# journalctl -f -u new-service -- No entries -- term2# systemctl start new-service I would expect journalctl in term1 to block and then show the entries produced by new-service.unit when it is eventually started in term2. Version-Release number of selected component (if applicable): systemd-219-21.fc22.x86_64 How reproducible: Always Steps to Reproduce: 1. journalctl -f -u nonexisting.service; echo Status $? Actual results: -- No entries -- Status 0 Expected results: <no output and journalctl blocks forever> Additional info: This is a regression.
This breaks Cockpit: https://github.com/cockpit-project/cockpit/issues/2571
This is caused by 0273-journalctl-properly-detect-empty-journal-files.patch which causes journalctl to exit early when there no matches, even with --follow. That patch should probably look like this: diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -2057,6 +2057,10 @@ int main(int argc, char *argv[]) { log_error_errno(r, "Failed to iterate through journal: %m"); return EXIT_FAILURE; } + if (r == 0 && !arg_follow) { + printf("-- No entries --\n"); + goto finish; + } if (!arg_follow) pager_open_if_enabled();
This regression is in systemd-219-21 systemd-219-20 isn't affected.
The commit containing the regression: commit 02ab86c732576a71179ce12e97d44c289833236d Author: Lennart Poettering <lennart> Date: Fri Jul 24 02:10:32 2015 +0200 journalctl: properly detect empty journal files When we encounter a journal file with exactly zero entries, print a nice message and exit, and don't print a weird error message.
The fix posted by Marius above still has the symptom of printing strange messages like: Failed to get realtime timestamp: Cannot assign requested address Posted a patch upstream which accounts for that: https://github.com/systemd/systemd/pull/958
Fix merged upstream: https://github.com/systemd/systemd/pull/958
Cockpit has temporarily disabled testing the journal in its test suite for this regressed systemd version: 219-21 However Cockpit is still broken by this bug.
http://pkgs.fedoraproject.org/cgit/systemd.git/commit/?h=f22&id=809b914fcad779f48b72d2f8c0345d9c0fe567d6
Fixed by https://bodhi.fedoraproject.org/updates/systemd-219-23.fc22