Kernel panic

From LinuxReviews
Jump to navigationJump to search

Kernel panic is when something is extremely bad happens that the kernel gives up and panics. This is typically caused by software such as Sun's Java Virtual Machine.

The Trick: Reboot automatically when the kernel panics[edit]

You can make the kernel reboot automatically instead of halting (the default behavoir) if/when the kernel panics.

You can set this by sending a message to /proc (as root):

echo 5 >/proc/sys/kernel/panic

The value given is seconds to wait before rebooting. The default setting is 0, which doesn't cause a reboot.

To check the current settings:

cat /proc/sys/kernel/panic

You can also add:

kernel.panic=5

to the file /etc/sysctl.conf

It's also possible to do this by adding panic=5 to the boot-loader command-line. This is good in the few rare cases (suck as boot with a bad initrd) where the kernel can panic before reading /etc/sysctrl.conf.

Only on oops[edit]

It's also possible to set a different waiting time before rebooting on oops panics by giving a value to /proc/sys/kernel/panic_on_oops.