[已解决]Grub菜单丢失,出现Grub>

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
头像
lrk
帖子: 83
注册时间: 2007-10-11 17:44

[已解决]Grub菜单丢失,出现Grub>

#1

帖子 lrk » 2008-03-11 22:36

ubuntu 7.40

在windows下用PM从C盘划出10G安装的ubuntu,Grub装在根分区,用windows的NTLDR来引导多系统。因为是校园网用不了,只好用代理上,方法是用VM使用物理硬盘,引导本来的XP,再用XP代理。昨日开代理用了很久,后来关机也很急(就是有些程序没关就直接关了XP和UBUNTU),后来开机就出错了,提示NTLDR丢失。在win下的恢复控制台显示C盘文件时枚举失败,怀疑是C盘磁盘发生错误,手上没什么启动盘,C盘又是NTFS,搞了很久没解决。最后是用了一张win2003来安装,在安装的开始阶段检查完硬盘后提示修复了错误,要重启继续安装,结果重启时正常了,多启动菜单也出来了,当进入了XP以为没事了。谁知今日上UBUNTU时,竟然出错了,Grub我启动菜单没见了,只有Grub>的提示。在网上找了找,找到个方法入系统,但是不成功,还是出错,我截了图,大家看看。
图片
网上找到的解决方法

图片
最终的出错

最奇怪的是好像分区的编号变了,我看了看/boot/grub/menu.lst,原来在ubuntu分区识别为(hd0,3),即是sda4吧?但现在要改成(hd0,1)才对,变成了sda2.问题可能就是出在这,但我又不知怎样解决,大家指点一下。
附件
网上找到的方法
网上找到的方法
2008-03-11_223147.gif (8.08 KiB) 查看 170 次
最终出错
最终出错
2008-03-11_223709.gif (11.41 KiB) 查看 171 次
上次由 lrk 在 2008-03-14 12:27,总共编辑 1 次。
头像
lrk
帖子: 83
注册时间: 2007-10-11 17:44

#2

帖子 lrk » 2008-03-11 22:40

另外问一下,我有7.10的live CD,
能否用它来引导原来的ubuntu?
changys04
帖子: 286
注册时间: 2006-11-08 16:33

#3

帖子 changys04 » 2008-03-11 23:11

试一试
root (hd0,1)
kernel /boot/vmlinuz-2.6.20-16-generic root=/dev/sda2 ro
initrid /boot/initrd.img-2.6.20-16-generic
boot
头像
lrk
帖子: 83
注册时间: 2007-10-11 17:44

#4

帖子 lrk » 2008-03-12 10:42

谢谢楼上,试了一下还是不行哦
附件
2008-03-12_004054.jpg
头像
lrk
帖子: 83
注册时间: 2007-10-11 17:44

#5

帖子 lrk » 2008-03-12 11:02

终于找到方法
kernel时换成了

代码: 全选

kernel		/boot/vmlinuz-2.6.20-16-generic root=UUID=ea5455c5-020d-4998-a7d4-bc6c24351cff ro quiet splash
可以启动了 但那个"root=UUID=ea5455c5-020d-4998-a7d4-bc6c24351cff"又长又难打啊 这是怎么回事

怎样解决好 重装grub有用吗?重装会不会丢失原来的菜单?我看到原来那个menu.lst是还完好存在的,怎么办好?

原来的menu.lst

代码: 全选

# menu.lst - See: grub(8), info grub, update-grub(8)
#            grub-install(8), grub-floppy(8),
#            grub-md5-crypt, /usr/share/doc/grub
#            and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not change this entry to 'saved' or your
# array will desync and will not let you boot your system.
default		0

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout		10

## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
#hiddenmenu

# Pretty colours
#color cyan/blue white/blue

## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line)  and entries protected by the
# command 'lock'
# e.g. password topsecret
#      password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret

#
# examples
#
# title		Windows 95/98/NT/2000
# root		(hd0,0)
# makeactive
# chainloader	+1
#
# title		Linux
# root		(hd0,1)
# kernel	/vmlinuz root=/dev/hda2 ro
#

#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below

## DO NOT UNCOMMENT THEM, Just edit them to your needs

## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
##      kopt_2_6_8=root=/dev/hdc1 ro
##      kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=ea5455c5-020d-4998-a7d4-bc6c24351cff ro

## Setup crashdump menu entries
## e.g. crashdump=1
# crashdump=0

## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,3)

## should update-grub create alternative automagic boot options
## e.g. alternative=true
##      alternative=false
# alternative=true

## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
##      lockalternative=false
# lockalternative=false

## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash

## should update-grub lock old automagic boot options
## e.g. lockold=false
##      lockold=true
# lockold=false

## Xen hypervisor options to use with the default Xen boot option
# xenhopt=

## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
##      altoptions=(recovery) single
# altoptions=(recovery mode) single

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
##      howmany=7
# howmany=all

## should update-grub create memtest86 boot option
## e.g. memtest86=true
##      memtest86=false
# memtest86=true

## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false

## ## End Default Options ##

title		Ubuntu, kernel 2.6.20-16-generic
root		(hd0,3)
kernel		/boot/vmlinuz-2.6.20-16-generic root=UUID=ea5455c5-020d-4998-a7d4-bc6c24351cff ro quiet splash
initrd		/boot/initrd.img-2.6.20-16-generic
quiet
savedefault

title		Ubuntu, kernel 2.6.20-16-generic (recovery mode)
root		(hd0,3)
kernel		/boot/vmlinuz-2.6.20-16-generic root=UUID=ea5455c5-020d-4998-a7d4-bc6c24351cff ro single
initrd		/boot/initrd.img-2.6.20-16-generic

title		Ubuntu, kernel 2.6.20-15-generic
root		(hd0,3)
kernel		/boot/vmlinuz-2.6.20-15-generic root=UUID=ea5455c5-020d-4998-a7d4-bc6c24351cff ro quiet splash
initrd		/boot/initrd.img-2.6.20-15-generic
quiet
savedefault

title		Ubuntu, kernel 2.6.20-15-generic (recovery mode)
root		(hd0,3)
kernel		/boot/vmlinuz-2.6.20-15-generic root=UUID=ea5455c5-020d-4998-a7d4-bc6c24351cff ro single
initrd		/boot/initrd.img-2.6.20-15-generic

title		Ubuntu, memtest86+
root		(hd0,3)
kernel		/boot/memtest86+.bin
quiet

### END DEBIAN AUTOMAGIC KERNELS LIST

# This is a divider, added to separate the menu items below from the Debian
# ones.
title		Other operating systems:
root


# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title		Microsoft Windows XP Professional
root		(hd0,0)
savedefault
chainloader	+1

头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#6

帖子 eexpress » 2008-03-12 11:11

直接(hdx,x)就是,别管uuid
● 鸣学
头像
lrk
帖子: 83
注册时间: 2007-10-11 17:44

#7

帖子 lrk » 2008-03-12 11:14

多谢楼上 直接(hdx,x)是指替换哪里的呢?像3楼那样??可不行啊?
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#8

帖子 eexpress » 2008-03-12 11:21

当然可以啊
root=/dev/sda2
你看下。没带=UUID=的吧。一种写法而已。
估计不行,是你写错了。

如果要恢复使用uuid
/etc/fstab 看下,照抄。
如果fstab也没有
ls -l /dev/disk/by-uuid
如果还不行
执行uuidgen就是。生成一个新的。
● 鸣学
头像
oneleaf
论坛管理员
帖子: 10441
注册时间: 2005-03-27 0:06
系统: Ubuntu 12.04

#9

帖子 oneleaf » 2008-03-12 11:21

kernel /boot/vmlinuz-2.6.20-16-generic root=/dev/sda2 ro quiet splash
changys04
帖子: 286
注册时间: 2006-11-08 16:33

#10

帖子 changys04 » 2008-03-12 11:41

那个"root=UUID=ea5455c5-020d-4998-a7d4-bc6c24351cff"又长又难打啊

给你个烂办法,grub>configfile (hd0,1)/boot/grub/menu.lst
觉得你应该改一下menu.lst里的root (hd0,3)

另外,想看一下你 ls -l /dev/disk/by-uuid/的结果
头像
TeliuTe
论坛版主
帖子: 7668
注册时间: 2007-11-25 13:29
系统: 16/18/20/w7
来自: 新疆博乐
联系:

#11

帖子 TeliuTe » 2008-03-12 13:30

XP和Ubuntu我是用gldr和menu.lst来引导,
gldr 似乎可以自己搜索linux所在的分区,
进入ubuntu后再修改menu.lst
头像
BigSnake.NET
帖子: 12522
注册时间: 2006-07-02 11:16
来自: 廣州
联系:

#12

帖子 BigSnake.NET » 2008-03-12 13:32

root= 后面不一定跟UUID的, 直接跟分区号也可以 root=/dev/sda?
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
aBiNg
帖子: 1331
注册时间: 2006-07-09 12:22
来自: 南京

#13

帖子 aBiNg » 2008-03-12 18:54

BigSnake.NET 写了:root= 后面不一定跟UUID的, 直接跟分区号也可以 root=/dev/sda?
当然可以,呵。
头像
lrk
帖子: 83
注册时间: 2007-10-11 17:44

#14

帖子 lrk » 2008-03-13 10:26

多谢8楼和9楼,终于可以登录了,用了下面的命令:

代码: 全选

root		(hd0,1)

kernel		/boot/vmlinuz-2.6.20-16-generic root=/dev/sda2 ro quiet splash

initrd		/boot/initrd.img-2.6.20-16-generic

quiet

boot

像3楼那样的确是试过并出错的,应该也没有输错,前后对比差异,问题可能就是在“ro quiet splash”这个参数上,之前的时候嫌麻烦没加上,后来看了一下menu.lst是有的就加上了。那么这三个参数到底是什么用的呢?




10楼changys04:
ls -l /dev/disk/by-uuid/的结果:

代码: 全选

总用量 0
lrwxrwxrwx 1 root root 10 2008-03-13 07:21 6F6B-B04A -> ../../sda5
lrwxrwxrwx 1 root root 10 2008-03-13 07:21 7413-C480 -> ../../sda7
lrwxrwxrwx 1 root root 10 2008-03-13 07:21 8E7C49185DEE8CC7 -> ../../sda3
lrwxrwxrwx 1 root root 10 2008-03-13 07:21 d1419681-e1b3-47c3-b13d-b76f7e9b59e6 -> ../../sda8
lrwxrwxrwx 1 root root 10 2008-03-13 07:21 D8BC77B4BC778BAE -> ../../sda6
lrwxrwxrwx 1 root root 10 2008-03-13 07:21 ea5455c5-020d-4998-a7d4-bc6c24351cff -> ../../sda2
lrwxrwxrwx 1 root root 10 2008-03-13 07:21 EA8CD3F98CD3BDEF -> ../../sda1
“grub>configfile (hd0,1)/boot/grub/menu.lst ”这个有什么作用??menu.lst我已修改成了(hd0,1)了,但还是没有恢复菜单。



多谢楼上所有人的热心帮助。

现在我可以登录ubuntu了,但我应怎样才可以修复grub呢,不能每次登录都靠输入啊。
头像
lrk
帖子: 83
注册时间: 2007-10-11 17:44

#15

帖子 lrk » 2008-03-13 22:40

问题还未最终解决啊 有人指点下吗?
回复