grub rescue模式下启动并修复
来源:互联网 发布:苹果隐藏图标软件 编辑:程序博客网 时间:2024/05/20 11:22
set---设置变量值(同grub2命令)ls--- 列出当前的所有设备。 e.g:(hd0) (hd0,1) (hd0,8) (hd0,7) and so on这个命令可以有参数:ls / 列出当前设为root的分区下的文件ls (hd0,1)/ 列出(hd0,1)分区根目录的文件insmod --- 加载模块normal --- 进入正常模式(只有模块加载正确了才能进入normal模式)
因为在rescue模式下,木有search命令,所以我们就用ls命令来查看grub2文件处于那个分区
- e.g: grub rescue> ls (hd0)/ error: unknown filesystem /*可以用此命令挨个儿的遍历ls显示的所有设备,直到列出的目录文件,就说明grub2的核心文件在此分区了*/
ls (hd0,8)/ /* 查看(hd0,8)分区根目录,看有木有boot/ 文件夹*/ls(hd0,8)/boot/ /*查看此分区的/boot/目录文件,能看到有grub/文件夹*/ls(hd0,8)/boot/gurb/ /*查看此分区/boot/grub/目录下的文件,能看到很多.mod格式的文件还有.img文件 */这样确定了grub2的核心文件在哪里之后,我们就开始转换工作咯:grub rescue> set(回车) /* 查看grub当前的启动分区和路径 */prefix=(hd0,8)/grub /* 确定预启动路径 */root=hd0,8 /* 确定启动分区 */grub rescue> set root=hd0,8 /* 设定grub启动分区 */grub rescue> set prefix=(hd0,8)/boot/grub /* 设定grub启动路径 */grub rescue> set(回车) /* 查看grub设定内容是否和实际的分区路径一致 */root=hd0,8 /* 确定启动分区 */prefix=(hd0,8)/boot/grub /* 确定启动路径 */grub rescue> insmod /boot/grub/normal.mod /* 刚才在查看分区/boot/grub/目录文件时,要注意看看是否有normal.mod文件,木有的话,此命令后会提示找不到此文件*/ grub rescue> normal /* 加载正常模块 */
normal grub> insomd /boot/grub/linux.modnormal grub> set root=hd0,8 /* 确定正常启动分区 */normal grub> linux /boot/vmlinuz-* root=/dev/sda8 (注:*是通配符哦,此处可以以tab键查看具体内核版本镜像) /* 加载内核并确定 /(根)分区 */normal grub> initrd /boot/initrd.img-* (同上) /* 加载initrd.img */normal grub> bootboot启动系统后,打开终端,执行命令修复grub(建议以root用户登录吧,或者直接切换到root用户,这样操作方便些 )root@wuyun:~# update-grub /* 更新重建grub.cfg grub配置文件 */root@wuyun:~# grub-install /dev/sda /* 重建grub到第一硬盘mbr */
grub4 Dos0.4.4 在Windows启动项上加上grub4dos启动(不多说了,看置顶贴),重启选择进入grub,在命令行下输入(/boot单独分区的去掉 /boot)
代码:grub>find --set-root /boot/grub/core.imggrub>kernel /boot/grub/core.imggrub>boot进入grub2菜单,进入系统后再执行代码:sudo grub-install /dev/sd?Ubuntu Grub Rescue方法二 进入Livecd 后修复引用:sudo -imount 你的根分区 /mntmount 你的/boot 分区 /mnt/boot #如果有的话#挂载你其他的分区,如果有的话# 重建grub到sda的mbrgrub-install --root-Directory=/mnt /dev/sda
2:Ubuntu Grub Rescue由于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 -imount 你的根分区 /mntmount 你的/boot 分区 /mnt/boot #如果有的话# 挂载你其他的分区,如果有的话# 重建grub到sda的mbrgrub-install --root-directory=/mnt /dev/sda# 重建grub.cfgmount --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
找到“/”挂载点所在的分区后,就可以修改启动分区了:
grub rescue >root=(hdx,msdosx)
grub rescue >prefix=(hdx,msdosx)/boot/grub
grub rescue >insmod normal
grub rescue >normal
执行完normal命令后,如果normal模块加载成功,那我们就可以看到久违的grub引导菜单了。此时,按“c”切换到grub的命令行模式,修改grub菜单:
grub >root=(hdx,msdosx) //设置系统启动分区,在这里指向内核所在分区
grub >prefix=(hdx,msdosx)
接下来加载Linux.mod模块,并将新的启动信息写入grub:
grub >insmod (hdx,msdosx)/boot/gurb/linux.mod
grub >linux /boot/vmlinuz-xxx-xxx root=/dev/sdax //里边的xxxx可以按Tab键
grub >initrd /boot/initrd.img-xxx-xxx
5.执行boot命令,启动系统(如果系统不能启动,可以重复1-4步,多试几次):
grub >boot
6.正常启动系统后,在终端中输入“sudo update-grub”命令,重新生成“grub.ccfg”文件,更新grub信息,屏幕会出现“generating…”的信息。
如果没有安装grub-pc软件包,或者grub-legacy,会出现无法找到命令的错误。这时,只需安装一下grub-pc软件包即可。(注意:安装过程中会出现提示要不要新建grub到第一分区,由于我的本本第一分区是Windows系统,所以在此我选择“NO”,而是将grub建立在“/”挂载点所在的分区)
7.更新完毕之后,重启,问题解决了。如果问题还没解决,重复1-6步的同时,重新建立grub到第一硬盘mbr:
sudo grub-install /dev/sda
- grub rescue模式下启动并修复
- grub rescue模式下启动并修复
- 修复 Grub rescue 模式并启动
- grub rescue模式下启动和修复
- grub rescue模式下修复
- grub rescue模式下修复
- grub rescue模式下启动
- grub rescue模式下的系统修复
- grub rescue 模式下修复 ubuntu
- Grub Rescue修复Ubuntu引导并添加window 7启动
- 在rescue模式修复GRUB
- Ubuntu下启动出现grub rescue修复方案
- Ubuntu在rescue模式下grub引导的修复
- grub rescue模式下修复分区缺失问题
- Fedora修复grub2启动项grub rescue
- grub rescue急救模式修复gurb引导
- linux修复开机出现grub rescue模式
- GRUB RESCUE下 修复Linux引导
- PHP中文分词
- Unity导入模型的中文纹理文件问题
- 深夜等待去冰封深处
- Fragment保存状态
- EL学习过程(二)
- grub rescue模式下启动并修复
- IIS+PHP+MYSQL安装配置
- python获取shell返回值
- cocos2d-x游戏开发 跑酷(四) 关联物理世界
- Java编程基础之IO流
- 解读Nodejs多核处理模块cluster
- Android进程与线程基本知识
- 不用光驱装XP流程
- C语言 时间类操作