Codementor Events

Kernel Panic on Linux and how to fix it

Published Sep 17, 2019
Kernel Panic on Linux and how to fix it

What is kernel Panic?

In basic terms a kernel panic is a situation when kernel can’t load properly and fails to boot properly or crashes. When the kernel detects an error from which it cannot recover itself. This happens rarely but it is majorly caused due to hosed updates or failing hardware or missing drive or partitions results in panic or voluntary halt to system activity.

Why does it occurs?

A panic may occur as a result of hardware failure or a software bug in the Operating System. Primarily, two things happen when kernel is unable to proceed : the Software runs out of resources and hardware does something unexpectedly or does not do anything. This might happen due to hosed updates, failing hardware, failed or missing drive or partitions. It also occurs in order to prevent your computer from data corruption, risking security breaches as system is in unstable state. So OS stops to prevent damage and facilitates diagnosis of the error and, in usual cases, restart.

How can I understand kernel panic occurred?

Read the boot prompts or turnoff quiet kernel parameter or your machine fails to boot.

What is the effect it has on system?

It might end up crashing your system or failure to boot.

How can I prevent it?

It normally doesn’t happen. But it so, test updates and troubleshoot the problem. Use stable instead of development branches.

For Linux

If kernel panic occurs because of updates to Linux-image-generic then :

Reboot to last working kernel and remove the latest unstable Linux image generic package.

Few days back I faced kernel panic in my laptop and got confused that why it is happening. I tried re-starting my laptop again and again. Then, I searched about it over the internet and understood the problem and here is how I solved the issue.

Steps to follow :

1 Press shift between UEFI/BIOS and login-screen to enter GRUB.
In GRUB select Advanced options for Ubuntu and select Ubuntu, with Linux 4.13.0-xxx-generic where(xxx < 108)
Login to the system and remove the latest generic image and install the stable package instead.

sudo apt-get autoremove
sudo dpkg --configure -a 
sudo apt-get update 
sudo apt-get upgrade

or else you can type sudo apt install linux-image-4.13.0-xxx-generic where(xxx < 108)

You can now reboot your PC by reboot command.

Discover and read more posts from Saurav Jaiswal
get started