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: [root@server ~]# 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.

[root@server ~]# 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.

[root@server ~]# 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.

Published by Abhinav Gyawali

Hello there! I'm a teenager, who spends most of his day thinking and analyzing things. I'm full of ideas and creativity! Hence, I realized a blog would be perfect for me to share my ideas!

Leave a comment

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

%d bloggers like this: