How to Migrate cPanel Accounts Between Servers Using WHM Transfer Tool (Zero-Downtime Guide) Moving live…
Linux Kernel Panic Troubleshooting: Fix Boot Errors

How to Troubleshoot Linux Kernel Panic Errors
Linux kernel panic troubleshooting is essential when a server suddenly stops responding, fails to boot, or displays a kernel panic message during startup. A kernel panic occurs when the Linux kernel encounters a condition it cannot safely recover from. Depending on the failure, the system may freeze, reboot automatically, or stop at a panic screen.
On a Linux VPS or dedicated server, kernel panic errors can result from faulty kernel modules, incompatible kernel updates, filesystem or storage problems, hardware faults, memory corruption, or low-level driver issues. The challenge is identifying the actual cause rather than repeatedly rebooting the machine without examining the available evidence.
This guide explains how to investigate Linux kernel panic errors, inspect previous boot logs with journalctl, diagnose failed boots, use recovery mode, and collect useful diagnostic information before changing the system.
What Is a Linux Kernel Panic?
A kernel panic is a critical failure in the Linux kernel. Unlike an ordinary application crash, which usually affects a single process, a kernel panic can make the entire operating system unable to continue safely.
A panic message may contain information such as:
Kernel panic - not syncingOops:Unable to handle kernelBUG: unable to handle page faultVFS: Unable to mount root fsKernel NULL pointer dereference
These messages do not all indicate the same problem. Some kernel warnings or oops events may occur without an immediate panic, while a panic generally indicates a more serious failure. The exact message and surrounding log entries are important when diagnosing the cause.
Kernel panic vs. boot failure
A server that does not boot successfully has not necessarily experienced a kernel panic.
| Symptom | Possible cause |
|---|---|
Kernel panic - not syncing |
Fatal kernel error or unrecoverable condition |
VFS: Unable to mount root fs |
Missing storage driver, incorrect root device, or filesystem problem |
Kernel oops |
Kernel-level exception that may or may not lead to a panic |
| GRUB rescue prompt | Bootloader or boot configuration problem |
| Emergency mode | Root filesystem, mount, or system initialization problem |
| Black screen after kernel selection | Kernel, graphics console, driver, or early boot issue |
| Server reboots repeatedly | Kernel crash, watchdog event, power problem, or automated reboot policy |
Identify which stage fails before selecting a recovery method.
1. Identify the Kernel Panic Message
If the panic appears on the console, take a screenshot or copy the complete message before rebooting. Record the kernel version shown on the screen and any nearby error lines.
Look for the following details:
- The function or kernel module mentioned in the error.
- Whether the message refers to a page fault, memory access, or missing device.
- The kernel version and boot entry selected.
- Whether the issue started after a kernel update, driver installation, storage change, or configuration modification.
- Whether the server automatically reboots or remains frozen.
If the server is a VPS, open the hosting provider’s web console, serial console, or recovery console if available. A normal SSH connection cannot help when the operating system has stopped responding or has not finished booting.
Do not repeatedly force-reboot the server before collecting the available information. Repeated reboots can make transient evidence harder to retrieve, and an underlying filesystem or storage issue may worsen.
2. Check the Current Kernel and System Information
If the system is running again, collect basic system information first.
Check the current kernel:
uname -r
Display the distribution details:
cat /etc/os-release
Check the system uptime:
uptime
Inspect the most recent boot time:
who -b
Review the kernel ring buffer:
sudo dmesg -T | less
Search the kernel messages for common failure indicators:
sudo dmesg -T | grep -Ei \
'panic|oops|BUG:|call trace|segfault|I/O error|failed|fault'
These commands help identify relevant messages, but dmesg normally exposes the current kernel’s ring buffer. If the server has already rebooted, messages from the previous kernel session may no longer be available there.
The -T option attempts to display human-readable timestamps. For precise event correlation, especially across reboots or systems with clock changes, use the journal timestamps as well.
3. Review Previous Boot Logs with journalctl
One of the most useful steps in Linux kernel panic troubleshooting is inspecting logs from the boot session before the crash.
The journalctl command reads logs stored by systemd-journald. If the previous boot’s journal was retained, you can inspect it even after the server has restarted.
List available boot sessions
sudo journalctl --list-boots
Example output:
-2 3a2c... Mon 2026-11-23 08:10:12 UTC—Mon 2026-11-23 12:42:10 UTC
-1 4b1d... Mon 2026-11-23 12:43:02 UTC—Tue 2026-11-24 01:17:45 UTC
0 5c8e... Tue 2026-11-24 01:18:11 UTC—Tue 2026-11-24 01:25:32 UTC
The identifiers and timestamps above are illustrative. Your system will show its own available boot sessions.
The entry marked -1 represents the previous boot, while 0 represents the current boot.
Read logs from the previous boot
sudo journalctl -b -1
To display only kernel messages from the previous boot:
sudo journalctl -k -b -1
To show higher-priority errors:
sudo journalctl -p err -b -1
You can also search for panic-related terms:
sudo journalctl -k -b -1 | grep -Ei \
'panic|oops|BUG:|call trace|watchdog|I/O error|fault'
These searches are useful for narrowing down a large log. However, a kernel panic may happen too suddenly for the final messages to reach the journal. The last visible log entry is not always the root cause.
Inspect the end of the previous boot
sudo journalctl -k -b -1 -n 200 --no-pager
If the output is lengthy, use a pager to inspect it:
sudo journalctl -k -b -1 | less
Look for warnings immediately before the crash, such as storage timeouts, driver failures, memory errors, or a repeated call trace.
What if previous boot logs are missing?
If journalctl --list-boots does not show earlier boots, the journal may not be persistent, the system may not have retained those logs, or the relevant boot may not have been recorded successfully.
On systems using systemd-journald, inspect its storage configuration:
grep -E '^[[:space:]]*Storage=' \
/etc/systemd/journald.conf \
/etc/systemd/journald.conf.d/*.conf 2>/dev/null
The default behavior can vary with the system and the presence of /var/log/journal. For persistent storage, create the journal directory if needed:
sudo mkdir -p /var/log/journal
sudo systemd-tmpfiles --create --prefix /var/log/journal
Then restart journald when appropriate:
sudo systemctl restart systemd-journald
Check that the journal is being written and that disk space is available:
sudo journalctl --disk-usage
df -h /var/log
Persistent journaling helps retain logs across future reboots. It cannot restore kernel messages that were never recorded, and it does not guarantee that every message from a sudden panic will be preserved.
4. Check for Kernel and Driver Problems
Kernel panics can occur after a kernel upgrade, out-of-tree module installation, driver update, or change in low-level system configuration.
List installed kernel packages on Debian or Ubuntu:
dpkg -l 'linux-image*' | grep '^ii'
On RHEL-compatible distributions, inspect installed kernel packages:
rpm -qa 'kernel*' | sort
Check the currently loaded modules:
lsmod
Inspect recent kernel logs for module-related errors:
sudo journalctl -k -b -1 | grep -Ei \
'module|taint|firmware|driver|symbol|unknown symbol'
If the issue began immediately after a kernel or driver update, determine whether the change is related before removing packages or reinstalling drivers.
Boot with a previous kernel
Many Linux distributions keep more than one installed kernel. If the latest kernel fails, an older kernel can help determine whether the problem is specific to the new version.
On systems using GRUB:
- Open the GRUB boot menu using the provider console or local console.
- Select Advanced options or the equivalent menu.
- Choose a previously installed kernel.
- Boot and check whether the system becomes stable.
- Compare kernel logs and package changes between the working and failing versions.
Menu names and available entries vary by distribution. Do not remove the failing kernel until you have verified that another kernel boots successfully and that you have a recovery path.
If an older kernel works, investigate the kernel changelog, installed modules, driver compatibility, and relevant distribution updates. Booting an older kernel is a diagnostic step, not necessarily a permanent fix.
5. Diagnose Root Filesystem and Storage Errors
A panic during startup may occur because Linux cannot access or mount its root filesystem. Storage-related messages can point to missing devices, filesystem corruption, incorrect root identifiers, or unavailable storage drivers.
Check mounted filesystems:
findmnt
Review block devices and filesystem identifiers:
lsblk -f
Inspect storage-related kernel messages:
sudo journalctl -k -b -1 | grep -Ei \
'blk|nvme|ata|scsi|I/O error|filesystem|EXT4-fs|XFS|mount'
Check filesystem capacity and inodes after the system boots:
df -h
df -i
A full filesystem can disrupt system services and logging, but it does not automatically mean the kernel panic was caused by disk capacity. Look for evidence that directly connects storage errors to the failure.
If the root filesystem will not mount
Use the provider’s rescue environment or a suitable recovery mode if normal boot is impossible. Identify the correct root device using lsblk -f and compare it with the boot configuration and /etc/fstab where accessible.
Do not run a filesystem repair command against a mounted filesystem. Before using tools such as fsck, confirm the filesystem type, device, and mount status. Filesystem repair procedures differ, and XFS requires its own recovery tools rather than fsck in the same way as ext filesystems.
For valuable production data, take a provider snapshot or a verified backup before attempting repairs whenever possible.
6. Check Memory and Hardware-Related Errors
Memory corruption, failing hardware, and low-level device errors can contribute to kernel panics. In a virtual machine, however, the physical hardware is usually managed by the hosting provider, so guest-level tools cannot always diagnose the underlying host.
Review available memory:
free -h
Inspect kernel logs for memory-related events:
sudo journalctl -k -b -1 | grep -Ei \
'out of memory|oom|memory failure|hardware error|EDAC|MCE|machine check'
Check the current system’s memory and pressure information:
cat /proc/meminfo
For a physical server, hardware diagnostics may include memory tests, vendor management tools, storage health checks, and hardware event logs. Run offline memory tests during a maintenance window because they may require rebooting the machine.
For a VPS, collect the panic message, timestamps, kernel version, and any storage or machine-check errors, then provide them to the hosting provider. Guest-level logs alone may not be enough to establish whether a host-side hardware issue occurred.
Important: An out-of-memory event and a kernel panic are not interchangeable. The OOM killer normally terminates selected processes to recover memory. A panic requires separate evidence and should not be attributed to low memory solely because the server had limited RAM.
7. Use GRUB Recovery Mode When Linux Will Not Boot
If the server fails during startup, use a recovery option appropriate to your distribution.
For a machine using GRUB:
- Open the console and display the GRUB menu.
- Select an advanced boot entry or recovery mode if available.
- Try a previously installed kernel if the failure followed an update.
- If recovery mode starts, inspect logs and configuration files.
- Make one controlled change at a time, then test a normal boot.
Recovery mode can provide a maintenance shell or limited operating environment, but the exact behavior depends on the distribution.
Check system logs from recovery mode
If the root filesystem is mounted and the journal is available, inspect previous boot logs:
journalctl --list-boots
Then review relevant kernel messages:
journalctl -k -b -1
If you booted into a rescue image rather than the installed operating system, these commands may show logs from the rescue environment. You may need to mount the installed system’s filesystems and inspect its journal using the appropriate journalctl --directory or journalctl --root option.
Do not assume that every recovery environment mounts the installed system read-write. Verify which filesystem is mounted and avoid making changes to the wrong root directory.
When to use a rescue environment
Use a provider rescue environment if:
- The normal kernel cannot reach a usable shell.
- GRUB does not offer a working kernel.
- The root filesystem is unavailable.
- You need to back up data before repair.
- You need to inspect boot configuration files offline.
Before modifying boot files, record the original configuration and make a backup. If you are unsure which device contains the root filesystem, stop and identify the device before attempting repairs.
8. Capture Kernel Panic Information for Future Failures
A sudden panic may leave too little information in the journal to identify the root cause. Configuring additional diagnostic mechanisms can improve the evidence available during future incidents.
Check whether pstore is available
The Linux pstore framework can preserve selected kernel messages across certain crashes or reboots, depending on platform and firmware support.
Check for pstore-related messages:
sudo journalctl -k | grep -i pstore
Inspect the pstore mount point if it exists:
sudo ls -lah /sys/fs/pstore/
An empty directory does not necessarily indicate a problem. The feature may be unsupported, disabled, or have no preserved crash records. Do not assume every VPS exposes pstore.
Consider kdump on supported systems
kdump can capture a kernel crash dump using a reserved crash kernel, allowing deeper analysis after a panic. It requires suitable kernel support, configuration, memory reservation, and a location to store the dump.
On Ubuntu or Debian, package and configuration steps depend on the release and kernel setup. On RHEL-compatible systems, the kdump service is commonly used where supported.
Before enabling crash dumps on a production server, review your distribution’s official documentation and verify available memory, storage capacity, and the required service configuration. A crash dump can consume significant storage and may contain sensitive information from system memory, so protect it appropriately.
Check for automatic reboot behavior
Inspect the kernel panic timeout:
sysctl kernel.panic
A nonzero value can cause the kernel to reboot automatically after a panic timeout. This may explain why the console briefly displays a panic before restarting.
Do not change this setting merely to hide the symptom. First decide whether automatic rebooting or preserving the crashed state is more appropriate for your recovery and diagnostic requirements.
9. Verify the Fix and Monitor the Server
After making a change, boot the system normally and confirm that the original failure no longer occurs.
Check the running kernel:
uname -r
Review errors from the current boot:
sudo journalctl -k -b -p err
Inspect system service failures:
sudo systemctl --failed
Review the latest system logs:
sudo journalctl -b -n 200 --no-pager
If the server experienced repeated crashes, monitor it through the next normal workload cycle. A single successful boot does not prove that the underlying issue has been fixed.
Document the kernel version, the original panic message, the change made, and the result. This makes it easier to distinguish a confirmed fix from a temporary workaround.
10. Prevent Future Linux Kernel Panic Errors
You cannot eliminate every kernel panic, but good maintenance and recovery planning can reduce the risk and speed up diagnosis.
- Keep a known-good kernel available where the distribution supports it.
- Review kernel and driver changes before deploying them to critical servers.
- Maintain verified backups and test the restore procedure.
- Ensure the provider console or rescue environment is accessible before maintenance.
- Enable persistent journaling where appropriate.
- Configure crash-dump collection if the workload justifies it.
- Monitor storage, memory, and hardware-related alerts.
- Avoid manually deleting kernel packages without checking boot dependencies.
- Record changes to kernel modules, storage configuration, and boot parameters.
- Apply production kernel updates during a suitable maintenance window.
For hosting environments, consider testing important kernel changes on a non-production server before applying them to customer-facing systems.
Conclusion
Linux kernel panic troubleshooting begins with identifying the exact failure message and collecting logs before making changes. journalctl -k -b -1 is especially useful when previous boot logs are available, while dmesg, kernel package information, storage diagnostics, and GRUB recovery can help narrow down the cause.
If the server fails to boot, use the provider console or rescue environment to inspect the installed system safely. If the problem began after a kernel update, testing a previously installed kernel can help determine whether the new version is involved. For recurring or unexplained panics, persistent logs, pstore, and kdump may provide evidence that ordinary logs cannot capture.
Avoid treating every boot failure as a kernel panic, and do not assume that memory pressure, a full disk, or a recent update is the cause without supporting evidence. A careful diagnosis, a controlled repair, and a verified recovery plan are the most reliable ways to restore Linux server stability.
If you need an environment for Linux administration and troubleshooting, explore ServerNext VPS solutions and choose a server setup suitable for your workload.
