How to Fix "Kernel Panic - Not Syncing" Error in Linux
A kernel panic is a fatal system error where the Linux kernel cannot recover. The system stops completely and displays a "Kernel panic - not syncing" message. Here is how to diagnose and fix the most common causes.
Fix 1: Boot into Recovery Mode
If your system panics on boot, restart and hold Shift to access the GRUB menu. Select Advanced Options and choose a kernel with (recovery mode). This boots with minimal drivers and services. From the recovery menu, you can check filesystems with fsck, fix broken packages, or update GRUB configuration.
Fix 2: Boot an Older Kernel
Kernel panics often start after a kernel update. In the GRUB menu, select Advanced Options and boot the previous kernel version. If this works, the new kernel has a bug or incompatibility. Remove the problematic kernel with sudo apt remove linux-image-version and prevent it from reinstalling with sudo apt-mark hold linux-image-version.
Fix 3: Check for Hardware Issues
Faulty RAM is a common cause of kernel panics. Run a memory test by selecting memtest86+ from the GRUB menu. Let it run for at least one complete pass. If errors are found, replace the faulty RAM module. Also check for overheating with sensors command and verify your power supply is adequate for your hardware.
Fix 4: Update System and Firmware
Outdated firmware or drivers can cause kernel panics. Update your system with sudo apt update && sudo apt upgrade. Update firmware with sudo fwupdmgr refresh && sudo fwupdmgr update. Check for BIOS/UEFI updates from your motherboard manufacturer. Driver conflicts, especially with NVIDIA graphics cards, are a frequent cause of kernel panics.