How to Recover a Server After a Kernel Panic

17 Nov 2026, 12:43:17
A Kernel Panic is a critical Linux kernel error that prevents the system from continuing to operate and forces it to stop executing processes. As a result, the server may freeze on a screen displaying an error message or enter an endless reboot loop.
Despite the severity of the error, in most cases, a server can be recovered without reinstalling the operating system or losing data.
Let's look at why Kernel Panic occurs, how to identify the cause of the failure, and what steps can help restore server functionality.

What Is a Kernel Panic and Why Does It Occur?

A Kernel Panic occurs when the Linux kernel encounters a critical error that it cannot safely handle. As a result, system execution is halted.
The most common causes include:
  • Unable to mount the root filesystem (VFS: Unable to mount root fs).
  • Missing or corrupted initramfs file.
  • Kernel files or modules corrupted after a failed update.
  • Incorrect disk UUID or root= parameter in the GRUB or /etc/fstab configuration.
  • Filesystem corruption or a faulty storage device.
  • Detected RAM errors.
  • Conflicts with a kernel driver or module.
  • Insufficient free space in the /boot partition during a kernel update.
The error message displayed on the screen often helps identify the direction of further troubleshooting.
For example, the following message:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
usually indicates a problem detecting the root partition. Possible causes include a missing or corrupted initramfs, an incorrect root= parameter, or a missing disk controller driver.

1. Check the Error Message in the Console

First, determine at which stage of the boot process the error occurs and what exactly the kernel reports.
To do this, connect to the server using:
  • VNC — for a VPS, through the hosting provider's control panel.
  • IPMI, iDRAC, iLO, or KVM — for a dedicated server.
Take a screenshot of the screen or save the last lines of the error message.
Pay particular attention to:
  • Lines following Kernel panic;
  • The Call Trace section;
  • References to disks, filesystems, and kernel modules;
  • I/O error, Unable to mount root fs, and Out of memory messages.
This information will help determine whether the problem is related to the kernel, bootloader, filesystem, or hardware.

2. Try Booting from an Older Kernel

If the Kernel Panic occurred after a kernel update, first try booting the previous working version.
This is the easiest way to restore server access without using LiveCD or Rescue Mode.
  1. Reboot the server.
  2. Open the GRUB menu during startup. On BIOS systems, this is usually done by pressing Shift; on UEFI systems, press Esc.
  3. Select Advanced options for Linux.
  4. Boot using the previous kernel version.
If the server boots successfully, it is recommended to temporarily set the older kernel as the default boot option.
Debian / Ubuntu:
List the available GRUB entries:
grep -E "menuentry |submenu " /boot/grub/grub.cfgSet the required entry as the default:
grub-set-default "Advanced options for Ubuntu>Ubuntu, with Linux 5.15.0-91-generic"Update the GRUB configuration:
update-grubAlmaLinux / Rocky Linux / CentOS:
List the available kernels:
grubby --info=ALLSet the required kernel as the default:
grubby --set-default /boot/vmlinuz-5.14.0-362.el9.x86_64The kernel versions shown in these examples are for reference only. Replace them with the versions actually installed on your server.
After restoring boot functionality, you can continue troubleshooting and reinstall the problematic kernel if necessary.

3. Boot into Recovery Mode

If none of the installed kernels starts successfully, you will need to boot the server from an external image.
Depending on the server type:
  • VPS: Attach an Ubuntu Live ISO image on the VPS service page.
  • Dedicated server: Boot from a LiveCD/ISO image through IPMI, iDRAC, or iLO, or use Rescue Mode.
After booting, identify the available disks and partitions:
lsblk -fLocate the following:
  • The root partition / (for example, /dev/sda2);
  • The /boot partition, if it is separate;
  • The EFI system partition (/boot/efi), if UEFI is used;
  • LVM volumes, if the system was installed using LVM.
Device names and partition numbers may differ. Refer to the output of the lsblk command.

Check the Filesystem

Before restoring the bootloader or kernel files, it is recommended to check the filesystem for errors.
For ext4:
fsck -f /dev/sda2For XFS:
xfs_repair /dev/sda2Run the check only on an unmounted partition.
Do not use fsck to repair XFS filesystems. The appropriate utility for this purpose is xfs_repair.
If errors are detected, fix them and try booting the server normally.

4. Access the Installed System Using chroot

To restore the kernel, regenerate initramfs, or repair the bootloader, you need access to the installed operating system.
The chroot utility is used for this purpose.
First, mount the root partition:
mount /dev/sda2 /mntIf /boot is located on a separate partition:
mount /dev/sda1 /mnt/bootMount the system directories:
for i in /dev /dev/pts /proc /sys /run; do
    mount --bind "$i" "/mnt$i"
done
If UEFI is used, mount the EFI partition:
mount /dev/sda15 /mnt/boot/efiIf the system uses LVM, activate the logical volumes first:
vgchange -ayThen mount the required logical volume:
mount /dev/mapper/vg0-root /mntEnter the installed system:
chroot /mntCommands will now be executed within the installed operating system environment rather than the Live system.
Note: The device and volume names shown above are examples. If /boot or the EFI partition is located on a separate device, it must be mounted before entering chroot.

5. Fix the Most Common Causes of Kernel Panic

After entering chroot, you can start restoring the system components.

5.1. Regenerate initramfs

One of the common causes of Kernel Panic is a missing or corrupted initramfs file.
This file contains the drivers and utilities required during the early stages of the Linux boot process.
Debian / Ubuntu:
update-initramfs -u -k allIf the initramfs file is missing for an installed kernel, you may need to create it:
update-initramfs -c -k kernel_versionAlmaLinux / Rocky Linux / CentOS:
dracut -f --regenerate-all

5.2. Restore the GRUB Bootloader Configuration

If the problem is caused by a corrupted bootloader configuration, regenerate it.
Debian / Ubuntu:
update-grubIf necessary, reinstall the bootloader to the disk:
grub-install /dev/sdaAlmaLinux / Rocky Linux (BIOS):
grub2-mkconfig -o /boot/grub2/grub.cfgIf necessary:
grub2-install /dev/sdaThe recovery procedure is different for systems using UEFI. Do not install the BIOS version of GRUB on a UEFI system. Before proceeding, make sure the EFI partition is mounted at /boot/efi.
The path to the GRUB configuration file may also differ depending on the distribution and operating system version.

5.3. Check Disk UUIDs in /etc/fstab

Incorrect UUID values in the /etc/fstab configuration may prevent the system from booting normally.
Retrieve the current partition UUIDs:
blkidCheck the current configuration:
cat /etc/fstabCompare the UUID values in both outputs.
If any mismatches are found, correct the corresponding entries in /etc/fstab.
Also check the root= parameter in the GRUB configuration. It must point to an existing root partition.

5.4. Reinstall the Linux Kernel

If kernel files are corrupted or an update failed, you may need to reinstall the corresponding package.
Debian / Ubuntu:
First, list the installed kernel versions:
ls /boot/vmlinuz-*Then reinstall the required version:
apt update
apt install --reinstall linux-image-kernel_version
For example:
apt install --reinstall linux-image-6.8.0-90-genericDo not use uname -r to determine the installed kernel version from within chroot: the command may return the kernel version of the Live system.
AlmaLinux / Rocky Linux:
dnf reinstall kernel-coreAfter reinstalling, check that the kernel and initramfs files are present in /boot.

5.5. Check Available Space in /boot

Insufficient free space in the /boot partition may interrupt a kernel update and result in corrupted boot files.
Check partition usage:
df -h /bootIf there is not enough free space, remove old, unused kernels using the package manager's standard tools.
Debian / Ubuntu:
apt autoremove --purgeAlmaLinux / Rocky Linux:
dnf remove --oldinstallonlyBefore removing anything, make sure you are not deleting the currently running kernel or the only working kernel version.
Manually deleting files from /boot is not recommended, as this may interfere with the bootloader and package manager.

5.6. Check Problematic Kernel Modules

If the Kernel Panic message mentions a specific driver or module, the cause may be incompatibility with the current kernel.
For example, problems may occur after installing a third-party DKMS module or updating a network adapter or RAID controller driver.
To temporarily disable a problematic module, create a configuration file:
echo "blacklist module_name" > /etc/modprobe.d/blacklist-custom.confAfter modifying the configuration, regenerate initramfs using the appropriate command for your distribution.
Disable modules only after confirming that they are responsible for the failure. If a module is required to access the system disk, disabling it may make the system unable to boot.

6. Exit chroot and Reboot the Server

After completing the recovery operations, exit the installed system environment:
exitUnmount the mounted partitions:
umount -R /mntReboot the server:
rebootBefore booting, make sure the ISO image is disconnected. The server should boot from its own system disk.
If the system starts successfully, check that services are running and the server is accessible.

7. Check Hardware Condition

If Kernel Panic continues to occur even after restoring the kernel and filesystem, you need to rule out hardware failures.

Check the Disk

For dedicated servers, check the drive's SMART status:
smartctl -a /dev/sdaPay particular attention to the following attributes:
  • Reallocated_Sector_Ct — reallocated sectors;
  • Current_Pending_Sector — unstable sectors awaiting reallocation;
  • Offline_Uncorrectable — uncorrectable read errors.
An increase in these values may indicate problems with the storage device.
On VPS servers, SMART access is usually unavailable. If you suspect a disk failure, contact your hosting provider to request a check of the physical drive and storage system.

Check RAM

RAM errors can cause random Kernel Panic events, system freezes, and data corruption.
To test the memory, boot from a Memtest86+ image and run a memory test. It is recommended to complete at least one full pass.
If errors are detected, the memory modules and server hardware should be checked.

Check Temperature and Power Supply

On dedicated servers, additionally check the IPMI system event log:
ipmitool sel listPay attention to events related to:
  • CPU and other component overheating;
  • ECC errors;
  • Power failures;
  • Hardware errors involving controllers and storage devices.

8. Analyze System Logs

If the server has been successfully recovered, inspect the logs from the previous boot. They may contain information about the cause of the failure.
View errors from the previous boot:
journalctl -b -1 -p errIf the logs do not contain information from the previous boot, persistent journal storage may not be configured.
Create the directory:
mkdir -p /var/log/journalRestart the service:
systemctl restart systemd-journaldAdditionally, check kernel messages:
dmesg -T | tail -100Debian / Ubuntu:
grep -i -E "panic|oops|error" /var/log/syslog
grep -i -E "panic|oops|error" /var/log/kern.log
AlmaLinux / Rocky Linux:
grep -i -E "panic|oops|error" /var/log/messagesNote: If the system completely freezes or reboots due to a Kernel Panic, the latest messages may not be saved to disk. For more detailed diagnostics in the future, you can configure kdump.

Prevention: How to Avoid Kernel Panic in the Future

It is impossible to completely eliminate the possibility of a Kernel Panic, but you can reduce the risk and make server recovery easier.
1. Keep multiple kernel versions installed.
Do not remove the previous working kernel immediately after an update. If the new version turns out to be incompatible with the hardware or installed modules, you will be able to boot using the older version.
2. Create backups and disk snapshots.
Before updating the kernel or making other important system changes, create a backup or snapshot of the virtual disk.
3. Monitor available disk space.
Keep track of free space in the root partition / and the separate /boot partition. Insufficient free space may interrupt the system update process.
4. Test updates before installing them on production servers.
If possible, test the new kernel on a test server first.
5. Configure automatic reboot after a Kernel Panic.
For servers without continuous administration, you can enable automatic reboot after a critical error:
echo "kernel.panic = 10" > /etc/sysctl.d/99-panic.conf
sysctl --system
The value 10 means that the server will attempt to reboot 10 seconds after a Kernel Panic.
Keep in mind that if the error occurs repeatedly, the server may enter an endless reboot loop. This setting does not fix the underlying cause of the failure.
6. Configure kdump.
Kdump allows you to save a memory dump when a Kernel Panic occurs. This data can be used to analyze the cause of the failure later.
Install the required packages:
Debian / Ubuntu:
apt install kdump-toolsAlmaLinux / Rocky Linux:
dnf install kexec-toolsAfter installation, you must configure and verify the kdump service, including memory reservation for the crash kernel. Installing the package alone is not sufficient to make the mechanism fully operational.
The saved dump can be analyzed using the crash utility.
7. Monitor disk and RAID health.
Use SMART monitoring, smartd, and the standard RAID controller management tools. This will help you detect disk and array problems in a timely manner.

Kernel Panic Causes and Troubleshooting Methods

SymptomPossible CauseRecommended Action
Unable to mount root fsCorrupted initramfs, incorrect root=, or missing disk driverRegenerate initramfs, check UUID values and boot parameters
Kernel panic after an updateFailed update or kernel incompatibilityBoot using the previous kernel and reinstall the new one
Disk errors in logsFilesystem corruption or faulty storage deviceCheck the filesystem and SMART status
Random Kernel Panic eventsRAM or hardware problemsRun Memtest86+ and check IPMI logs
Panic when loading a moduleIncompatible driver or DKMS moduleCheck the module and disable it if necessary
Kernel update errorInsufficient space in /bootFree up space and retry the update

Conclusion

Server recovery after a Kernel Panic should begin with analyzing the error message. If the problem occurred after a kernel update, try booting the previous kernel. If that does not help, use Rescue Mode or LiveCD, check the filesystem, and restore the required components using chroot.
In most cases, a server can be restored to working condition without reinstalling the operating system or losing data.
The main rule is to identify the cause of the failure first and only then proceed with recovery.

SSD Storage VPS

Browse Configurations

Premium Dedicated Servers

Browse Configurations