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: Signal caught!
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.

  • Have you tried to turn off your instance, switch to another instance type and then get back your type of instance and turn on again? – Victor Perov Nov 24 '16 at 12:43
  • For Amazon EC2, same as below: disconnect the EBS volume, reconnect to another instance (same zone + subnet - everything has to match exactly! us-west-2a, 2b, 2c, etc.), mount as /sdf, shows as /dev/xvdj inside the instance, mount /dev/xvdj /xvdj, edit /xvdj/boot/grub/grub.conf, save, re-attach EBS to old instance, start. – Chloe Jun 5 '17 at 16:59

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.

  • Well what happens if you run yum update again? How do you solve it permanently? Why do you have different username between the answer and question? – Chloe Jun 5 '17 at 16:56

Same as other answer to access and edit the disk and get it bootable, but to actually fix the problem,

# yum install selinux-policy-targeted   # may have to use reinstall
# semodule -B
# vi/nano /boot/grub/grub.conf          # remove selinux=0
# reboot

From the system logs:

*** Relabeling could take a very long time, depending on file
*** system size and speed of hard drives.


Your Answer

