ubuntu更改启动顺序
在ubuntu中修改启动配置。
启动相关grub2主要包含下面三个文件:1. /boot/grub/grub.cfg 文件 2. /etc/grub.d/ 文件夹 3. /etc/default/grub 文件,可以通过修改这三个文件来修改启动项
链接:http://blog.csdn.net/zhu_liangwei/article/details/7847034
一
更改启动顺序,验证过的两种方式
1、修改 /etc/default/grub 文件
打开文件
sudo gedit /etc/default/grub
修改文件
GRUB_DEFAULT=0 #更改数字设置默认启动项
更新
sudo update-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=7 #更改数字设置默认启动项
#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="" # 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
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480 # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true # Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true" # Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
配置文件详解 http://lesca.me/archives/manage-grub2-config-file.html

二
修改 /boot/grub/grub.cfg文件,使用sudo update-grub会被覆盖掉。
打开文件
sudo gedit /boot/grub/grub.cfg
修改文件
set default = '0' 修改数字
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
# ### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
set have_grubenv=true
load_env
fi
set default="" #改这个数字设置默认启动项,启动项的特征在下面有标记
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
} function recordfail {
set recordfail=1
if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
} function load_video {
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
} insmod part_msdos
insmod ext2
set root='(hd0,msdos7)'
search --no-floppy --fs-uuid --set=root dea69c19-08d2-433a-89b9-f917b6d5cce4
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=auto
load_video
insmod gfxterm
insmod part_msdos
insmod ext2
set root='(hd0,msdos7)'
search --no-floppy --fs-uuid --set=root dea69c19-08d2-433a-89b9-f917b6d5cce4
set locale_dir=($root)/boot/grub/locale
set lang=zh_CN
insmod gettext
fi
terminal_output gfxterm
if [ "${recordfail}" = 1 ] ; then
set timeout=30
else
set timeout=10
fi
### END /etc/grub.d/00_header ### ### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
if background_color 44,0,30; then
clear
fi
### END /etc/grub.d/05_debian_theme ### ### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
set gfxpayload="${1}"
if [ "${1}" = "keep" ]; then
set vt_handoff=vt.handoff=7
else
set vt_handoff=
fi
}
if [ "${recordfail}" != 1 ]; then
if [ -e ${prefix}/gfxblacklist.txt ]; then
if hwmatch ${prefix}/gfxblacklist.txt 3; then
if [ ${match} = 0 ]; then
set linux_gfx_mode=keep
else
set linux_gfx_mode=text
fi
else
set linux_gfx_mode=text
fi
else
set linux_gfx_mode=keep
fi
else
set linux_gfx_mode=text
fi
export linux_gfx_mode
if [ "${linux_gfx_mode}" != "text" ]; then load_video; fi
#********************这是一个启动项,启动项0,红色的是启动项名字
101 menuentry 'Ubuntu,Linux 3.2.0-101-generic' --class ubuntu --class gnu-linux --class gnu --class os {
102 recordfail
103 gfxmode $linux_gfx_mode
104 insmod gzio
105 insmod part_msdos
106 insmod ext2
107 set root='(hd0,msdos7)'
108 search --no-floppy --fs-uuid --set=root dea69c19-08d2-433a-89b9-f917b6d5cce4
109 linux /boot/vmlinuz-3.2.0-101-generic root=UUID=dea69c19-08d2-433a-89b9-f917b6d5cce4 ro quiet splash $vt_handoff
110 initrd /boot/initrd.img-3.2.0-101-generic
111 }
#********************这是一个启动项,启动项1
menuentry 'Ubuntu, with Linux 3.2.0-101-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos7)'
search --no-floppy --fs-uuid --set=root dea69c19-08d2-433a-89b9-f917b6d5cce4
echo '载入 Linux 3.2.0-101-generic ...'
linux /boot/vmlinuz-3.2.0-101-generic root=UUID=dea69c19-08d2-433a-89b9-f917b6d5cce4 ro recovery nomodeset
echo '载入初始化内存盘...'
initrd /boot/initrd.img-3.2.0-101-generic
}
#********************这是一个启动项,启动项2
menuentry 'Ubuntu,Linux 3.19.0-68-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
gfxmode $linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos7)'
search --no-floppy --fs-uuid --set=root dea69c19-08d2-433a-89b9-f917b6d5cce4
linux /boot/vmlinuz-3.19.0-68-generic root=UUID=dea69c19-08d2-433a-89b9-f917b6d5cce4 ro quiet splash $vt_handoff
initrd /boot/initrd.img-3.19.0-68-generic
}
后边的代码太多删了
submenu "Previous Linux versions" 算一个,在启动时选择该项,能选择里面的启动内核
谨慎修改grub
ubuntu更改启动顺序的更多相关文章
- Ubuntu更改启动内存
参考:https://superuser.com/questions/152921/how-to-boot-with-mem-1024m-argument-using-grub-ubuntu-10-0 ...
- 更改ubuntu多系统启动顺序
电脑上双系统,启动时界面如下 ubuntu advance ubuntu option windows 在/boot/grub/grub.cfg中,查看到可以简单的修改/etc/defaulg/gru ...
- Linux之Ubuntu与Windows更改默认启动顺序[转载]
装双系统后,经常会遇到与Windows更改默认启动顺序的需要,这样有助于开机时可以避免手动选择经常使用的系统了. 当然这解决办法不是博主的主意,本文纯属抄録者,故文章题目也声明了是转载,解决方案如下叙 ...
- [CrunchBang]修改win+ubuntu 双 系统菜单的 启动顺序 引导
说到启动就不得不说GRUB,Linux下大名鼎鼎的启动管理工具(曾经的LILO已经风光不再),当然现在已经是GRUB2了,GRUB2和GRUB最重要的区别就是,GRUB存放系统启动信息的文件为/boo ...
- 更改win10和mint双系统默认启动顺序
更改win7 & Linuxmint双系统安装后更改默认启动顺序 1.打开一个term,编辑/etc/default/grub,即sudo nano /etc/default/grub,把se ...
- linux init 启动顺序
redhat init大致启动过程 第一个运行的程序是/sbin/init,该文件会读取/etc/inittab文件,并依据此文件来进行初始化工作.比如在设定了运行等级 “:id:3:initdefa ...
- (转)Ubuntu init启动流程分析
原文 upstart homepage 现行的Linux distros主流的有两种init方式:一种是广为流传的System V initialization,它来源于Unix并且至今仍被各种Lin ...
- ubuntu为什么没有/etc/inittab文件? 深究ubuntu的启动流程分析
Linux 内核启动 init ,init进程ID是1,是所有进程的父进程,所有进程由它控制. Ubuntu 的启动由upstart控制,自9.10后不再使用/etc/event.d目录的配置文件,改 ...
- Ubuntu 16.04设置rc.local开机启动命令/脚本的方法(通过update-rc.d管理Ubuntu开机启动程序/服务)
注意:rc.local脚本里面启动的用户默认为root权限. 一.rc.local脚本 rc.local脚本是一个Ubuntu开机后会自动执行的脚本,我们可以在该脚本内添加命令行指令.该脚本位于/et ...
随机推荐
- 【24】response对象以及Python3中的一些变化
request.COOKIES 用来获取cookie response.write() 写的方法是response对象的 转自:博客园python3的变化 print 由一个语句(st ...
- Docker介绍及优缺点对比分析
1.什么是Docker Docker最初是dotCloud公司创始人Solomon Hykes在法国期间发起的一个公司内部项目,于2013年3月以Apache 2.0授权协议开源,主要项目代码在Git ...
- Python3.6全栈开发实例[019]
19.干掉主播.现有如下主播收益信息, 按照要求, 完成相应操作:(1)计算主播平均收益值 sum = 0 for i in zhubo.values(): sum +=i print(round(s ...
- (转)js获取内网ip地址,操作系统,浏览器版本等信息
这次呢,说一下使用js获取用户电脑的ip信息,刚开始只是想获取用户ip,后来就顺带着获取了操作系统和浏览器信息. 先说下获取用户ip地址,包括像ipv4,ipv6,掩码等内容,但是大部分都要根据浏览器 ...
- 算法题14 小Q歌单,牛客网,腾讯笔试题
算法题14 小Q歌单,牛客网,腾讯笔试题 题目: 小Q有X首长度为A的不同的歌和Y首长度为B的不同的歌,现在小Q想用这些歌组成一个总长度正好为K的歌单,每首歌最多只能在歌单中出现一次,在不考虑歌单内歌 ...
- C#如何打印RichTextBox控件的内容
本任务的内容 摘要 创建 RichTextBoxPrintCtrl 控件 测试控件 参考 概要 本分步指南介绍了如何打印 RichTextBox 控件的内容.RichTextBox 控件没有提供任 ...
- linux环境变量 【转】
Linux 的变量可分为两类:环境变量和本地变量 环境变量,或者称为全局变量,存在与所有的shell 中,在你登陆系统的时候就已经有了相应的系统定义的环境变量了.Linux 的环境变量具有继承性,即子 ...
- 【HackerRank】Bus Station
有n组好朋友在公交车站前排队.第i组有ai个人.还有一辆公交车在路线上行驶.公交车的容量大小为x,即它可以同时运载x个人. 当车站来车时(车总是空载过来),一些组从会队头开始走向公交车. 当然,同一组 ...
- PHP字符串函数大全
无论哪种编程语言,字符串操作都是一个重要的基础,往往简单而重要.PHP为我们提供了大量的字符串操作函数,功能强大,使用也比较简单.在这里结合实例总结分析PHP字符串函数的功能. 1.addcslash ...
- linux下安装编译网卡驱动的方法
安装linux操作系统后发现没有网卡驱动,表现为 system → Administration → Network下Hardware列表为空. 以下为安装编译网卡驱动的过程,本人是菜鸟,以下是我从网 ...