A kernel oops is not the same as a kernel panic, and confusing the two costs time during an outage. This post explains what each event means, how to capture the evidence, and how to debug a production Linux node without guessing.

Oops vs Panic: What Actually Happened

The Linux kernel runs in privileged mode. When it encounters a fault it cannot handle safely, it has two main ways to fail: an oops or a panic.

Kernel Oops

An oops is a kernel exception, usually a bad memory access, invalid instruction, or divide-by-zero in kernel space. The kernel tries to isolate the fault, kill the offending task, and keep running. The system stays up, but the affected process may die, and the kernel is now tainted. Any subsequent behavior is suspect.

bash
dmesg | grep -i oops

Kernel Panic

A panic is fatal. The kernel decides it can no longer guarantee data safety, so it halts the system. On a server, this usually means an immediate reboot if kernel.panic is set, or a frozen console if it is not. A panic often follows an oops that corrupted something critical, but it can also happen directly from a failed filesystem mount, a broken init process, or a hardware watchdog trip.

Capturing the Evidence

You cannot debug a crash from memory alone. You need logs, and ideally a memory dump.

dmesg and journalctl

dmesg shows the kernel ring buffer. After a reboot, the previous buffer is usually gone unless you have persistent logging configured.

bash
journalctl -k --since "2 hours ago"

Look for BUG: unable to handle kernel paging request, Call Trace:, RIP:, and CPU:. The instruction pointer and register dump tell you which driver or subsystem faulted.

kdump and vmcore

For production nodes, configure kdump. It boots a small capture kernel that saves the memory of the crashed kernel to disk as a vmcore file. You can then analyze it with crash or gdb.

bash
# /etc/default/grub example
GRUB_CMDLINE_LINUX="crashkernel=256M"

After a crash, check /var/crash/ for the dump.

A Typical Debugging Scenario

Say a database node reboots itself every few days. No application logs explain it. The console shows a kernel panic mentioning tcp_sendmsg and sk_buff.

First, check the previous boot's kernel logs:

bash
journalctl -k -b -1

You see a NULL pointer dereference in a network driver module. The Call Trace points to a third-party out-of-tree driver for a NIC. Because the kernel is tainted after the oops, later panics may be symptoms, not the root cause.

Next, verify whether the module is still supported:

bash
lsmod | grep nic_driver
modinfo nic_driver | grep version

If the driver is outdated, the fix is usually a firmware update, a driver module update, or replacing the NIC. Without the vmcore, you would be guessing between memory failure, a kernel bug, and a bad cable.

Common Causes and What to Check

Cause Typical Signal Where to Look
Bad kernel module Oops in module stack trace lsmod, dmesg, module license
Faulty RAM Random panics, memory corruption memtest86+, edac-utils, mcelog
CPU overheating Panic under load, thermal events `dmesg
Storage failure Panic during filesystem operations journalctl -k, smartctl
Kernel bug Reproducible oops in mainline code Kernel version, upstream bug tracker

Hardening Production Nodes

You cannot prevent every kernel fault, but you can reduce the blast radius and speed up recovery.

  • Enable kdump on all production hosts and test that vmcore is captured.
  • Set kernel.panic=10 so the node reboots automatically after 10 seconds instead of hanging.
  • Keep out-of-tree kernel modules to a minimum; they taint the kernel and complicate debugging.
  • Send dmesg and journalctl to a central log server so logs survive a reboot.
  • Run hardware diagnostics (memory, disk, CPU) during scheduled maintenance, not after an outage.

Takeaway

When a Linux node crashes, distinguish an oops from a panic, preserve the kernel log before rebooting, and configure kdump so you have a vmcore to analyze. Most production kernel crashes are solvable with the right dump and a clear stack trace; without them, you are just restarting and hoping.

IFLEON can help teams harden Linux infrastructure and build observability around kernel-level failures.