There are cases where you encounter kernel panic. Kernel panic may occur while you are playing with some experimental kernel module that someone else wrote, or developing a custom kernel module yourself. Kernel panic can happen due to hardware failure as well. If you would like to reboot your system automatically after kernel panic has occurred, there are three different ways to do it.
As shown below, the first method is to add "panic=<num_seconds>" in the grub configuration file, where <num_seconds> is the number of seconds to wait before automatic reboot when kernel panic has occurred.
title Debian GNU/Linux, kernel 2.6.35 root (hd0,0) kernel /boot/vmlinuz-2.6.35 root=/dev/sda1 ro quiet panic=10 initrd /boot/initrd.img-2.6.35
The second method is to edit sysctl.conf file to include kernel.panic parameter as follows.
kernel.panic = 10
Finally, in order to reboot automatically after kernel panic, you could also leverage the /proc filesystem to update a related kernel parameter as follows.
Note that unlike the first two methods, this method does not remain effective across reboots, since any update to the /proc filesystem is not persistent across reboots.
Subscribe to Xmodulo
Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.
Did you find this tutorial helpful? Then please be generous and support Xmodulo!
Latest posts by Dan Nanni (see all)
- How to set up Apt caching server on Ubuntu or Debian - February 7, 2016
- How to monitor OpenFlow messages with packet sniffer - February 2, 2016
- How to search multiple pdf documents for words on Linux - January 13, 2016