用U盘安装CentOS,如果使用默认的boot挂载,会将引导安装在U盘上,必须用U盘启动,遇到这种情况可以通过grub手动写入引导。(我在另一台服务器上安装时手动设置boot但是装好停留在Grub无法启动,这个没深入研究了,在这里就先说手动修改引导方法,给遇到同样问题的人参考,如有错误,欢迎拍砖)
进入grub
[root@mfsmaster home]# /sbin/grub
找到grub的位置
grub> find /grub/stage1
(hd1,0)
如果提示Error 15: File not found,则尝试 find /boot/grub/stage1 或者 find stage1
(hd1,0)代表的第二个硬盘的第一个分区,相应的(hd0,0)代表的就是第一个硬盘第一个分区,这一步其实就是告诉我们引导被写入了U盘中= =
下面进入正题
我们将引导写入(hd0,0),即第一个磁盘第一个分区中,我在这里的系统盘是这个,具体可以在linux下用df指令查看
grub> root (hd0,0)
Filesystem type is ext2fs, partition type 0x83
grub> 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)"... 15 sectors are embedded.
succeeded
Running "install /grub/stage1 (hd0) (hd0)1+15 p (hd0,0)/grub/stage2 /grub/grub.conf"... succeeded
Done.
grub> reboot
然后修改启动的 /boot/grub/menu.lst 或者 /boot/grub/grub.conf CentOS下这两个文件是绑定的,改一个即可
[root@mfsmaster home]# vi /boot/grub/menu.lst
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd1,0)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/sdb
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-274.3.1.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-274.3.1.el5 ro root=/dev/VolGroup00/LogVol00
initrd /initrd-2.6.18-274.3.1.el5.img
title CentOS (2.6.18-238.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-238.el5 ro root=/dev/VolGroup00/LogVol00
initrd /initrd-2.6.18-238.el5.img
title Other
rootnoverify (hd0,3)
chainloader +1
把当中的(hd1,0)都改成(hd0,0),splashimage=(hd0,0)/grub/splash.xpm.gz 这个是开机引导背景图片的位置,改不改都关系不大,重启CentOS就可以正常启动了
参考文档:http://www.linuxidc.com/Linux/2011-05/35693.htm
分享到:
相关推荐
CentOS GRUB引导错误无法进入系统解决办法
CentOS 8 开机启动Nginx脚本
Grub启动命令解析 超级经典,我见过的比较系统详细的资料
此顺序用来决定开机时的排列顺序,启动顺序是按0、1、2进行排列。(我是以menuentry为开头分配数的) vi /etc/default/grub 将GRUB_DEFAULT=saved 改成 GRUB_DEFAULT=0 或者想默认进入的系统相对应的序号。
前言:打包好的springboot项目,可以使用java -jar xxx.jar的方式启动。当出现多个springboot项目需要启动的时候,可以使用脚本启动的方式。这在springcloud项目的开发测试阶段尤为有用。以下展示启动脚本示例,过程...
CentOS MySQL启动和关闭命令
linux 操作系统,主要是Centos 系统的开机启动过程,如:开机自检、GRUB2启动引导阶段、内核引导、/usr/lib/systemd/systemd 等模块的详细介绍。
vim /boot/grub/grub.conf #编辑grub引导菜单的配置文件 df -Th #查看挂载信息 gunzip /root/Desktop/splash.xpm.gz #解压缩文件,删除源文件 vim /root/Desktop/splash.xpm #用编辑器打开图片文件 grub-md5-crypt ...
安装centos7恢复windows引导
centos设置tomcat开机自启动
Linux CentOS Mysql修改默认端口.docx
Centos7如何启动tomcat、启动tomcat的命令
CentOS修改在VMWare环境中修改IP地址[整理].pdf
centos图形启动关闭
在我尝试多种修复引导的方法之后,我使用U启动软件将windows引导程序强行写入了D盘,导致D盘的CentOS引导覆盖掉了。本文主要解决修复CentOS7引导问题。 写于几天之后: 为了解决上问题我做了如下工作: 1、尝试通过...
Centos开机自启动redis,
centos系统springboot启动、重启、停止shell脚本,centos系统springboot启动、重启、停止shell脚本
CentOS系统安装完毕,长时间不用,很容易忘记root密码,由于系统里已经安装配置了很多的软件,舍不得重新安装,可以参考本文档的方法,偿试破解root密码
开机自启动,脚本
centos7 添加开机界面启动项,在多系统安装时找不到windows 系统时候用