Xen domainU fails to boot with a "Xen Guest OS Fails to Boot with Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)" error message

From Virtuatopia
Jump to: navigation, search

The most common cause of this problem is that the guest operating system requires a RAM Disk as part of the initial phases boot process and one has not been defined in the Xen configuration file.

A typical Xen configuration file which causes this problem to occur might appear as follows:

kernel = "/boot/vmlinuz-2.6.18-53.1.14.el5xen"
memory = 512
name = "centos.5-1"
vif = [ '' ]
dhcp = "dhcp"
disk = ['tap:aio:/home/nas/xen/byhand/centos.img,xvda1,w', 'tap:aio:/home/nas/xen/byhand/centos.swap,xvda2,w']
root = "/dev/xvda1 ro"

The key line missing from the above configuration file is the "ramdisk = " directive.

There are couple of options to address this issue. One option is to use the RAM Disk already installed on the system (assuming compatibility between the host and guest operating systems). This is located in the /boot directory of the root filesystem of the host operating system. It is important to use the version of the RAM Disk file that matches the kernel specified in the Xen guest configuration file. The current kernel release can be obtained using the uname command:

uname -r
2.6.18-53.1.14.elxen

In order to find the kernel and RAM Disk files associated with the release of the kernel we can execute the following command:

ls /boot/*$(uname -r)*
/boot/config-2.6.18-53.1.14.el5xen      /boot/System.map-2.6.18-53.1.14.el5xen
/boot/initrd-2.6.18-53.1.14.el5xen.img  /boot/vmlinuz-2.6.18-53.1.14.el5xen
/boot/symvers-2.6.18-53.1.14.el5xen.gz

In the above output we can see that the kernel file is named vmlinuz-2.6.18-53.1.14.el5xen, while the corresponding RAM Disk is called initrd-2.6.18-53.1.14.el5xen.img. To specify this file in our Xen configuration file we need to add the a ramdisk line as follows:

kernel = "/boot/vmlinuz-2.6.18-53.1.14.el5xen"
ramdisk = "/boot/initrd-2.6.18-53.1.14.el5xen.img"
memory = 512
name = "centos.5-1"
vif = [ '' ]
dhcp = "dhcp"
disk = ['tap:aio:/home/nas/xen/byhand/centos.img,xvda1,w', 'tap:aio:/home/nas/xen/byhand/centos.swap,xvda2,w']
root = "/dev/xvda1 ro"

Unfortunately, using the system supplied RAM Disk can sometimes lead to boot problems associated with conflicts with SCSI drivers. Another, and better option is to create a new RAM Disk file that does not contain SCSI modules and then reference this file in the Xen configuration file:

mkinitrd --omit-scsi-modules --with=xennet --with=xenblk --preload=xenblk initrd-$(uname -r).img $(uname -r)