LinuxCritical

Kernel Panic in Linux: Causes and Recovery Methods

Kernel panic is a fatal Linux kernel error that halts the entire system. This article helps you identify the cause through logs, check hardware, and restore system functionality.

Updated at February 17, 2026
15-30 min
Medium
FixPedia Team
Применимо к:Ubuntu 20.04+CentOS 7+Debian 10+Fedora 35+Linux kernel 4.15+

What a Kernel Panic Error Means

Kernel panic is a critical state in Linux where the kernel detects an unrecoverable error and stops all system processes to prevent data corruption. Instead of the familiar Windows Blue Screen of Death, you'll see monochrome text on the console (or via a serial console), containing:

  • The message Kernel panic - not syncing: ...
  • The panic address (e.g., CPU: 0 PID: 1 Comm: systemd Not tainted ...)
  • The kernel call stack (traceback)
  • Information about loaded modules

After this, the system completely freezes, requiring a reboot. Unlike user-space crashes, a kernel panic cannot be handled by an application—it is the kernel's last line of defense.

Common Causes

A kernel panic occurs when the kernel attempts an action that violates its internal integrity. Primary causes include:

  1. Faulty hardware:
    • Defective RAM (bad bits, timing issues)
    • CPU problems (overheating, factory defects)
    • Corrupted disk sectors (especially on /boot or the root filesystem)
    • Motherboard or controller failures
  2. Corrupted/incompatible drivers:
    • Outdated proprietary drivers (NVIDIA, Broadcom Wi-Fi)
    • Drivers compiled for a different kernel version
    • Module conflicts (e.g., two drivers for the same device)
  3. Kernel bugs:
    • Issues in unstable kernel releases (e.g., 5.15-rc)
    • Problems with patches (especially in self-compiled kernels)
  4. System file corruption:
    • Improper kernel updates (/boot/vmlinuz-*, modules in /lib/modules/)
    • Attacks or manual interventions that altered kernel binaries
  5. Resource exhaustion:
    • Kernel memory leaks (e.g., in modules)
    • Kernel stack overflows (out-of-bounds accesses)
  6. Incorrect boot parameters:
    • Wrong options in GRUB (e.g., mem=, acpi=)
    • Outdated parameters for new hardware

Troubleshooting Methods

Method 1: Analyze Kernel Logs

First, gather information about the panic. If the system won't boot, use recovery mode or boot from a live system to mount the root partition and copy logs.

Commands for analysis:

# View recent kernel errors (requires booting into recovery or chroot)
journalctl -k -p err --no-pager

# Alternatively, via dmesg (may be cleared on reboot)
dmesg -T | grep -i "panic\|error\|bug\|tainted"

# If panic occurred during boot, logs may be in /var/crash/
ls /var/crash/

What to look for:

  • The phrase Kernel panic - not syncing: ... — a brief description.
  • Lines with Call Trace — the call stack, indicating a kernel function.
  • Mentions of modules: module xyz is tainted or xyz.ko.
  • Addresses in brackets, e.g., [<ffffffff81234567>] — can be decoded via /proc/kallsyms.

💡 Tip: If the panic repeats, add the panic=10 parameter to GRUB (in the GRUB_CMDLINE_LINUX section) so the system automatically reboots after 10 seconds. This simplifies log collection via serial console or netconsole.

Method 2: Test RAM

RAM errors are a common cause of kernel panics. memtest86+ is the standard tool for testing.

How to run:

  1. Reboot the system.
  2. In the GRUB menu, select Memory test (memtest86+).
  3. Wait for at least one full cycle to complete (Pass 1/4).
  4. Any errors (Address, Status) require replacing the memory modules.

⚠️ Important: For servers, use ECC memory and regular monitoring via edac-util (apt install edac-utils).

Method 3: Check Disks and Filesystem

Corrupted sectors can cause panics when the kernel accesses /boot or system files.

Disk check (SMART):

# Install smartmontools if not present
sudo apt install smartmontools  # Debian/Ubuntu
sudo yum install smartmontools  # CentOS/RHEL

# View disk status (replace /dev/sda with your device)
sudo smartctl -a /dev/sda

# Look for:
# - SMART overall-health self-assessment test result
# - Attributes: Reallocated_Sector_Ct, Current_Pending_Sector
# - Self-Test results (should be PASSED)

Filesystem check:

# Only for unmounted partitions! For the root partition, use a live system.
sudo fsck -f /dev/sda1  # Replace with your root partition

# For journaling filesystems (ext4, btrfs) also:
sudo btrfs check /dev/sda1  # if using btrfs

If SMART shows many reallocated or pending sectors, replace the disk.

Method 4: Update or Roll Back the Kernel

If the panic appeared after a kernel or driver update, try booting with a previous version.

Boot with an older kernel:

  1. In the GRUB menu, select Advanced options for Ubuntu.
  2. Choose an entry marked (recovery mode) or without -generic (if you updated).
  3. If the system boots, remove the problematic kernel:
    # Debian/Ubuntu
    sudo apt remove linux-image-5.19.0-32-generic  # example
    sudo update-grub
    
    # CentOS/RHEL
    sudo yum remove kernel-5.14.0-362.8.1.el8_5.x86_64
    sudo grub2-mkconfig -o /boot/grub2/grub.cfg
    

Update to a stable kernel:

# Ubuntu/Debian
sudo apt update
sudo apt install linux-image-generic-hwe-22.04  # e.g., for LTS
sudo reboot

# CentOS/RHEL (use AppStream for newer kernels)
sudo yum install kernel
sudo reboot

Method 5: Check Drivers and Modules

Problematic modules often cause panics. Pay special attention to proprietary drivers (NVIDIA, VirtualBox, Wi-Fi).

View loaded modules:

lsmod | grep -E "nvidia|vmw|b43|wl"  # example problematic modules

Remove a module (in recovery mode):

# Remove module from current boot (temporarily)
sudo rmmod nvidia_drm

# To prevent loading, remove the package or comment in /etc/modules-load.d/
sudo apt purge nvidia-driver-525  # Debian/Ubuntu

If the panic disappears, update the driver via official repositories or use open-source alternatives (e.g., nouveau instead of NVIDIA).

Method 6: System Rescue via Rescue Mode

If the system won't boot even with an older kernel, use rescue mode.

Boot into rescue mode:

  1. In the GRUB menu, select the (recovery mode) entry.
  2. In the recovery menu, select root (to get a root shell).
  3. Unmount and check integrity:
    # Remount root partition as read-write
    mount -o remount,rw /
    
    # Check for broken symlinks or corrupted binaries
    find /boot -type f -exec file {} \; | grep -v "ELF.*64-bit"
    
    # Reinstall kernel packages (if files are corrupted)
    sudo apt install --reinstall linux-image-$(uname -r)  # Debian/Ubuntu
    sudo yum reinstall kernel  # CentOS/RHEL
    
    # Check GRUB configuration
    cat /etc/default/grub | grep -i "quiet splash"
    # Remove "quiet splash" for debugging, then update-grub
    

Prevention

To minimize kernel panic risk:

  1. Use stable kernel versions in production environments. Avoid -rc and -git builds on working machines.
  2. Test updates on a staging system before deployment. Especially kernel and driver updates.
  3. Log monitoring:
    # Automatic monitoring for panic messages
    sudo journalctl -f -k | grep -i "panic"
    
  4. Hardware reliability:
    • ECC memory for servers.
    • Regular SMART disk tests (smartctl -t long).
    • Temperature monitoring (e.g., sensors).
  5. Back up /boot and GRUB configurations before updates.
  6. Avoid mixing drivers from different sources (e.g., NVIDIA drivers from a .run file and from the repository).

If panics occur on specific hardware (e.g., after installing a new GPU), check compatibility in your distribution's documentation.

F.A.Q.

What is a kernel panic and why does it occur?
How can I determine the cause of a kernel panic?
Can kernel panic be prevented?
What should I do if the system fails to boot after a kernel panic?

Hints

Analyzing kernel logs
Checking RAM
Checking disks and filesystem
Updating or rolling back the kernel
Checking drivers and modules
System recovery via rescue mode

Did this article help you solve the problem?

FixPedia

Free encyclopedia for fixing errors. Step-by-step guides for Windows, Linux, macOS and more.

© 2026 FixPedia. All materials are available for free.

Made with for the community