linux试用(3)grub rescue

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)

原文地址:https://www.cnblogs.com/cutepig/p/1789629.html