DEV Community

Cover image for Troubleshoot Your Last Boot Crash on Linux
Jakariya Abbas
Jakariya Abbas

Posted on

2 1 1 1 1

Troubleshoot Your Last Boot Crash on Linux

When your Linux system crashes, understanding the cause is crucial for troubleshooting. The journalctl command helps you analyze system logs, including crash reports. This guide explains how to use journalctl to check why your system crashed in the last boot.

Step 1: View Logs from the Previous Boot

To check logs from the last boot, use the following command:

journalctl -b -1
Enter fullscreen mode Exit fullscreen mode

Here, -b -1 means "show logs from the previous boot." If you want logs from two boots ago, use -b -2, and so on.

Step 2: Filter Logs for Errors

To see only errors from the last boot, run:

journalctl -b -1 -p 3
Enter fullscreen mode Exit fullscreen mode

The -p 3 option filters logs by priority, showing only errors (priority 3) and higher (critical and alert messages).

Step 3: Check Kernel Logs

Kernel messages often contain information about crashes. To see only kernel logs from the last boot, use:

journalctl -k -b -1
Enter fullscreen mode Exit fullscreen mode

Step 4: Identify the Crash Reason with Systemd Logs

To find if systemd recorded any failures, run:

journalctl -b -1 -u systemd-coredump
Enter fullscreen mode Exit fullscreen mode

The systemd-coredump service logs crash dumps of applications, which can help pinpoint the issue.

Step 5: Analyze Segmentation Faults and Core Dumps

If a program caused a segmentation fault, you can check:

journalctl -b -1 | grep 'segfault'
Enter fullscreen mode Exit fullscreen mode

For core dump analysis, run:

coredumpctl list
Enter fullscreen mode Exit fullscreen mode

To inspect a specific core dump:

coredumpctl info <PID>
Enter fullscreen mode Exit fullscreen mode

Replace <PID> with the process ID from the coredumpctl list output.

Step 6: Check Power or Hardware Issues

If you suspect power failures or hardware issues, look for messages related to abrupt shutdowns:

journalctl -b -1 | grep -i 'power off'
Enter fullscreen mode Exit fullscreen mode

To check for disk errors:

journalctl -b -1 | grep -i 'I/O error'
Enter fullscreen mode Exit fullscreen mode

By using journalctl, you can investigate the cause of a system crash and take appropriate action. If logs indicate software issues, updating or reinstalling the package may help. If hardware failures are detected, consider checking system components.

These easy steps will help you effectively diagnose and resolve crashes in Linux. For more details on journal logs and troubleshooting in Linux, visit ArchWiki:

Image of Timescale

PostgreSQL for Agentic AI — Build Autonomous Apps on One Stack

pgai turns PostgreSQL into an AI-native database for building RAG pipelines and intelligent agents. Run vector search, embeddings, and LLMs—all in SQL

Build Today

Top comments (0)

Image of Timescale

PostgreSQL for Agentic AI — Build Autonomous Apps on One Stack 1️⃣

pgai turns PostgreSQL into an AI-native database for building RAG pipelines and intelligent agents. Run vector search, embeddings, and LLMs—all in SQL

Build Today

👋 Kindness is contagious

DEV is better (more customized, reading settings like dark mode etc) when you're signed in!

Okay