Kernel panic – not syncing: Attempted to kill init!

It’s probably too late when you visit this page and the suffering has already accomplished. Anyway, the reason the virtual machine won’t boot is because the VMware Tools are updated on a legacy Linux operating system and a proper driver for the SCSI-controller can’t be found anymore. There is a similar case after converting a physical machine in KB1002402. The full error message you’re facing looks like this:

Kernel panic - not syncing: Attempted to kill init!
Kernel panic – not syncing: Attempted to kill init!

There is no way to rescue the virtual machine without booting from a ISO like Knoppix because we need to rebuild the ramdisk including the right SCSI-controller drivers. Go to the shell and do the following:

mkdir -p /recovery
mount /dev/sda1 /recovery
mount -o bind /dev /recovery/dev
mount -o bind /proc /recovery/proc
chroot /recovery
vi /etc/modprobe.conf
#REMOVE:
alias scsi_hostadapter megaraid_mbox
#ADD:
alias scsi_hostadapter mptbase
alias scsi_hostadapter1 mptscsi
alias scsi_hostadapter2 mptscsih
alias scsi_hostadapter3 mptfc
alias scsi_hostadapter4 mptspi
alias scsi_hostadapter5 mptsas
cat /boot/grub/grub.conf
mkinitrd -v -f /boot/initrd-KERNELVERSION.img KERNELVERSION
exit
umount /recovery/dev
umount /recovery/proc
umount /recovery
reboot

The virtual machine is able to boot again so your problem is solved, you think! Actually it’s solved for the moment… It all started when we migrated the virtual machines to vSphere 5.0 where new VMware Tools are being used off course. As a system operator you want that the VMware Tools are running the current version and you’ll update them (automatically). While the VMware Tools are being updated the ramdisk is also rebuilded and in a normal situation that isn’t a problem at all. The first update touched the /etc/modprobe.conf and that’s why we edited it and rebuilded the ramdisk. With a upgrade from vSphere 5.0 to vSphere 5.1 new tools are available again and updated automatically because the box “Check and upgrade Tools during power cycling” is checked. The expected behavior would be that the update occurs after a reboot but that isn’t the case apparently. The VMware Tools were updated on the fly. Then again it shouldn’t brake the virtual machine but it did :(! The /etc/modprobe.conf is touched and all changes were thrown away. To fix the issue again, before a reboot has taken place, do the following:

vi /etc/modprobe.conf
#REMOVE:
alias scsi_hostadapter megaraid_mbox
#ADD:
alias scsi_hostadapter mptbase
alias scsi_hostadapter1 mptscsi
alias scsi_hostadapter2 mptscsih
alias scsi_hostadapter3 mptfc
alias scsi_hostadapter4 mptspi
alias scsi_hostadapter5 mptsas
mkinitrd -v -f /boot/initrd-`uname -r`.img `uname -r`
reboot

The virtual machine will boot properly now but what will happen when there is a new VMware Tools update :)? If you’re still using the LSI Logic Parallel SCSI-controller you can also change it to the newer LSI Logic SAS SCSI-controller due these modifications.