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!


你可能感兴趣的:(Ubuntu系统开机后停留在Grub状态解决方法)