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

来源:互联网 发布:免费数据接口api平台 编辑:程序博客网 时间:2024/05/16 07:44

首先附上参考文章的链接: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/shexec 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 'gnulinux-simple-2682743d-d1d3-4aa3-92d0-27b133c1de98' {recordfailload_videogfxmode $linux_gfx_modeinsmod gzioinsmod part_msdosinsmod ext2set 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=ahci0,msdos1  1d662acd-259a-462d-85d0-f6c9e6f99fa2else  search --no-floppy --fs-uuid --set=root 1d662acd-259a-462d-85d0-f6c9e6f99fa2filinux/vmlinuz-3.13.0-40-generic root=UUID=2682743d-d1d3-4aa3-92d0-27b133c1de98 ro textinitrd/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=trueGRUB_TIMEOUT=10GRUB_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 0
原创粉丝点击