Is there a reasonable procedure for a system administrator to view all the fsck messages?

On my current Fedora 29 system, I can view all the fsck messages from my current boot like this:

sudo journalctl -b /usr/lib/systemd/systemd-fsck

However, it is a hack that assumes fsck writes messages to stdout / stderr. It does not allow for a hypothetical fsck which detects that it is run from systemd, and sends log messages through the syslog or journald socket e.g. in order to set appropriate "priority" for each message.

Is there a cleaner method, that works even if some fsck sends its log messages directly to journald?

1 Answer 1

sudo journalctl -b -u 'systemd-fsck*' 

The credit for this answer belongs here: https://unix.stackexchange.com/a/436033/29483

A second answer on the linked question notes that this method will not work on all systems, even if the system uses systemd. One reason is if the initramfs, which runs fsck on the root filesystem (and /usr), does not use systemd. In this case the initramfs might arrange to save its fsck logs somewhere else, not in the journal.

You can also use sudo systemctl status 'systemd-fsck*', and it will work perfectly well according to my analysis. Although I cannot think of a reason why you would prefer this. systemctl status only shows the last ten messages for each unit by default.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .