journalctl -b -k: Kernel and Boot Logs
journalctl -b limits output to the current boot, and -k shows only kernel (dmesg) messages from the journal.
After a runner reboots or a job is killed mysteriously, the kernel log holds the evidence: an OOM kill, a disk error, or a watchdog reset. journalctl -b -k pulls exactly those lines.
What it does
journalctl -b restricts entries to the current boot; -b -1 is the previous boot. -k (or --dmesg) shows only kernel ring buffer messages, the same content as dmesg but persisted across reboots when the journal is persistent.
Common usage
journalctl -b -k --no-pager
journalctl -b -1 --no-pager # previous boot (e.g. before a crash)
journalctl -k --no-pager | grep -i "out of memory"
journalctl --list-boots # enumerate stored bootsOptions
| Flag | What it does |
|---|---|
| -b [N] | Current boot, or offset N (-1 = previous boot) |
| -k / --dmesg | Kernel messages only |
| --list-boots | List boot IDs the journal has retained |
| --since / --until | Narrow to a time window |
| --no-pager | Do not page output |
In CI
On a persistent-journal runner, journalctl -b -1 -k after an unexpected reboot shows what the kernel logged just before it went down, including Out of memory: Killed process lines that vanish from live dmesg after the reboot.
Common errors in CI
"Specifying boot ID or boot offset has no effect, no persistent journal was found." means the journal is volatile; only the current boot is available, so -b -1 returns nothing. Enable persistent storage with mkdir -p /var/log/journal if you need prior boots. In containers there is usually no kernel journal at all; read the host instead.