I have arch linux failing on a device. The device doesn't have any screen, it doesn't respond to network. So I take its SD card, insert it in ubuntu desktop, see a fresh system.journal there and... How to see what is inside?

From the Arch Linux documentation I know that I can do:

 strings /mnt/arch/var/log/journal/.../system.journal | grep -i message

But it is really basic. The question is:

Is there more convenient way to inspect system.journal from another system, than using strings? Can I for example specify the file to read for journalctl?

  • 1
    what about journalctl --file=file_to_examine ?
    – taliezin
    May 2 '15 at 12:23

First, the ability to use strings stems from a mere coincidence in that journald does not compress small (below 64KiB in current implementation) fields. This is not a supported way to read journals, and in the archwiki it really should be marked as such. It is more of a last-ditch recovery method.

Now on to the question. From journalctl(1):

-D DIR, --directory=DIR

Takes a directory path as argument. If specified, journalctl will operate on the specified journal directory DIR instead of the default runtime and system journal paths.

So, assuming that the broken system's rootfs is mounted under $DEST, use journalctl -D $DEST/var/log/journal to view its system log.

For sake of completeness: in order to view a specific file, use journalctl --file, e. g. journalctl --file /var/log/journal/$(cat /etc/machine-id)/system.journal. However, as the journal files are rotated periodically, this form is not really usable for viewing complete journals.

  • What to do on non-systemd distributions, like some rescue systems?
    – Turion
    Apr 13 '21 at 18:38
  • 1
    @Turion Use a rescue system that provides a journalctl binary. It does not require a running systemd.
    – intelfx
    Apr 13 '21 at 21:29

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.