Or how i got rid of "switchroot: mount failed: 22"
While i was moving one of my pizza box CentOS 4 installations to VMware i ran into a boot problem i hadn't seen before. The pizza box was an IBM x335 with IDE controller. The VMware VM had a LSI SCSI controller. After rsyncing the entire hard drive over to an additional drive on a running CentOS VM, i moved the drive into its own VM. Then i tried to boot it, and quickly got this wonderful:
switchroot: mount failed: 22 umount /initrd/dev failed: 2 Kernel panic - not syncing: Attempted to kill init!
This was very disappointing to me. After a bit STFW, it became apparent that my initrd wasn't the SCSI kind. So i booted back to my VM that had the drive as an extra drive. From there i mount the extra drive, updated /etc/modprobe.conf and rebuilt initrd. This went something like:
mount /dev/sdb1 /mnt
Then i replaced the contents of the original /etc/modprobe.conf:
alias eth0 tg3 alias eth1 tg3 alias usb-controller ohci-hcd
alias eth0 pcnet32 alias scsi_hostadapter mptbase alias scsi_hostadapter1 mptscsi alias scsi_hostadapter2 mptfc alias scsi_hostadapter3 mptspi alias scsi_hostadapter4 mptsas alias scsi_hostadapter5 mptscsih alias usb-controller uhci-hcd
This was followed by rebuilding my initrd images under chroot.
mount --bind /dev/ /mnt/dev/ mount --bind /proc/ /mnt/proc/ mount --bind /sys/ /mnt/sys/ chroot /mnt/ su mkinitrd -f /boot/initrd-2.6.9-55.0.2.EL.img 2.6.9-55.0.2.EL
I repreated the last step for all my kernel versions, then shut down this VM and successfully rebooted the one that had this drive as the primary drive.