FAQ: How to set up atomatic Linux reboot if kernel panic occurs?

Welcome to Linux Screw! If you're new here, you may want to subscribe our RSS feed.

Question: How can I get my Linux server rebooted/restarted automatically if it caught a kernel panic?

Answer: As you might know, kernel panic is an action taken by an operating system upon detecting an internal fatal error from which it cannot safely recover; the term is largely specific to Unix and Unix-like systems (it’s a wiki’s description).

By default Linux wouldn’t not reboot after panic occurs, but the following option of sysctl will cause a kernel to reboot after N seconds you specify. In our example server will be rebooted in 15 seconds if kernel panic stopped its operation:

1. Open sysctl’s configuration file:
sudo nano /etc/sysctl.conf

2. Add there the following line:
kernel.panic = 15

or

1. Execute the following command:
/sbin/sysctl -w kernel.panic=15

Hope it helps!

 
 
» You might also be interested in the following articles:
OpenBSD: Secure Mail Server with Postfix, MySQL, ClamAV, SpamAssassin, Amavis-new
10+ advices BEFORE you rebuild Linux kernel
Speedlinks - 29 December, 2008
Web app. of the day: interactive Linux kernel map
Manage FreeBSD kernel modules on the fly



» Want to stay up to date? Subscribe to our E-MAIL or RSS feed!

4 Responses to “FAQ: How to set up atomatic Linux reboot if kernel panic occurs?”


  1. 1 pinoyskull

    Very nice tip, this is very useful to admins who administer linux boxes remotely.

  2. 2 Son Nguyen

    Great tip, I didn’t even know it’s possible.

  3. 3 lemon

    This tip is very useful if you compile a new kernel remotely, and you want a safe net if something goes wrong; but you must pay attention to not load the same kernel when you startup (so new kernel not on default in lilo/grub ) :)

  1. 1 Cómo reiniciar automáticamente tras un Kernel Panic en Linux » rm-rf.es

Leave a Reply




Friendly Sites:Who is behind Linux Screw?
Aspiring Sysadmin | GeekyBits³ | Bash Cures Cancer | TOTMS
Linux Operating System | Small Linux Deployments | My SysAd Blog
The Danesh Project | ZEPY | Linux config Wiki | Planet Sysadmin
The Sys Admin | {buhay sysad} | a non-geek's linux notes
Linux HOWTOs, Tutorials & Projects with Adam Palmer | LinuxAlt.Com
My name is Artem Nosulchik (artiomix AT gmail DOT com) and I'm Linux/Unix, Cisco systems engineer. The main idea of Linux Screw is to share relevant knowledge, skills and observations over The Web. Here you can find a lot of information related to different Linux distributions, FreeBSD, IOS as well as a other Open Source around staff. Read more ››