Linux – Kernel Panic on CentOS – Google Compute Engine Instance

centosgoogle-cloud-platformgoogle-compute-enginegrublinux

I'm getting a kernel panic error in a CentOS instance of Google Compute Engine. I'm able to see the error and already figure out how to solve it, but I can't get into the GRUB menu trough the serial console.

dracut: Mounted root filesystem /dev/sda1
dracut: Loading SELinux policy
type=1404 audit(1479929075.614:2): enforcing=1 old_enforcing=0 auid=4294967295 ses=4294967295
dracut: SELinux: Could not open policy file <= /etc/selinux/targeted/policy/policy.24: No such file or directory
 /sbin/load_policy: Can't load policy and enforcing mode requested: No such file or directory
dracut Warning: Initial SELinux policy load failed.
dracut FATAL: Initial SELinux policy load failed. Machine in enforcing mode. To disable selinux, add selinux=0 t
o the kernel command line.
dracut Warning: 
dracut Warning: Boot has failed. To debug this issue add "rdshell" to the kernel command line.
dracut Warning: Signal caught!
dracut Warning: Boot has failed. To debug this issue add "rdshell" to the kernel command line.
Kernel panic - not syncing: Attempted to kill init!
Pid: 1, comm: init Not tainted 2.6.32-642.11.1.el6.x86_64 #1
Call Trace:
     [<ffffffff815482b1>] ? panic+0xa7/0x179
     [<ffffffff8112aea0>] ? perf_event_exit_task+0xc0/0x340
     [<ffffffff81081f97>] ? do_exit+0x867/0x870
     [<ffffffff8119b735>] ? fput+0x25/0x30
     [<ffffffff81081ff8>] ? do_group_exit+0x58/0xd0
     [<ffffffff81082087>] ? sys_exit_group+0x17/0x20
     [<ffffffff8100b0d2>] ? system_call_fastpath+0x16/0x1b

The CentOS version is 6.7 and this happened after a yum update. I'm just trying to get into GRUBs menu to append "selinux=0" to boot into Permissive mode, but it seems that it's not possible through the serial console. I would appreciate any help.

Best Answer

I've made a work around and got my instance running again. The basic problem is that, by default, linux instances on Google Cloud are set to zero timeout at GRUBs menu . So, you cannot access the menu, even through the serial console. I will describe the steps I made to restore my instance.

  1. Create a snapshot of the machine startup disk.
  2. Create a disk which the source is the snapshot created on the first step. Let's call it rescue-disk.
  3. Launch a new Linux instance. May be the micro instance and you can delete it later. Call it rescue-instance.
  4. Attach the rescue-disk to the rescue-instance.
  5. From the rescue-instance mount the rescue-disk and change the <mount point>/etc/grub.conf as follow:
    root (hd0,0)
    kernel /boot/vmlinuz-2.6.32-642.11.1.el6.x86_64 ro root=UUID=23f78139-a1ac-4a7a-b608-05687cecfa37 selinux=0
  1. De-attach rescue-disk from the rescue-instance and delete that instance if you want.
  2. Launch a new instance which the source is the rescue-disk. You can do that in the disk.

If you already have another linux instance running on your gcloud you don't need to create a new instance, just use VM you have.