ubuntu跳过grub界面

用virtualbox在Windows下面使用ubuntu虚拟机,然后使用设置virtualbox后台运行 的方法来使ubuntu在后台运行,但是有时候非正常关机然后开机的话就会卡在grub系统选择界面不动.然后就一直进不了系统.好烦,下面贴出我的解决办法

 
终端运行

sudo gedit /etc/default/grub

然后修改成我的文件的样子

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX=""

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE

还有一个地方要改。终端执行:

sudo gedit /etc/grub.d/30_os-prober

修改那三个timeout成我的样子

    if [ "x${1}" != "x" ] ; then
      if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
        verbose=
      else
        verbose=" --verbose"
      fi

      if [ "x${1}" = "x0" ] ; then
        cat <<EOF
if [ "x${timeout}" != "x-1" ]; then
  if keystatus; then
    if keystatus --shift; then
      set timeout=0
    else
      set timeout=0
    fi
  else
    if sleep$verbose --interruptible 3 ; then
      set timeout=0
    fi
  fi
fi

然后在执行

sudo update-grub

就ok了!

ubuntu跳过grub界面》上有1条评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注