-----------
Had to fix this on a server at work. Scenario was that I used Clonezilla to convert a server to an image and then created a virtual server from that image. Because the hard disk drivers had changed the virtual system failed to boot with the above error followed by the dreaded "Kernel Panic". The solution requires us to rebuild our initrd image to suit the new disk architecture.
To start we need to boot from the Centos CD/DVD and into "Rescue system" mode. Follow the prompts until you end up at a shell prompt.
Now, chroot to your system boot;
chroot /mnt/sysimage
Change to your boot directory;
cd /boot
We need to take note of the kernel version that we will be making an image for, it will usually be the latest version. In my case it was 2.6.18-53.el5PAE
We will be using this info later. Just do an ls of the directory to see all the installed images.
Once you have identified the correct initrd image, we probably should back it up.
mv initrd-2.6.18-53.el5PAE.img initrd-2.6.18-53.el5PAE.img.backup
Now, we can build a new initrd;
mkinitrd /boot/initrd-2.6.18-92.el5.img 2.6.18-53.el5PAE
Once the image has been built we should rebuild grub just in case.
grub-install /dev/sda
If your drive is on /dev/hda or something else entirely then substitute the correct value in the command above.
Remove the disc from the drive and exit.
exit
And with that your system should boot up happily!
5 comments:
Man, you saved me days of work. I hit a kernel panic after transferring an lvm partition to a new server. I used the procedure you describe here and the server booted flawlessly afterwards. A million thanks for posting this.
Benoit Gauthier
Gatineau, Quebec
I migrated a backup image to a new server and received the kernel panic. Thank you very much for posting this.
Thank you, this really saved me as I was actually doing the opposite by taking a virtual machine and migrating it to a physical machine.
However, I believe this line is wrong
mkinitrd /boot/initrd-2.6.18-92.el5.img 2.6.18-53.el5PAE
Shouldn't it be
mkinitrd /boot/initrd-2.6.18-53.el5PAE.img 2.6.18-53.el5PAE
Please respond, I just want to make sure I did it right.
Glad I could help Rob. I don't believe it matters what you call the image so you can do either but it has been some time since I did this I may in fact be wrong. Let me know if you find out either way.
Doesn't work for me with Hyper-V 2012 R2 + centos 5.11 + LIS 4.0
So I'm using older 308 kernel - it boots, Newer kernels do not. :(
Post a Comment