欢迎来到博达网站群学习网!
|
当前位置: 九游会 >> 知识库 >> 部署类 >> 操作系统 >> 正文

linux下grub.conf文件损坏系统无法正常启动-九游会

发布时间:2016-08-03    浏览次数:次

前言:

grub.conf文件出错,系统无法启动

分析:

我们将来看看grub.conf文件内语句

# grub.conf generated by anaconda

#

# note that you do not have to rerun grub after making changes to this file

# notice: you do not have a /boot partition. this means that

# all kernel and initrd paths are relative to /, eg.

# root (hd0,0)

# kernel /boot/vmlinuz-version ro root=/dev/hda1

# initrd /boot/initrd-version.img

#boot=/dev/hda (注:以上以符号井"#"开头的行表示被注释掉,没有任何意义)

default=0 (注:默认的操作系统就是由default控制的。default后加一个数字n,表明是第n+1个。需要注意的是,grub中,计数是从0开始的,第一个硬盘是sd0,第一个软驱是fd0,等等。所以,default 0表示默认的操作系统在这儿是red hat linux (2.4.18-14)如果你修改成1就是winxp了)

timeout=3 (注:timeout表示默认等待的时间,这儿是3秒钟。超过3秒,用户还没有作出选择的话,系统将自动选择默认的操作系统;当然你可以改成任何你乐意的时间)

splashimage=(hd0,0)/boot/grub/splash.xpm.gz (注:指定开机画面文件splash.xpm.gz的位置,也可以splash /boot/logo/800x600x8.img)

title red hat linux (2.4.18-14) (注:表示red hat linux的菜单项)

root (hd0,0)

kernel /boot/vmlinuz- 2.4.18-14ro root=label=/(说明

/boot/ vmlinuz- 2.4.18-14就是要载入的内核。后面的都是传递给内核的参数。root=label=/就是linux的硬盘分区表示法,ro是readonly的意思。initrd用来初始的linux image,并设置相应的参数。)

initrd /boot/initrd-2.4.18-14.img (注:初始化)

boot

九游会的解决方案:

显示如下:

grub version 0.5.96.1 (640k lower / 3072k upper memory)

[ minimal bash-like line editing is supported. for the first word, tab

lists possible command completions. anywhere else tab lists the possible

completions of a device/filename. ]

grub>

欢迎使用grub控制台。

grub> root (h

现在,按一次tab键。如果系统中有多个硬盘,grub将显示可能完成的列表,从"hd0"开始。如果只有一个硬盘,grub将插入"hd0,"。如果有多个硬盘,继续进行,在("hd2")中输入名称并在名称后紧跟着输入逗号,但不要按enter键。部分完成的root命令看起来如下:

grub> root (hd0,

现在,继续操作,再按一次tab键。grub将显示特定硬盘上所有分区的列表,以及它们的文件系统类型。在我的系统中,按tab键时得到以下列表:

grub> root (hd0, (tab,按tab一下键)

possible partitions are:

partition num: 0, filesystem type is fat, partition type 0x6

partition num: 2, filesystem type is ext2fs, partition type 0x83

partition num: 4, filesystem type unknown, partition type 0x7

partition num: 5, filesystem type is ext2fs, partition type 0x83

partition num: 6, filesystem type is fat, partition type 0xb

partition num: 7, filesystem type is fat, partition type 0xb

partition num: 8, filesystem type is ext2fs, partition type 0x83

partition num: 9, filesystem type unknown, partition type 0x82

grub> root (hd0,

现在已安装了root文件系统,到装入内核的时候了

grub> kernel /boot/vmlinuz-2.4.2 root=/dev/hda5 ro

[linux-bzimage, setup=0x1200, size=0xe1a30]

您已经安装了root文件系统并装入了内核。现在,可以引导了。只要输入"boot",linux引导过程就将开始。

常见grub除错方法的思路

 

首先进去linux的rescue模式!

用软盘或光盘启动,然后在启动的提示符输入:linux rescue

按照提示进入一个shell状态,你可以到/mnt/下面看到一个sysimage这么目录,进去以后,就是你安装linux的/分区.

使用命令将根分区变为当前目录的根分区:chroot /mnt/sysimage

然后转到/sbin/这个目录中.

使用fdisk -l显示当前分区情况,然后使用#grub-install /dev/hdx(x为你使用的是那块硬盘安装的,一般情况下是hda)

使用exit推出chroot,再使用exit退出linux rescue模式,系统将重新启动!取出光盘,应该可以看到grub安装好了.

网站地图