FAN (Fully Automated Nagios) Hyper-V Kernel Panic “switchroot: mount failed: No such file or directory”
- By Steve
- 14 May, 2013
- 14 Comments
Fully Automated Nagios 2.4 is based on CentOS 5.9, so these instructions also apply to any upgraded or new installation of CentOS 5.9 on Hyper-V. CentOS 5.9 adds the Linux IC (integration components) for Hyper-V as part of its install process. However, this can cause a kernel panic crash when booting CentOS 5.9 Hyper-V VMs. This includes pre-built ISOs that include CentOS 5.9, such as the latest release of FAN (Fully Automated Nagios), or existing CentOS releases that were upgraded to CentOS 5.9.
This is part of the error message that is displayed because the proper Hyper-V virtual disk driver is not being loaded correctly:
switchroot: mount failed: No such file or directory
Kernel panic - not syncing: Attempted to kill init!
Fixing a brand new installation of a CentOS 5.9 release, including FAN 2.4:
Add the original ISO you used for the installation, such as FAN-2.4 or CentOS 5.9, as a DVD drive in Hyper-V.
Boot the Hyper-V system, and at the boot prompt, type “linux rescue”.
Follow the prompts to mount the existing CentOS installation, and get to the shell.
Run the following command to make the installed system the root (/) environment:
chroot /mnt/sysimage
View the contents of the /etc/grub.conf file to note the exact version of the installed kernel, which will be used in the next command:
cat /etc/grub.conf
Run the following command, replacing “VERSION” with the version you noted from the output of the grub.conf file:
mkinitrd /boot/initrd-VERSION.el5.img VERSION.el5 --preload hv_storvsc --preload hv_vmbus --preload hv_utils -f
For example, if the grub.conf file noted that the kernel was “/vmlinux-2.6.18-348.1.1.el5,” the version number is 2.6.18-348.1.1. The mkinitrd command would then be the following:
mkinitrd /boot/initrd-2.6.18-348.1.1.el5.img 2.6.18-348.1.1.el5 --preload hv_storvsc --preload hv_vmbus --preload hv_utils -f
Type “exit” twice to reboot, and your system should boot normally.
Update 8/1/2013: As noted by Peter in the comments, the above string has el5 in it – note that it’s an “L” and not a “1″ before the 5.
Fixing an upgraded installation of CentOS 5.9, including previous versions of FAN that were upgraded:
To fix an existing installation that you upgraded, when booting, select the previous kernel that worked. Once booted, run the following command to find the exact version number of the new kernel:
cat /etc/grub.conf
Take note of the newest kernel version number.
Next, run the following command, substituting the version number where noted:
mkinitrd /boot/initrd-VERSION.el5.img VERSION.el5 --preload hv_storvsc --preload hv_vmbus --preload hv_utils -f
For example, if /etc/grub.conf noted that the kernel was “/vmlinux-2.6.18-348.4.1.el5″ the version is 2.6.18-348.4.1, so the mkinitrd command would be the following:
mkinitrd /boot/initrd-2.6.18-348.4.1.el5.img 2.6.18-348.4.1.el5 --preload hv_storvsc --preload hv_vmbus --preload hv_utils -f
Reboot your system, and you should now be able to successfully boot from the newest kernel.
Update 8/1/2013: As noted by Peter in the comments, the above string has el5 in it – note that it’s an “L” and not a “1″ before the 5.
Full error messages:
These are the full error messages when booting:
Scanning logical volumes
Reading all physical volumes. This may take a while...
No volume groups found
Activating logical volumes
Volume group "VolGroup00" not found
Trying to resume from /dev/VolGroup00/LogVol01
Unable to access resume device (/dev/VolGroup00/LogVol01)
Creating root device.
Mounting root filessystem.
mount: could not find filesystem '/dev/root'
Setting up other filessystems.
Setting up new root fs
setuproot: moving /dev failed: No such file or directory
no fstab.sys, mounting internal defaults
setuproot: error mounting /proc: No such file or directory
setuproot: error mounting /sys: No such file or directory
Switching to new root and running init.
unmounting old /dev
unmounting old /proc
unmounting old /sys
switchroot: mount failed: No such file or directory Kernel panic - not syncing: Attempted to kill init!
More reading:
http://www.centos.org/modules/newbb/viewtopic.php?topic_id=41048&viewmode=flat&order=ASC&start=0
Thank you SO MUCH !
Great Job
Worked perfect
Thank you very much.
just to make it work on a VM to a Hyper-V in 2012, I had to:
mkinitrd /boot/initrd-2.6.18-348.4.1.el5.img 2.6.18-348.4.1.el5 –preload hv_storvsc –preload hv_vmbus –preload hv_utils –preload hv_netvsc –preload hid-hyperv –preload hid-base-hv -f
don’t work, it said no module available for kernel 2.6.18-348.1.1.e15
help plz
Please see my reply below to Ryan.
I get the same message as Overhead…
” No modules available for kernal “2.6.18-348.1.1.e15″
Anyone else able to figure this out??
What is the content of your grub.conf file? You need to get the exact kernel version on your computer.
Run the following command:
cat /etc/grub.conf
There should be a listing of “kernel” followed by something like “/vmlinux-2.6.18-348.1.1.el5″ – the part after vmlinux- is the version that you should be putting into the mkinitrd command.
I had the same problem. I thought the last part of the version string was “E15″, not “EL5″.
Thanks for the great writeup! Saved my bacon!
Got it! Yeah, it does look like a “1″, but it’s an “L” as you noted. This explains why some people had trouble.
brilliant, yes “EL5″ lowercase L, not E15. Thanks!
[root@h11-53 ~]# mkinitrd /boot/initrd-2.6.18-128.el5.img 2.6.18-128.el5 –preload hv_storvsc –preload hv_vmbus –preload hv_utils -f
No module hv_storvsc found for kernel 2.6.18-128.el5, aborting.
it said no moduel hv_storvcs found …
Thanks it worked. Do you know how I could automatically load these modules into an preinstallation ISO disk.
We use a kickstart to unattend the installation process of the OS. Can somebody give me a pointer where I could configure to load these modules once the installation is done??
Regards
Just install FAN version 2.2 instead of newest 2.4. The 2.4 version is using CentOS version which is missing some vital Hyper-V drivers.
Thank you very much that worked !