brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: journalctl MESSAGE_ID= lists every program that crashed with a core dump

Journalctl
~/tips/tip-journalctl-coredumps

journalctl MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1 -o short-iso

Get a list of crashes from the journal with one fixed message ID.

systemd gives some important log events a fixed ID, so you can find them without guessing their wording. A crash with a core dump is one of them.

When systemd-coredump handles a crash, it logs an entry with this ID:

journalctl MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1 -o short-iso

The catalog entry for that ID reads Process @COREDUMP_PID@ (@COREDUMP_COMM@) dumped core, so every line names the PID and the program. Add -b for this boot, or --since for a period. The same entries carry fields like COREDUMP_EXE, which you can list:

journalctl MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1 -F COREDUMP_EXE

That gives a short list of programs that have crashed in the history the journal still holds, which I find a nice health check on a server.

This needs systemd-coredump to be the crash handler. On Ubuntu and Debian it often is not installed, and apport or nothing at all catches the crash, so the query stays empty. Check with cat /proc/sys/kernel/core_pattern: it should mention systemd-coredump. With it installed, coredumpctl list is the friendlier tool for the same data.

Further reading: systemd-coredump man page, journalctl man page

More Journalctl tips journalctl -k -g 'killed process' --since "2 days ago" journalctl _PID=1 -b ls -lh /var/log/journal/*/*.journal~ Storage=volatile sudo journalctl --setup-keys All Journalctl tips (81) All topics

Link