HOW-TO restart automatically on Linux Kernel Panic if hanging on boot

Date: 23 September 2009
Source: GraFX

I’ve experienced that when wanting to restart the system (Linux) this has blocked when booting, having a Kernel Panic.

The solutions were rather bizarre, I had to call the datacenter or to appeal to ticketing system, because none of the provider’s restarts helped (from interface – Ctrl+Alt+Del or Hardware Reboot).

I’ve recently found a solution to solve the problem. The provider offers the solution to restart the server in Rescue Mode, that means that it boots my system with another linux, having my partition separately that I can set up and solve some of the problems, like Kernel Panic.

In this case (Kernel Panic) at restart in Rescue Mode, I set up my drive and edit grub.conf than set the old kernel. Usually Kernel Panic happens at a kernel update.

But how do I activate the automatic reboot of kernel panic? This was the initial question, because I do not want all the time to call the datacenter. I edit grub.conf and put in the kernel line a parameter.

kernel / ro root=/dev/md2 vga=0x317 selinux=0 panic=5

You can see in the line above that selinux is deactivated (an another trick) and in case of panic it restarts in 5 seconds.

Now, if you have kernel panic and it restarts, you should have a restart loop rather than restricted access to the whole system. This way you activate rescue mode and you also can troubleshoot.

Other faq items