Linux KERNEL_PANICCritical

Kernel Panic Ubuntu: How to Fix Kernel Error in 5 Steps

The article explains what kernel panic is in Ubuntu and provides practical ways to fix it, from simple to complex.

Updated at February 17, 2026
15-30 min
Medium
FixPedia Team
Применимо к:Ubuntu 20.04 LTSUbuntu 22.04 LTSUbuntu 24.04 LTS

What a kernel panic error means

Kernel panic — a critical error in the Linux kernel where the system immediately stops to prevent further damage. A message appears on the screen, such as: Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) or other variants. This error typically occurs during boot or while the system is running, rendering it unusable until rebooted. In Ubuntu, kernel panic is often related to kernel compatibility issues, drivers, or hardware.

Causes

Kernel panic can be caused by several specific issues:

  1. Corruption of kernel files or modules — for example, after a failed update, disk failure, or interrupted package installation.
  2. Driver conflicts — especially after installing new hardware (such as an NVIDIA graphics card) or updating drivers from third-party repositories.
  3. RAM (random-access memory) issues — faulty RAM modules often cause kernel panics due to read/write errors.
  4. Incorrect boot parameters in GRUB — such as wrong kernel options (like root= or ro) or outdated parameters after an update.
  5. File system corruption — especially the root file system (/), due to improper shutdown or disk failures.
  6. Hardware failures — CPU overheating, power issues, or faulty components (motherboard, controllers).
  7. Malware — rare on Linux, but possible if the system is compromised and the kernel is modified.

Solutions

We offer several ways to resolve kernel panic, starting with the simplest and safest.

Method 1: Booting into recovery mode

Recovery mode is a special Ubuntu mode that loads a minimal environment to recover the system without fully starting services.

  1. When turning on the computer, hold the Shift key (for BIOS systems) or Esc (for UEFI) to bring up the GRUB bootloader menu.
  2. In the GRUB menu, select "Advanced options for Ubuntu".
  3. In the submenu, find the entry marked "(recovery mode)" (usually second or third, for example, Ubuntu, with Linux 5.15.0-xx-generic (recovery mode)).
  4. After booting, a recovery menu appears. First, try "resume" — this normally boots the system. If that doesn't work, select "fsck" to check and automatically fix the file system. Then, if needed, enable "network" for network access (to download packages) and "root" to get a root shell.
  5. In the shell (in root mode), you can run commands to recover:
    # Update initramfs configuration (often fixes boot issues)
    update-initramfs -u
    # Complete interrupted package installations
    dpkg --configure -a
    # Reinstall the kernel (if you suspect corruption)
    apt install --reinstall linux-image-generic
    
  6. Reboot after changes: reboot.

Method 2: Updating the kernel and packages

An outdated or corrupted kernel is a common cause of kernel panic. Updating may resolve the issue.

  1. Boot into recovery mode (as in Method 1) and select "root" for shell access.
  2. Update the package list:
    apt update
    
  3. Install all updates, including the kernel:
    apt upgrade
    
    Or, to ensure the latest kernel is installed:
    apt install linux-generic
    
  4. Explicitly update the initramfs (initial RAM disk):
    update-initramfs -u -k all
    
  5. Reboot the system:
    reboot
    

If the system boots into normal mode, run the same commands from a regular terminal to keep it updated.

Method 3: Analyzing kernel logs

Kernel logs contain error details that help pinpoint the cause.

  1. Boot into recovery mode with networking enabled (select "network" in the menu) or use a bootable Live USB.
  2. View kernel logs with journalctl:
    # Show errors (level 3 and above) from the last boot
    journalctl -p 3 -xb
    # Or view the entire log for the current boot
    journalctl -k
    
    Alternatively, check log files:
    cat /var/log/kern.log | grep -i panic
    cat /var/log/syslog | grep -i error
    
  3. Look for lines containing panic, error, failed, or driver names (like nvidia, nouveau, radeon). This may indicate a specific kernel module.
  4. If a problematic module is found (e.g., a graphics driver), try removing or updating it:
    # For NVIDIA driver
    apt remove nvidia-driver-xxx
    # Or install an alternative driver
    apt install xserver-xorg-video-nouveau
    
    Then update initramfs and reboot.

Method 4: Checking hardware

RAM or disk errors often cause kernel panic and need to be checked.

  1. Check RAM:
    • In the GRUB menu, select "Memory test (memtest86+)" — this runs the memtest86+ utility.
    • Let the test run completely (may take several hours). If errors are found, replace the RAM modules.
  2. Check the disk drive:
    • In recovery mode, use fsck (as in Method 1) to check the file system.
    • For detailed disk diagnostics, install smartmontools (if network is available):
      apt install smartmontools
      smartctl -a /dev/sda  # replace sda with your disk (sda, nvme0n1, etc.)
      
      Look at attributes Reallocated_Sector_Ct, Current_Pending_Sector, UDMA_CRC_Error_Count. High values indicate issues.
  3. Check temperature and power:
    • Install lm-sensors and psensor:
      apt install lm-sensors psensor
      sensors-detect  # answer "YES" to all questions
      
    • Run psensor to monitor. CPU/GPU overheating can cause panic. Ensure the cooling system is working.

Method 5: System recovery

If all previous methods fail, the system may be severely damaged.

  1. Restore from a backup:
    • If you used Timeshift or similar, boot from a Live USB, mount the backup partition, and restore the snapshot.
  2. Reinstall the kernel without data loss:
    • Boot from a Live USB, open a terminal, and mount the Ubuntu root partition (e.g., /dev/sda1):
      mount /dev/sda1 /mnt
      mount --bind /dev /mnt/dev
      mount --bind /proc /mnt/proc
      mount --bind /sys /mnt/sys
      chroot /mnt
      
    • In the chroot environment, run:
      apt update
      apt install --reinstall linux-image-generic linux-headers-generic
      update-initramfs -u -k all
      update-grub
      exit
      
    • Reboot.
  3. Clean reinstall of Ubuntu:
    • If nothing works, back up data from a Live USB (copy files to an external drive) and perform a clean Ubuntu install. First, ensure the issue isn't hardware-related (e.g., by testing RAM).

Prevention

To minimize the risk of kernel panic in the future:

  • Regularly update your system — run sudo apt update && sudo apt upgrade at least once a week. This includes kernel and driver updates that fix known vulnerabilities.
  • Avoid installing untested drivers — especially proprietary drivers (NVIDIA, AMD) from unofficial sources. Use Ubuntu's official repositories (sudo apt install nvidia-driver-xxx) or tools like ubuntu-drivers.
  • Create backups — use Timeshift to take system snapshots before major updates or changes. This allows quick rollback.
  • Monitor hardware health — periodically check RAM with memtest86+ (e.g., before major updates) and disks with smartctl. Monitor component temperatures with lm-sensors.
  • Be cautious with boot parameters — don't modify kernel parameters in GRUB (/etc/default/grub) without understanding their purpose. After changes, always run sudo update-grub.
  • Test new hardware — when installing new components (RAM, graphics card), first check compatibility and stability under load.

F.A.Q.

What is kernel panic and why does it occur?
How to prevent kernel panic in the future?
Do I need to reinstall Ubuntu when kernel panic occurs?
Can I fix kernel panic without booting into the system?

Hints

Boot into recovery mode
Restore the system
Update the kernel
Check logs
Test hardware
Restore the system

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