[color=red]Grub文件:[/color]
# more /boot/grub/grub.conf
# 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 (hd0,0)
# kernel /vmlinuz-version ro root=/dev/sda3
# initrd /initrd-version.img
#boot=/dev/sda
default=0 --默认启动系统
timeout=5 --等待时间
splashimage=(hd0,0)/grub/splash.xpm.gz --启动图片,hd0第一块硬盘,0第一个分区, 指定/boot目录所在的分区
Hiddenmenu --隐藏菜单
title CentOS (2.6.18-238.el5) -- 菜单项名称,可改
root (hd0,0) --根设备,grub目录存放目录
kernel /vmlinuz-2.6.18-238.el5 ro root=LABEL=/ rhgb quiet --内核文件设置
initrd /initrd-2.6.18-238.el5.img --镜像文件位置
[color=red]位置:[/color]/boot/grub/grub.conf /etc/grub.conf
[color=red]进入单用户模式:如root密码忘记时,进入单用户模式重新设置root密码[/color]
开机进入grub界面,按e进入编辑行模式,选择kernel行,再次按e键,在新的界面的最后一行加上1(前有空格),按b重新引导即可进入单用户模式
passwd root更改root密码,重启即可
[color=red]Grub命令:[/color]
e:编辑当前的启动菜单项
c:进入grub的命令行方式
b:启动当前的菜单项
d:删除当前行
Esc:返回grub启动界面,取消对当前菜单所作的修改
[color=red]设置grub密码:[/color]
使用grub自带的grub-md5-crypt命令得到密码密文
# grub grub-md5-crypt
Password:
或在grub交互界面中使用md5crypt命令
# grub
Grub>md5crypt
Password:
将得到的密文到grub.conf文件中 放于title前,如
Password --md5 密文
[color=red]Grub配置文件错误,只能进入grub命令模式:[/color]
手工引导,进入系统后修改grub.conf
手工查看grub.conf文件: cat /grub/grub.conf,后面的命令参考其内容
Root (h0,0)
kernel /vmlinuz-2.6.18-238.el5 ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.18-238.el5.img
Boot
[color=red]Inittab文件被修改,不能启动系统:[/color]
通过光盘引导
# more /boot/grub/grub.conf
# 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 (hd0,0)
# kernel /vmlinuz-version ro root=/dev/sda3
# initrd /initrd-version.img
#boot=/dev/sda
default=0 --默认启动系统
timeout=5 --等待时间
splashimage=(hd0,0)/grub/splash.xpm.gz --启动图片,hd0第一块硬盘,0第一个分区, 指定/boot目录所在的分区
Hiddenmenu --隐藏菜单
title CentOS (2.6.18-238.el5) -- 菜单项名称,可改
root (hd0,0) --根设备,grub目录存放目录
kernel /vmlinuz-2.6.18-238.el5 ro root=LABEL=/ rhgb quiet --内核文件设置
initrd /initrd-2.6.18-238.el5.img --镜像文件位置
[color=red]位置:[/color]/boot/grub/grub.conf /etc/grub.conf
[color=red]进入单用户模式:如root密码忘记时,进入单用户模式重新设置root密码[/color]
开机进入grub界面,按e进入编辑行模式,选择kernel行,再次按e键,在新的界面的最后一行加上1(前有空格),按b重新引导即可进入单用户模式
passwd root更改root密码,重启即可
[color=red]Grub命令:[/color]
e:编辑当前的启动菜单项
c:进入grub的命令行方式
b:启动当前的菜单项
d:删除当前行
Esc:返回grub启动界面,取消对当前菜单所作的修改
[color=red]设置grub密码:[/color]
使用grub自带的grub-md5-crypt命令得到密码密文
# grub grub-md5-crypt
Password:
或在grub交互界面中使用md5crypt命令
# grub
Grub>md5crypt
Password:
将得到的密文到grub.conf文件中 放于title前,如
Password --md5 密文
[color=red]Grub配置文件错误,只能进入grub命令模式:[/color]
手工引导,进入系统后修改grub.conf
手工查看grub.conf文件: cat /grub/grub.conf,后面的命令参考其内容
Root (h0,0)
kernel /vmlinuz-2.6.18-238.el5 ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.18-238.el5.img
Boot
[color=red]Inittab文件被修改,不能启动系统:[/color]
通过光盘引导