ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Changing Kernel Panic Behavior on Linux

    IT Discussion
    linux kernel panic
    2
    2
    1.4k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • scottalanmillerS
      scottalanmiller
      last edited by

      When a kernel panic is received in Linux we can either do nothing or we can reboot. Typically in a production environment we would want to reboot and hopefully return the system to a working state as quickly as possible. In a non-production environment where we are more interested in troubleshooting than in bringing services back online as quickly as we can we are more likely to want to not reboot so that we can investigate from the console while the box is still panicked.

      The parameter for this behavior is stored in /proc/sys/kernel/panic. The settings are simple. A value of zero for “never reboot, just wait for intervention” and any positive integer indicating the number of seconds to wait after detecting a kernel panic before rebooting.

      Let’s view our current setting:

      # cat /proc/sys/kernel/panic
      0
      

      So in this case we are going to just “sit there” should the kernel panic. Now we will modify this value so that the system will automatically restart after thirty seconds once the kernel has had a panic.

      # echo "30" > /proc/sys/kernel/panic
      # cat /proc/sys/kernel/panic
      30
      

      This is perfect for testing but the change is not permanent and will revert to default when the system restarts. To make the change permanent we need to add an entry to the /etc/sysctl.conf file.

      # echo "kernel.panic = \"30\""  >> /etc/sysctl.conf
      

      Originally found on my Linux blog: https://web.archive.org/web/20140823021548/http://www.scottalanmiller.com/linux/2011/06/22/change-kernel-panic-behavior/

      1 Reply Last reply Reply Quote 3
      • RojoLocoR
        RojoLoco
        last edited by

        What I think of every time I hear the phrase "kernel panic":

        Youtube Video

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post