在双启动上重新安装 Windows 后出现 GRUB 救援提示

在双启动上重新安装 Windows 后出现 GRUB 救援提示

我同时启动了 Windows 和 Ubuntu。当我重新安装 Windows 时,它不再进入 GRUB 菜单。

显示的是:

error: no such partition.
grub rescue>

我想修复这个问题没有用一个现场 CD或 USB 记忆棒,所以我只是使用 GRUB 救援命令。

我找到了有用的页面修复 Ubuntu 上损坏的 GRUB 2 引导加载程序,并附上操作说明(和解释):

grub> ls

(hd0) (hd0,5) (hd0,1) (fd0)

grub> set prefix=(hd0,1)/boot/grub
grub> set root=(hd0,1)

grub> set
?=0
color_highlight=
color_normal=
pager=
prefix=(gd0,1)/boot/grub
root=hd0,1

grub> ls /boot

grub/ System.map-2.6.32-21-generic abi-2.6.32-21-generic config-2.6.32-21-generic memtest86*.bin vmcoreinfo-2.6.32-21-generic vmlinuz-2.6.32-21-generic System.map-2.6.32-22-generic initrd.img-2.6.32-21-generic config-2.6.32-22-generic abi-2.6.32-22-generic vmcoreinfo-2.6.32-22-generic initrd.img-2.6.32-22-generic vmlinuz-2.6.32-22-generic

grub> insmod /boot/grub/linux.mod
grub> linux /vmlinuz root=/dev/sda1 defaults
grub> initrd /initrd.img
grub> boot_

但事情是这样的:

error: no such partition.

grub rescue> help

Unknown command 'help'

grub rescue> ls /boot

error: no such partition.

grub rescue> ls
(hd0) (hd0,msdos3) (hd0,msdos2) (hd0,msdos1)
grub rescue> set prefix=(hd0,msdos1)/boot/grub
grub rescue> set root=(hd0,msdos1)

grub rescue> set

prefix=(hd0,msdos1)/boot/grub
root=hd0,msdos1

grub rescue> ls /boot
error: unknown filesystem.

grub rescue> boot

Unknown command 'boot'

所以你可以看到ls引导显示错误未知文件系统

答案1

正如评论所说,这篇博文非常完美:修复 Ubuntu 上损坏的 GRUB 2 引导加载程序

我遇到的问题是,我正在查看ls正在给予...即:

(hd0) (hd0,msdos3) (hd0,msdos2) (hd0,msdos1)

我错误地认为它映射到了以下顺序:

[empty space from deleted recovery partition, windows 7, swap, Ubuntu]

令人厌烦的 GRUB 救援ls命令应该说:

(hd0) (hd0,msdos1) (hd0,msdos2) (hd0,msdos3)

...这个故事的寓意是尝试每个分区直到它起作用=p

error: no such partition.

grub rescue> ls /boot
error: no such partition.

grub rescue> ls
(hd0) (hd0,msdos3) (hd0,msdos2) (hd0,msdos1)

# This is a comment. The following is choosing
# the non-Linux partition by mistake... error
# unknown filesystem should alert you to the
# mischoice. Keep choosing until you get
# the right one!

grub rescue> set prefix=(hd0,msdos1)/boot/grub
grub rescue> set root=(hd0,msdos1)

grub rescue> set
prefix=(hd0,msdos1)/boot/grub
root=hd0,msdos1

grub rescue> ls /boot
error: unknown filesystem.

# Here I choose the correct partition - an
# Ubuntu one. Note that the ls /boot
# doesn't give an error!

grub rescue> set prefix=(hd0,msdos3)/boot/grub

grub rescue> set root=(hd0,msdos3)

grub rescue> set
prefix=(hd0,msdos3)/boot/grub
root=hd0,msdos3

grub rescue> ls /boot
blah blah blah loads of stuff; I'm not
going to type it all out... it's similar
to the junk about generic and abi
from the blog thing.

grub rescue> insmod /boot/grub/linux.mod
grub rescue> linux /vmlinuz root=/dev/sda3 defaults
grub rescue> initrd /initrd.img
grub rescue> boot

# Booted! It's TERMINAL time! Open your Linux
# terminal and plonk this in. Credit to
# <http://techgage.com/news/repairing_a_broken_grub_2_boot-loader_on_ubuntu/>

sudo update-grub
sudo grub-install /dev/sda

相关内容