Ubuntu系统开机后停留在Grub状态解决方法

首先看看/boot/grub/grub.cfg和/etc/default/grub 和/etc/grub.d三者之间的关系吧:

(grub.cfg)It is automatically generated by grub-mkconfig using templates from /etc/grub.d and

settings from /etc/default/grub

翻译:grub.cfg是通过grub-mkconfig从grub.d里面的脚本生成的,相应的设置参数在grub里

grub.d里面的脚本实际上是/etc/grub.d/00_header里边的函数make_timeout

make_timeout(){
cat << EOF
if["\${recordfail}" = 1]; then
set timeout = ${GRUB_RECORDFAIL_TIMEOUT:--1}
else
set timeout = ${2}
fi
EOF
}

(1)去看/boot/grub/grub.cfg,才发现,原来啊,这里有个可恶的
if [ "${recordfail}" = 1 ]; then
set timeout=-1
else
set timeout=2
正是被这个-1给害惨啦~

于是武断修改 “-1” 为 “2”

但是通过ls -l grub.cfg可知该文件是只读文件,因此需要添加其可写权限:

chmod a+w grub.cfg

然后,修改相应语句:

if [ "${recordfail}" = 1 ]; then
set timeout=2
else
set timeout=2

记得,修改完毕,保存后,重新修改grub.cfg的权限:

chmod a-w grub.cfg

(2)参考 http://askubuntu.com/questions/178091/how-to-disable-grubs-menu-from-showing-up-after-failed-boot

How to disable Grub's menu from showing up after failed boot


甲:As I had the same problem and figured out the following solution:

  1. Open /etc/default/grub with an editor

  2. Add a line with this assignment: GRUB_RECORDFAIL_TIMEOUT=N

    Set N to the desired timeout in case of a previously failed boot

  3. Update Grub: sudo update-grub

乙:I had a similar issue just with Ubuntu 11.10, the following steps worked for me, maybe give it a try and see if this solves your problem:

  1. Run Gedit as root (gksu gedit).

  2. Open /etc/default/grub and locate the following lines:

    GRUB_HIDDEN_TIMEOUT=0

    GRUB_HIDDEN_TIMEOUT_QUIET=true

  3. Change the values as follows:

    GRUB_HIDDEN_TIMEOUT=10

    GRUB_HIDDEN_TIMEOUT_QUIET=false

  4. Save and run sudo update-grub from your terminal and reboot.

Now GRUB menu should always be shown. Another option is to show GRUB menu only as needed. To do this just hold down the SHIFT button when BIOS load screen appears.

Good luck!


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值