Linux: CentOS 6 kernel panic+0xa7/0x16f fix

So ran into a view issue for a Linux Host today. Kernel Panic !!!

There could be a number of reasons that you might get this error. The three common reasons may be:

  1. There was a change to selinux config – (that might be an error in the config file)
  2. There are disk errors
  3. The kernel is corrupted

None of the kernels in the GRUB boot menu will boot, you get a kernel panic:

1-kernel-panic

Kernel panic – not syncing: Attempted to kill init!
Pid: 1, comm: init Not tainted 2.6.32-504.3.3.el6.x86_64 #1
panic+0xa7/0x16f
do_exit+0x862/0x870
fput+0x25/0x30
do_group_exit+0x58/0xd0
sys_exit_group+0x17/0x20
system_call_fastpath+0x16/0x1b

Booting in single user mode doesn’t work either.

Here’s how to fix this:

            1. Reboot, and go in the GRUB menu. You have 3 seconds to strike the arrow keys before it will automatically boot the default kernel.2-grub-menu
            2. Select the first line, the default kernel, and press the E key on the keyboard to edit the parameters. You will then see the following.
              3-grub-edit
            3. Use the arrow keys to select the 2nd line, that starts with kernel. Press the E key to change this line, use the arrow keys to go to the end and type a space followed by enforcing=0
              4-grub-edit
            4. Press enter to conform and then press B to boot the system.
              It should boot up fine now.
            5. Choose your solution:

              SELINUX Config FileDisk ErrorsRebuild Kernel

              Disabled for the SELINUXTYPE variable, that’s wrong it has to be for the SELINUX variable. In the screenshot below I show you the correct settings in the config file to disable SELINUX.

              5-selinux-disabled

            6. Reboot.