admin管理员组

文章数量:1530942

现象
开机直接进入grub shell画面,无法启动操作系统

原因分析:开机加电后,根据bios里的设定,在第一块盘上的MBR里寻找到开机管理程序boot loader也就是grub,接下来应该读取grub的配置文件,根据设置选择核心文件和核心的驱动文件initramfs,然后交给核心,挂载文件系统,启动程序等流程。但是这个时候,无法读取grub的menu.lst文件,可能是menu.lst文件损坏或者grub的主程序损坏,因为grub分为两个stage,stage1是主程序,stage2是配置文件和环境文件。

解决方法
尝试手动指定核心文件和虚拟文件系统文件启动来替代menu.lst进行启动

kernel (hd0,0)/vmlinuz-2.6.32-279.el6.x86_64 root=/dev/mapper/vg_dg1-lv_root
initrd (hd0,0)/initramfs-2.6.32-279.el6.x86_64.img
boot

注意:如果没有写挂载根目录的设备,在启动的时候,会出现如下报错

发现能正常启动,启动后检查/boot/grub/menu.lst文件,和手动输入的相同
尝试重新安装grub的主程序,在grub shell下操作
安装grub 主程序

grub> root (hd0,0)
root (hd0,0)
 Filesystem type is ext2fs, partition type 0x83
grub> find /grub/stage1
find /grub/stage1
 (hd0,0)
grub> setup (hd0)
setup (hd0)
 Checking if "/boot/grub/stage1" exists... no
 Checking if "/grub/stage1" exists... yes
 Checking if "/grub/stage2" exists... yes
 Checking if "/grub/e2fs_stage1_5" exists... yes
 Running "embed /grub/e2fs_stage1_5 (hd0)"...  27 sectors are embedded.
succeeded
 Running "install /grub/stage1 (hd0) (hd0)1+27 p (hd0,0)/grub/stage2 /grub/grub.conf"... succeeded
Done.
grub>quit

重启操作系统,正常进入

本文标签: 无法正常直接进入画面CENTOSShell