Apr 10 2011
∞
How to upgrade CentOS Linux running under Hyper-V
When CentOS Linux, running under Hyper-V, is upgraded to a new kernel, it will probably fail to reboot. Open Hyper-V Manager and look at the CentOS server’s screen. Most likely you will see the following error:
switchroot: mount failed: No such file or directory
Kernel panic - not syncing: Attempted to kill init!
Cause
The error is caused by the Microsoft Hyper-V Linux Integration Components not loading properly under the new kernel.
Solution
- From the Hyper-V Manager, reboot the server. At the moment when it says
“Booting CentOS in 3…2…1…,” press any key. You’ll see several kernels listed,
including the newest one and the previous one.
- Make a note of the full, exact version number of the newest kernel.
- Select the previous kernel and press Enter. It should boot successfully under the old kernel.
- Log in as root.
- Use Hyper-V Manager to attach the Microsoft Linux Integration Components
CD (
LinuxIC v21.iso, available from http://www.microsoft.com/downloads/en/details.aspx?FamilyID=eee39325-898b-4522-9b4c-f4b5b9b64551). - Mount and copy it to the Linux server.
mkdir -p /mnt/cdrommount /dev/cdrom /mnt/cdromcp -rp /mnt/cdrom /opt/linux_icumount /mnt/cdrom
- By default the Linux IC will build for the currently-running kernel. We want
to build for the newer kernel instead. Make this happen:
cd /opt/linux_ic- [substitute the new kernel’s version in the following command]
grep -ilR uname * | xargs sed -i 's/uname \-r/echo "2.6.18-238.5.1.el5"/g' make && make installreboot
Your server should now boot under the new kernel.
(Found in this message thread on the CentOS user forums.)