Reboot Server After Kernel Panic | RHEL7

It is always good to set up your server to reboot after a kernel panic. And here, I will be teaching you how to do just that. It is fairly easy. Let’s get started.

The command that we will be using here is sysctl. And the configuration file that we will need is:/etc/sysctl.conf.

Firstly, read the manual page of sysctl by, entering man sysctl. Sysctl is a command which allows the user, not all users, only the root user, to configure kernel parameters at runtime.

Now, take a look at all the kernel parameters by entering the command: [[email protected] ~]# sysctl -a

As there are a lot of kernel parameters which can be set, but, we only need one related to kernel panic, we are gonna grep (search) for kernel.

[[email protected] ~]# sysctl -a | grep kernel.

Now, you should see a lot of parameters which have kernel in their name. But, scroll up pr down if you need to, and you should see something like this:
kernel.panic = 0

Now, go to the configuration file, i.e./etc/sysctl.conf. I prefer vim but, you can use any text editor that you like.

[[email protected] ~]# vim /etc/sysctl.conf
     #scroll to the end of the file
     [] -> #hit o to go in insert mode
     kernel.panic = 10
     [esc] #hit the Escape key
     [:x] #type it to save and exit.

There, you have set your kernel parameter. The server will reboot within 10 seconds of kernel panic. Reboot your server for the changes to take place.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: