在筆記本上先裝了ubuntu,用grub2啓動,近來又裝了個centos,grub啓動還是用ubuntu上的,重啓報錯 switchroot: mount failed: No such file or directory. Kernel panic - not syncing: Attempted to kill init!
google下有許多說是VFS問題(爲內核不支持SATA硬盤),但我安裝時SATA硬盤可以識別到,不需要boot:linux all-generic-ide irgpoil參數來安裝。
差點重新編譯內核,還是換個思路想一下,找到方法如下:
1、重新安裝下grub(使用centos的),用centos安裝盤重啓進入linux results模式,
#chroot /mnt/sysimage ***改變根目錄***
#mount /dev/sda12 /mnt ***我的ubuntu爲sda12***
#cp /mnt/boot/vmlinuz-2.6.35-22-generic /boot/
#cp /mnt/boot/initrd.img-2.6.35-22-generic /boot/
2、把ubuntu下的grub.cfg中的一段:
linux /boot/vmlinuz-2.6.35-22-generic root=UUID=521d876a-432d-4bdb-94a6-e1374221c200 ro acpi=off quiet splash
initrd /boot/initrd.img-2.6.35-22-generic
複製到centos中的grub.conf修改如下:
title Ubuntu
root (hd0,7)
kernel /boot/vmlinuz-2.6.35-22-generic root=UUID=521d876a-432d-4bdb-94a6-e1374221c200 ro single acpi=off
initrd /boot/initrd.img-2.6.35-22-generic
其中root (hd0,7)爲centos根目錄。
3、重啓選擇Ubuntu,會有一些提示,可能是內核重新找到"/"目錄,自動重啓一下,出現一個選擇菜單,選擇救援模式,出現tty1模式,startx搞定。
題外話:最後這個選擇菜單還有一些root 選項(木有記住詳細),難道是可以越獄了(ubuntu下沒有root),有空大家可以試下,grub2竟然沒有低版本的grub好用,很是費解。