CentOS 5.9 Hyper-V VM Kernel Panic After Upgrading From CentOS 5.5← Back
After upgrading a CentOS 5.5 Hyper-V VM to CentOS 5.9 (or RHEL 5.5 to RHEL 5.9 / 5.10) you get a kernel panic when booting with the new kernel. If you select the old kernel from the GRUB menu, the server boots as expected.
Kernels in RHEL / CentOS 5.9+ include version 3.1 of the Hyper-V Integration Services modules and expect them to be loaded on boot. Because those modules did not exist in the 5.5 kernel, they are not detected when mkinitrd runs during the kernel upgrade process and are not included in the new ramdisk image. The solution was to boot from the old kernel and re-run mkinitrd targeting the upgraded kernel version and forcing the inclusion of the necessary Hyper-V kernel modules.
NB: The kernel version may have changed since I wrote this article!
Therefore, you may need to adjust the command. I would recommend taking note of the highlighted kernel version at the GRUB boot menu which caused the kernel panic and modify the version numbers listed in the last 2 parameters to suit your environment.
The following command allowed me to reboot into my freshly updated CentOS 5.9 server:
mkinitrd --with=hid-base-hv --with=hid-hyperv --with=hv_utils --with=hv_vmbus --with=hv_storvsc --with=hv_netvsc /boot/initrd-2.6.18-348.18.1.el5.img 2.6.18-348.18.1.el5
After a successful boot, you will need to shutdown the VM and remove the Hyper-V Legacy Network Adapter through the Hyper-V VM settings dialog and add a standard Network Adapter to allow the VM to take advantage of the hv_netvsc module which will provide much better network performance.