A Xen Guest OS fails to boot with a "switchroot: mount failed: No such file or directory error message" error message.

From Virtuatopia
Jump to: navigation, search

The typical full output from this type of Xen Guest OS boot failure is as follows:

Mounting root filesystem.
mount: could not find filesystem '/dev/root'
Setting up other filesystems.
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
Booting has failed.

The most common cause of this problem is a conflict of SCSI modules. In order to resolve this it is necessary to create a new initrd initialization RAM Disk without SCSI modules, and then use this to boot the guest Linux operating system. This can be achieved using the following command:

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

Once the new initrd image file has been generated simply refer to it in the "ramdisk" line of the Xen configuration file, for example:

kernel = "/boot/vmlinuz-2.6.18-53.1.14.el5xen"
ramdisk = "/home/xen/initrd-2.6.18-53.1.14.el5xen-no-scsi.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"