I find some useless space in winXP, so I set an partition for the space, after I restart my computer, I find the grub cannot start!!use more than 1 hours I get the method from internet
首先得進入系統阿:
grub2幾種修複方法
1. 雙系統重裝windows造成grub2被改寫的修複
方法一 grub4dos0.4.4
在Windows啟動項上加上grub4dos啟動(不多說了,看置頂貼),重啟選擇進入grub,在命令列下輸入(/boot單獨分區的去掉 /boot)
代碼:
grub>find --set-root /boot/grub/core.img
grub>kernel /boot/grub/core.img
grub>boot
進入grub2菜單,進入系統後再執行
代碼:
sudo grub-install /dev/sd?
方法二 進入Livecd 後修複
引用:
sudo -i
mount 你的根分區 /mnt
mount 你的/boot 分區 /mnt/boot #如果有的話
#掛載你其他的分區,如果有的話
# 重建grub到sda的mbr
grub-install --root-directory=/mnt /dev/sda
2. 由於root分區uuid改變造成的不能正常啟動,只能進入grub rescue模式的修複
代碼:
grub rescue>set
grub rescue>prefix=(hd?,?)/grub
grub rescue>root=hd?,?
grub rescue>set root=hd?,?
grub rescue>set prefix=(hd?,?)/boot/grub
grub rescue>set
grub rescue>root=hd?,?
grub rescue>prefix=(hd?,?)/boot/grub
grub rescue>insmod /boot/grub/normal.mod
grub rescue>normal
這時就可以調出 /boot/grub/grub.cfg,修改相應uuid,
改到命令列下
grub>insmod /boot/grub/linux.mod
grub>set root=hd?,?
grub>linux /boot/vmlinuz-*** root=/dev/sd??
grub>initrd /boot/initrg.img-****
進入系統
hd?,? 是grub檔案所在分區 sda? 是/分區。
3. grub模組和設定檔grub.cfg受損無法啟動時修複
Livcd啟動進入試用
引用:
sudo -i
mount 你的根分區 /mnt
mount 你的/boot 分區 /mnt/boot #如果有的話
# 掛載你其他的分區,如果有的話
# 重建grub到sda的mbr
grub-install --root-directory=/mnt /dev/sda
# 重建grub.cfg
mount --bind /proc /mnt/proc
mount --bind /dev /mnt/dev
mount --bind /sys /mnt/sys
chroot /mnt update-grub
umount /mnt/sys
umount /mnt/dev
umount /mnt/proc
reinstall grub。。
grub-install /dev/sda
Searching for GRUB installation directory ... found: /boot/grub
The file /boot/grub/stage1 not read correctly.
depmod
update-grub
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ...
Generating /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /boot/vmlinuz-2.6.25-2-686
Found kernel: /boot/vmlinuz-2.6.24-1-686
Found kernel: /boot/vmlinuz-2.6.22-3-686
Updating /boot/grub/menu.lst ... done
然後可以在grub命令列下如此恢複:
root (hd0,6)
setup (hd0)