ubuntu14.04 设置开机启动到命令行模式

首先附上参考文章的链接: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=""


好的,执行下 sudo update-grub 命令,重启后就能在grub的菜单上看到Ubuntu <cmdline>这个入口了。

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值