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:

Jetbrains image

Build Secure, Ship Fast

Discover best practices to secure CI/CD without slowing down your pipeline.

Read more

Top comments (0)

Image of Quadratic

Free AI chart generator

Upload data, describe your vision, and get Python-powered, AI-generated charts instantly.

Try Quadratic free

👋 Kindness is contagious

Dive into this insightful write-up, celebrated within the collaborative DEV Community. Developers at any stage are invited to contribute and elevate our shared skills.

A simple "thank you" can boost someone’s spirits—leave your kudos in the comments!

On DEV, exchanging ideas fuels progress and deepens our connections. If this post helped you, a brief note of thanks goes a long way.

Okay