[GoLUG] systemd-journal-flush.service

Ron admin at bclug.ca
Fri Feb 28 06:09:27 EST 2025


Omer Zak wrote on 2025-02-28 02:41:

> I found that the systemd-journal-flush.service takes long time (28
> seconds in my system) during boot time, and a lot of stuff waits for it
> to finish.

Interesting.  On mine, it takes 446ms.

On a really slow, old system (12+ years old) running a VM with Nextcloud 
(i.e. reasonably busy), it clocks in at 8.451s.


So, 28 seconds is really, really high.



> Any suggestions how to reduce this part of boot time?

Looking at that unit's status:

$ systemctl status systemd-journal-flush.service
● systemd-journal-flush.service - Flush Journal to Persistent Storage


It's writing journal files out to disk.


I suspect you have a *lot* of log files in /var/log/journal, and when 
"persisting" the files from /run/log/journal, there's some expensive 
writes going on.


What does this say:

journalctl --disk-usage

?  If the numbers are really high, clear out some old logs. My numbers 
are from 2.1G to 3.2G, so I should probably clean up some.



To do that, some invocation of

journalctl --vacuum{size|files|time}

will clear up space.  Man pages are helpful here.  Also, the --rotate 
option is good to add.




Also, what does this show:

journalctl --unit systemd-journal-flush

That should show the unit in action with start and finish times.  I'm 
seeing intervals that appear to be about 8 seconds, per the 
systemd-analyze blame output.



Good info here:

https://askubuntu.com/questions/1094389/what-is-the-use-of-systemd-journal-flush-service





Final few thoughts:

Was a previous reboot a hard-reset instead of a normal shutdown, maybe?


Are you perhaps having imminent disk failure (see smartctl output for 
self-reporting).


My old system is on a painfully slow disk, yet is under 8½ seconds.




(Now you've got me noticing that certbot is slow as heck:

1min 59.470s certbot.service

I wonder if I need to do something about that?)

(It's nice to see at a glance what's going on under the hood though!)




More information about the GoLUG mailing list