1

It is my understanding that the systemd journal cannot repair or fix errors revealed by:

journalctl --verify

Here's an example of an error I just saw. I routinely see errors like this on all the devices I manage.

FAIL: /var/log/journal/487de3ee24374fe3a1130c6f02b29c1c/system@000574a5ced401ce-c5e28a9a17d8bcc5.journal~ (Bad message)
391de0: Invalid entry item (30/31 offset: 000000                                                                      
391de0: Invalid object contents: Bad message                                                                          
File corruption detected at /var/log/journal/487de3ee24374fe3a1130c6f02b29c1c/user-1002@000574a5d289587f-58347489c1a50b4e.journal~:391de0 (of 8388608 bytes, 44%).

If my understanding is correct, the only solution is:

rm /var/log/journal/487de3ee24374fe3a1130c6f02b29c1c/system@000574a5ced401ce-c5e28a9a17d8bcc5.journal~

If true, is there a tool or script that will simply do this automatically? The device I just checked had 5 such files I had to delete. I like to run my maintenance in an automated script, but with this being such a common issue, I do not want to reinvent the wheel. So what are others doing? Surely someone has already automated this. If not, my first thought is along these lines:

journalctl --verify | grep 'File corruption detected at ' | ??? | xargs rm

However, that does not work (even before getting to the step with "???").

  • 1
    Yes, there's no way to fix/remove the corrupted journals via systemd tools: bugs.freedesktop.org/show_bug.cgi?id=64116 – don_crissti Sep 12 '18 at 1:48
  • @don_crissti Am I right in concluding, based on that bug report, that running journalctl --verify is useless? If there is no reason to act on corrupted files, why perform a verification to identify them? If I am not going to clean things up, I think I will simply stop running 'journalctl --verify'. Do I understand correctly? – MountainX Sep 12 '18 at 7:58
  • That'd be a good question on their mailing lists... – don_crissti Sep 12 '18 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.