首先附上参考文章的链接:http://blog.csdn.net/odaynot/article/details/7667251
这里只说一下第二种方法。
按照上面提到的参考文章的步骤来做,修改grub.cfg文件后再执行update-grub命令后会把修改过的内容清掉。
注意到grub.cfg文件中有如下注释:
### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###
于是cd到/etc/grub.d/执行sudo gedit 40_custom
再按照参考文章中的做法,复制一个menuentry 到40_custom文件中,如下:
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry 'Ubuntu <cmdline>' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulin
ux-simple-2682743d-d1d3-4aa3-92d0-27b133c1de98' {
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=a
hci0,msdos1 1d662acd-259a-462d-85d0-f6c9e6f99fa2
else
search --no-floppy --fs-uuid --set=root 1d662acd-259a-462d-85d0-f6c9e6f99fa2
fi
linux /vmlinuz-3.13.0-40-generic root=UUID=2682743d-d1d3-4aa3-92d0-27b133c1de98 ro text
initrd /initrd.img-3.13.0-40-generic
}
保存40_custom 文件。下面修改一下/etc/default/grub文件
注释掉GRUB_HIDDEN_TIMEOUT 和 GRUB_HIDDEN_TIMEOUT_QUIET,同时将GRUB_TIMEOUT的值设为非0值。
例如:
# 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=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""