A kernel panic is the Linux equivalent of a blue screen, and if you are seeing one, your system has hit an error it cannot safely ignore. Learning how to diagnose a Linux kernel panic using the boot logs and recover the system is one of the most valuable skills a Linux administrator or power user can build. The process comes down to three things: capturing the right logs, reading the panic message correctly, and applying the matching fix.
Our team has spent years managing production servers, workstations, and everything in between. We have seen kernel panics caused by failing RAM, bad driver updates, corrupted filesystems, and kernel upgrades that shipped with a regression. Every single one was recoverable, and most were preventable after the fact.
This guide walks you through the entire workflow from start to finish. You will learn where kernel panic logs live after a reboot, how to decode the panic message itself, how to boot into recovery mode when the system will not start normally, and how to apply the right fix based on the error you see. By the end, you will have a repeatable diagnostic process and an emergency command reference you can copy and paste during a real crisis.
Table of Contents
Understanding Kernel Panics: What They Are and Why They Happen
A kernel panic is a deliberate safety mechanism, not a random crash. When the Linux kernel detects an internal state it cannot recover from, such as corrupted memory or a missing root filesystem, it halts all CPU operations to prevent data corruption. The kernel then prints a diagnostic message to the console (or to a log buffer) and waits for a manual reboot or an automatic restart if configured.
The term “panic” comes from the original UNIX kernel design. Linus Torvalds kept the concept in Linux because forcibly stopping the system is safer than continuing to run with a broken kernel state. A panic means the kernel decided it could not guarantee system integrity.
Kernel Panic vs Kernel Oops: Knowing the Difference
A kernel oops is a less severe event where the kernel encounters an error but can continue running, often after killing the offending process. An oops does not necessarily bring the whole system down, though the kernel may become unstable. A panic, by contrast, is terminal. The key difference: after an oops the system is still alive, while after a panic it is not.
Many panics start as oops. If a critical kernel thread dies or a core subsystem fails, the kernel escalates the oops into a panic. This is why capturing oops messages in your logs is important for post-mortem analysis even when the system survives.
What Causes Kernel Panics on Linux?
The most common causes fall into four categories. Hardware failures include bad RAM modules, dying storage drives, overheating CPUs, and failing power supplies. Driver and module issues come from incompatible kernel modules, proprietary drivers like NVIDIA DKMS builds that do not match the running kernel, or firmware regressions. Filesystem corruption occurs when the root filesystem metadata is damaged or when a UUID mismatch in /etc/fstab points to the wrong partition. Kernel upgrade regressions happen when a new kernel version ships with a bug that triggers a panic under specific conditions.
Forum data from r/linux and r/Ubuntu shows that the single most frequently reported cause is a panic immediately after a kernel or driver update. Users on Arch and Ubuntu report that NVIDIA driver mismatches are a recurring trigger, especially when a kernel update lands but the DKMS module has not rebuilt yet.
Understanding which category your panic falls into is the first step in diagnosis. The boot logs will tell you which one applies.
Where Kernel Panic Logs Are Stored in Linux
Kernel panic logs are stored in several locations depending on your distribution, init system, and whether the system rebooted before you could read the screen. On modern systemd-based distributions, the primary source is the journal, which persists across reboots if persistent logging is enabled.
Here are the locations you should check, in order of reliability:
journald (recommended): The systemd journal captures kernel messages and survives reboots when /var/log/journal exists. You access it with journalctl. The previous boot’s logs are available with a single flag.
/var/log/kern.log or /var/log/messages: Traditional syslog destinations on Debian, Ubuntu, RHEL, and SUSE. These are plain text files you can read with less or grep.
/var/log/syslog: The system-wide syslog file on Debian and Ubuntu. Kernel messages appear alongside application logs.
/proc/kmsg and dmesg: The kernel ring buffer, which holds recent kernel messages in RAM. This is volatile and clears on reboot, so it is only useful if the system is still running after an oops.
pstore and /sys/fs/pstore: On systems with EFI, the kernel can store the panic log from the previous boot in NVRAM. The log appears as a file under /sys/fs/pstore after the reboot. This is one of the most reliable ways to capture a panic that happened before the filesystem was mounted.
kdump vmcore: If kdump is configured, the kernel writes a full crash dump to /var/crash/ at the moment of panic. This is the gold standard for post-mortem analysis but requires advance setup.
The biggest pain point reported by Linux users on forums is that the panic message flashes on screen and disappears after reboot. The fix is simple: check the previous boot’s journal. The command journalctl -k -b -1 shows kernel messages from the boot before the current one, and it works even if the system rebooted itself after the panic.
Reading Kernel Panic Messages: Common Errors Explained
Learning to read a kernel panic message is the single most important diagnostic skill you can develop. The panic string tells you exactly which subsystem failed, and you can usually identify the cause within seconds once you know the patterns.
A typical panic message looks like this:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
Break it into parts. “Kernel panic” confirms this is a true panic. “Not syncing” means the kernel skipped the filesystem sync step (it was too unsafe to write pending data to disk). Everything after the colon is the specific cause.
Common Panic Messages and Their Meanings
“VFS: Unable to mount root fs on unknown-block(0,0)” means the kernel could not find or mount the root filesystem. The block device (0,0) means the kernel had no device at all to mount. This is almost always caused by a missing or outdated initramfs image, a wrong root= parameter in GRUB, or a UUID change on the root partition.
“Attempted to kill init” means the init process (PID 1) exited or was killed. Since the kernel cannot operate without init, it panics. This typically happens when systemd is missing, the init binary is corrupted, or a shared library dependency is broken.
“Not syncing: Fatal exception in interrupt” indicates a hardware or driver fault that occurred inside an interrupt handler. This often points to a failing hardware component or a buggy driver that cannot be unloaded safely.
“Kernel panic – not syncing: Machine halted” or “Fatal hardware error” usually means the CPU detected a machine check exception (MCE). This is a hardware fault such as a memory ECC error, CPU cache failure, or bus error.
“BUG: unable to handle kernel NULL pointer dereference” followed by a stack trace is a software bug in the kernel or a loadable module. The stack trace names the function and module responsible, which directly tells you what to blacklist or roll back.
How to Read the Stack Trace
Below the panic message, the kernel prints a call trace showing the sequence of function calls that led to the crash. Read it from bottom to top. The last function called (top of the trace) is where the kernel died. If you see a module name in brackets like [nvidia] or [i915], that module is the prime suspect.
You will also see a line like RIP: 0010:module_function_name+0x1a/0x3f [module_name]. The RIP register holds the instruction pointer at the moment of the crash. The function name and module name tell you exactly which code path failed.
Understanding Taint Flags
The kernel prints a taint flag line during a panic, something like Kernel tainted: P O. Each letter represents a condition that makes the kernel state “impure.” P means a proprietary module is loaded, O means an out-of-tree module was loaded, and other flags indicate forced module loads, unsafe overclocking, or live patching. Kernel maintainers will not debug issues on tainted kernels until the proprietary or out-of-tree modules are removed, because those modules can cause the panic.
For most users, a tainted kernel with P or O flags means a third-party driver is likely involved in the crash. NVIDIA drivers, VirtualBox modules, and DKMS-built wireless drivers are the usual suspects.
Booting Into Recovery Mode to Access the System
When a kernel panic prevents normal boot, you need an alternative way to access the system. There are three main approaches, each suited to a different severity level. Start with GRUB recovery mode and escalate to a live USB if needed.
Method 1: Boot an Older Kernel from the GRUB Menu
If the panic started after a kernel update, the fastest fix is to boot the previous kernel version. GRUB keeps the last few installed kernels available in the “Advanced options” submenu.
Step 1: Power on the machine and press Escape (on BIOS systems) or hold Shift (on UEFI systems) repeatedly during early boot to force the GRUB menu to appear.
Step 2: Select “Advanced options for [your distribution]” using the arrow keys.
Step 3: Choose an older kernel version from the list. Pick one you know worked before the update.
Step 4: Press Enter to boot. If the system starts normally, you have confirmed the new kernel is the problem.
Step 5: Once logged in, you can remove the problematic kernel package or blacklist the offending module before trying the new kernel again.
Method 2: Use GRUB Recovery Mode (Single User)
If the GRUB menu has a recovery mode entry, it drops you into a minimal root shell with the root filesystem mounted read-only. From there you can run filesystem repairs, edit configuration files, and rebuild the initramfs.
Step 1: Open the GRUB menu as described above.
Step 2: Select “Advanced options” and choose the kernel version labeled “(recovery mode).”
Step 3: Wait for the system to reach the recovery menu. Select “root – Drop to root shell prompt.”
Step 4: Remount the filesystem read-write with: mount -o remount,rw /
Step 5: Run your diagnostic or repair commands. When finished, type reboot or exit to return to the recovery menu.
Method 3: Boot from a Live USB and chroot Into the System
When the system cannot boot at all from its own disk, a live USB is your rescue environment. You boot the live system, mount the broken system’s partitions, and chroot into it to run repairs as if you were booted locally.
Step 1: Boot from a live USB (Ubuntu, Fedora, SystemRescue, or any Linux live image).
Step 2: Identify your root partition: lsblk or sudo fdisk -l
Step 3: Mount the root partition: sudo mount /dev/sdXN /mnt (replace sdXN with your actual partition).
Step 4: If you have a separate boot partition, mount it too: sudo mount /dev/sdXM /mnt/boot
Step 5: Bind-mount the virtual filesystems for chroot:
sudo mount --bind /dev /mnt/devsudo mount --bind /proc /mnt/procsudo mount --bind /sys /mnt/sys
Step 6: Enter the chroot: sudo chroot /mnt
Step 7: From inside the chroot, you can reinstall GRUB, rebuild the initramfs, run fsck, remove problematic packages, or edit configuration files. When done, type exit, unmount everything, and reboot.
For LUKS-encrypted systems, decrypt the root partition before mounting: sudo cryptsetup luksOpen /dev/sdXN cryptroot then mount /dev/mapper/cryptroot instead of the raw device.
How to Diagnose a Linux Kernel Panic Using journalctl and dmesg?
Once you can access the system, the boot logs are your primary diagnostic tool. The two commands you will use most are journalctl (for systemd-based systems) and dmesg (for the kernel ring buffer). Together, they give you a complete picture of what happened before, during, and after the panic.
Checking the Previous Boot’s Kernel Logs with journalctl
The single most useful command after a panic-induced reboot is:
journalctl -k -b -1 --no-pager
The -k flag filters for kernel messages only. The -b -1 flag selects the boot before the current one (the panicked boot). Add –no-pager if you are scripting or want to pipe to grep. Scroll to the end of the output to find the panic message and stack trace.
Other useful journalctl variations:
journalctl -k -b -1 -p err shows only error-level and above messages from the panicked boot.
journalctl -k -b -1 | grep -i "panic|oops|bug|null pointer" searches the previous boot for common crash signatures.
journalctl --list-boots shows a numbered list of all recorded boots, so you can identify which boot number corresponds to the panic.
If journalctl shows no previous boot data, persistent logging is not enabled. Create the directory sudo mkdir -p /var/log/journal and restart journald with sudo systemctl restart systemd-journald to enable it for future panics.
Using dmesg for Real-Time Kernel Messages
The dmesg command reads the kernel ring buffer, which holds the most recent kernel messages in RAM. After a reboot the buffer is cleared, so dmesg is most useful when the system survived an oops (not a full panic) or when you are testing a fix and want to watch kernel messages in real time.
Key dmesg commands:
dmesg --level=err,crit,alert,emerg filters for serious messages only.
dmesg -T adds human-readable timestamps to each line.
dmesg -w follows the buffer in real time (like tail -f) so you can watch kernel messages as they happen.
dmesg | grep -i "error|fail|panic|warning" is a quick way to scan for trouble.
Checking Traditional Log Files
On systems without systemd or with syslog forwarding enabled, check these files directly:
less /var/log/kern.log on Ubuntu and Debian.
less /var/log/messages on RHEL, CentOS, Rocky, and AlmaLinux.
less /var/log/syslog for the combined system log on Debian-based distros.
Use grep -i "panic" /var/log/kern.log to quickly locate panic entries across historical logs.
Capturing Panic Messages That Flash and Disappear
If the panic message appears on screen for a split second before the system reboots, you cannot read it in time. The solution is to configure the kernel to not reboot automatically so you can read the screen, or to enable pstore so the panic log is saved to NVRAM.
To stop automatic rebooting, add kernel.panic = 0 to /etc/sysctl.conf (a value of 0 means do not auto-reboot; any positive value is the number of seconds to wait before rebooting). You can also add the boot parameter panic=0 in GRUB.
For pstore, ensure your kernel has CONFIG_EFI_PSTORE enabled (most distribution kernels do) and check for logs after a reboot at: ls /sys/fs/pstore/. The dmesg file there contains the panic output from the previous boot.
Common Fixes by Error Type: VFS, init, and Module Issues
Once you have identified the panic message, you can apply the matching fix. The most common errors each have a specific recovery path. Here is how to handle each one.
Fixing “VFS: Unable to Mount Root fs”
This error means the kernel could not find the root filesystem. The most common cause is a missing or outdated initramfs image after a kernel update or a package removal. The initramfs contains the drivers and tools needed to mount the real root filesystem, so without it the kernel has nothing to work with.
To fix this, boot from a live USB, chroot into the system, and rebuild the initramfs for the target kernel:
update-initramfs -u -k all (Debian and Ubuntu)
dracut --regenerate-all --force (RHEL, Fedora, CentOS)
Also verify that the root= parameter in /etc/default/grub matches your actual root partition or UUID. Run blkid to list partition UUIDs and compare them with the entry in /boot/grub/grub.cfg. If a UUID changed (common after cloning or partition resizing), update GRUB and reinstall it: update-grub && grub-install /dev/sdX (BIOS) or grub2-install followed by grub2-mkconfig -o /boot/grub2/grub.cfg (RHEL family).
Fixing “Attempted to Kill init”
This panic means the init process (systemd or sysvinit) crashed or was missing. The fix depends on the cause. If a package upgrade broke systemd, reinstall it: apt reinstall systemd or dnf reinstall systemd. If a shared library is missing (check with ldd /sbin/init), reinstall the package that provides the missing library.
If the init binary itself is corrupted, boot from a live USB, chroot in, and reinstall the init system package.
Fixing Driver and Module Issues (Blacklisting)
If the panic stack trace points to a specific kernel module, boot an older kernel or use recovery mode, then blacklist the offending module. Create a file at /etc/modprobe.d/blacklist.conf (or add to it):
blacklist nvidiablacklist nouveau
Replace the module name with whatever your stack trace identified. After blacklisting, rebuild the initramfs and reboot. If the system boots cleanly, you have confirmed the module was the cause. You can then research an updated driver version or file a bug report.
For NVIDIA-specific panics after a kernel update, the fix is usually to make sure the DKMS package rebuilt against the new kernel. Run dkms status to check. If it shows a failed build, install the kernel headers for the new kernel (apt install linux-headers-$(uname -r)) and rebuild with dkms autoinstall.
Performing a Kernel Rollback
If a kernel update introduced the panic, rolling back to the previous kernel is the cleanest fix. Boot the older kernel from GRUB, then remove the problematic one:
apt remove linux-image-5.15.0-xx-generic (Ubuntu and Debian)
dnf remove kernel-6.x.x-xxx (Fedora and RHEL)
After removing the bad kernel, update GRUB so it no longer appears in the boot menu: update-grub. Keep at least two kernel versions installed at all times so you always have a fallback.
Repairing a Corrupted Filesystem with fsck
Filesystem corruption can cause panics when the kernel tries to read damaged metadata. The fix is to run fsck from a live USB or recovery mode with the filesystem unmounted:
fsck.ext4 /dev/sdXN (ext4 filesystems)
xfs_repair /dev/sdXN (XFS filesystems)
btrfs check --repair /dev/sdXN (Btrfs filesystems)
For LVM setups, activate the volume group first: vgchange -ay then run fsck on the logical volume path (for example, /dev/mapper/vg-root). For RAID arrays, assemble the array first: mdadm --assemble --scan then run fsck on the md device.
Always run fsck with the filesystem unmounted. Running it on a mounted filesystem can cause further damage.
Hardware Validation: Memory, Disk, and Temperature Checks
If your logs do not point to a software cause, hardware is the next suspect. Bad RAM, failing disks, and thermal issues are responsible for a significant share of kernel panics on both servers and desktops. Run these checks to rule out or confirm a hardware fault.
Testing RAM with memtest86 or memtester
Memory errors are one of the most common hardware causes of kernel panics, and they are easy to detect. The best approach is to run Memtest86 from a bootable USB before the operating system loads. This tests all installed RAM outside of Linux, catching errors that a running kernel might mask.
Download Memtest86, write it to a USB with dd if=memtest86.img of=/dev/sdX, boot from it, and let it complete at least one full pass. Any errors in red mean you have bad RAM. Test sticks individually to identify which one is failing.
For a quick test from a running system, install memtester: apt install memtester then run memtester 1G 3 to test 1 GB of RAM for 3 passes. This is less thorough than Memtest86 but useful for spot checks.
Checking Disk Health with smartctl
Failing storage drives cause filesystem corruption, which in turn causes panics. Use smartmontools to read the drive’s S.M.A.R.T. health data:
sudo apt install smartmontoolssudo smartctl -a /dev/sda
Look for Reallocated_Sector_Ct, Current_Pending_Sector, and Offline_Uncorrectable values. Any non-zero value on these attributes indicates the drive is failing. Run a long self-test with sudo smartctl -t long /dev/sda and check results with sudo smartctl -a /dev/sda after it completes.
For NVMe drives, use sudo nvme smart-log /dev/nvme0 to read health data including media errors and percentage used.
Monitoring Temperatures with sensors
Overheating components can cause random panics, especially on laptops and dense server environments. Install lm-sensors to check temperatures:
sudo apt install lm-sensorssudo sensors-detect --autosensors
CPU temperatures above 90 degrees Celsius under load indicate a cooling problem. Clean dust from heatsinks, verify fan operation, and reapply thermal paste if necessary. On servers, check BMC/IPMI sensor data with ipmitool sensor for board-level temperatures and fan speeds.
Emergency Recovery Command Reference
When you are in the middle of a crisis, you do not want to search through a long article for the right command. Here is a quick reference of the commands you are most likely to need, organized by task. Bookmark this section for emergency use.
View previous boot’s kernel logs:journalctl -k -b -1
Search previous boot for panic:journalctl -k -b -1 | grep -i panic
List all recorded boots:journalctl --list-boots
Check kernel ring buffer:dmesg -T | tail -50
Remount root filesystem read-write in recovery:mount -o remount,rw /
Rebuild initramfs (Debian/Ubuntu):update-initramfs -u -k all
Rebuild initramfs (RHEL/Fedora):dracut --regenerate-all --force
Update GRUB:update-grub (Debian/Ubuntu)grub2-mkconfig -o /boot/grub2/grub.cfg (RHEL/Fedora)
Run filesystem check (ext4):fsck.ext4 /dev/sdXN
Blacklist a module:echo "blacklist modulename" | sudo tee /etc/modprobe.d/blacklist.conf
Check DKMS status:dkms status
Check disk SMART data:sudo smartctl -a /dev/sda
Check temperatures:sensors
Decrypt LUKS partition from live USB:sudo cryptsetup luksOpen /dev/sdXN cryptroot
Enter chroot from live USB:sudo mount /dev/sdXN /mnt && sudo mount --bind /dev /mnt/dev && sudo mount --bind /proc /mnt/proc && sudo mount --bind /sys /mnt/sys && sudo chroot /mnt
Prevention and Monitoring: kdump, vmcore, and Staged Updates
The best way to handle kernel panics is to prevent them from happening again and to capture better data when they do. Three practices make the biggest difference: enabling kdump for crash dumps, setting up log persistence and monitoring, and applying kernel updates in a staged rollout.
Enabling kdump for Automatic Crash Dumps
Kdump is a kernel feature that reserves a small portion of RAM for a capture kernel. When the main kernel panics, the capture kernel boots, dumps the full memory image (vmcore) to disk, and then reboots. The resulting dump at /var/crash/ can be analyzed with the crash utility to find the exact line of code that caused the panic.
To enable kdump on Debian and Ubuntu:
Step 1: Install the package: sudo apt install kdump-tools
Step 2: Edit /etc/default/kdump-tools and set USE_KDUMP=1.
Step 3: Reboot and verify the service is active: sudo kdump-config show
To enable kdump on RHEL, Fedora, and CentOS:
Step 1: Install: sudo dnf install kexec-tools
Step 2: Enable and start: sudo systemctl enable --now kdump
Step 3: Verify: sudo kdumpctl status
After enabling kdump, test it with echo 1 | sudo tee /proc/sys/kernel/sysrq followed by echo c | sudo tee /proc/sysrq-trigger. This forces a crash. After reboot, check for a dump at /var/crash/. Warning: this test will crash your system on purpose, so only do it on a non-production machine.
Analyzing vmcore with the crash Utility
If you have a vmcore dump, the crash utility lets you inspect it like a debugger. Install crash and the matching kernel debug symbols, then open the dump:
crash /usr/lib/debug/lib/modules/$(uname -r)/vmlinux /var/crash/YYYYMMDD/vmcore
Useful commands inside crash: bt shows the back trace, log dumps the kernel log buffer, ps lists processes, and kmod lists loaded modules. This level of analysis is typically needed only for complex server issues or when you are filing a kernel bug report.
Enabling Persistent Journal Logging
If your journal does not persist across reboots, you are losing valuable diagnostic data. Enable persistent logging:
sudo mkdir -p /var/log/journalsudo systemctl restart systemd-journald
Verify with journalctl --list-boots. You should see multiple boot entries after a few reboots.
Staging Kernel Updates
On production servers, never apply a kernel update directly to all machines at once. Test the new kernel on one machine or in a staging environment first, keeping the previous kernel installed as a fallback. If a panic occurs, you can immediately select the older kernel from GRUB while you investigate.
Configure your package manager to keep old kernels. On Ubuntu, the default keeps 3 kernel versions. On RHEL family, installonlypkgs in /etc/dnf/dnf.conf controls how many kernel versions are retained. Set installonly_limit=3 at minimum.
Consider setting up a reboot window with kernel.panic = 10 in sysctl.conf so that if a panic does occur, the system automatically reboots after 10 seconds and can boot the fallback kernel.
Frequently Asked Questions
Where are kernel panic logs stored in Linux?
Kernel panic logs are stored in the systemd journal (accessible via journalctl), in traditional syslog files like /var/log/kern.log, /var/log/messages, or /var/log/syslog, in the kernel ring buffer (readable with dmesg), and in EFI NVRAM via pstore at /sys/fs/pstore. If kdump is enabled, full crash dumps are saved to /var/crash/. The most reliable way to find the previous boot’s panic logs is journalctl -k -b -1.
How do I read and analyze kernel panic messages?
Read a kernel panic message by breaking it into parts. The phrase ‘Kernel panic’ confirms a true panic. ‘Not syncing’ means the kernel skipped writing pending data to disk. The text after the colon identifies the specific cause, such as ‘VFS: Unable to mount root fs’ or ‘Attempted to kill init.’ Below the message, the call trace shows the function sequence that led to the crash, read from bottom to top. Module names in brackets like [nvidia] identify the likely culprit. The taint flags line tells you if proprietary or out-of-tree modules were loaded.
What causes kernel panic issues on Linux?
Kernel panics are caused by hardware failures (bad RAM, dying disks, overheating CPUs), driver and module incompatibilities (especially proprietary drivers like NVIDIA DKMS builds that do not match the running kernel), filesystem corruption from damaged metadata or UUID mismatches, and kernel upgrade regressions where a new kernel version ships with a bug. The most frequently reported trigger is a panic immediately after a kernel or driver update.
How to recover from kernel panic in Linux without rebooting?
You cannot truly recover from a full kernel panic without rebooting because the kernel has halted all CPU operations. However, you can capture the panic message before rebooting by disabling auto-reboot (set kernel.panic=0 in sysctl.conf), which keeps the message on screen so you can photograph or write it down. You can also enable pstore so the panic log is saved to EFI NVRAM and available at /sys/fs/pstore after the reboot. For kernel oops (which do not halt the system), you can continue running but should capture dmesg output immediately.
How to fix ‘VFS: Unable to mount root fs’ error?
This error means the kernel could not find or mount the root filesystem. The most common fix is to rebuild the initramfs: boot from a live USB, chroot into the system, and run update-initramfs -u -k all (Debian and Ubuntu) or dracut u002du002dregenerate-all u002du002dforce (RHEL and Fedora). Also verify that the root= parameter in GRUB matches your actual partition UUID by running blkid and comparing with /etc/default/grub. If a UUID changed, update GRUB with update-grub and reinstall the bootloader.
How to enable kdump for kernel crash dump analysis?
On Debian and Ubuntu, install kdump-tools, set USE_KDUMP=1 in /etc/default/kdump-tools, and reboot. On RHEL, Fedora, and CentOS, install kexec-tools and run systemctl enable u002du002dnow kdump. After enabling, test by triggering a crash with echo c | tee /proc/sysrq-trigger on a non-production machine. After reboot, check for the dump at /var/crash/. Analyze it with the crash utility using: crash vmlinux vmcore.
How to use GRUB recovery mode to fix kernel panic?
Open the GRUB menu by pressing Escape (BIOS) or holding Shift (UEFI) during boot. Select ‘Advanced options’ and choose a kernel version marked ‘(recovery mode).’ Select ‘root – Drop to root shell prompt’ from the recovery menu. Remount the filesystem read-write with mount -o remount,rw /. From there you can run fsck, rebuild the initramfs, edit configuration files, blacklist modules, or remove problematic packages. Type reboot when finished.
Conclusion
Diagnosing a Linux kernel panic and recovering the system follows a clear, repeatable workflow. You capture the logs from the previous boot with journalctl, read the panic message to identify the failing subsystem, boot into recovery mode or a live USB if needed, apply the matching fix whether that is rebuilding the initramfs, running fsck, blacklisting a module, or rolling back the kernel, and then run hardware validation to rule out physical failures.
The most important habit you can build is enabling persistent journal logging and kdump before you need them. When a panic strikes, having the logs ready means the difference between a quick fix and hours of guesswork. Keep at least two kernel versions installed, stage updates on production servers, and bookmark the emergency command reference in this guide.
Kernel panics are intimidating the first time you see one, but they are just the kernel protecting your data. With the diagnostic process in this guide, you can work through any panic methodically and get your system back online.