您的位置:首页 > 其它

ubuntu更改启动顺序

2016-08-26 11:31 176 查看
在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文件打开文件sudogedit/etc/default/grub修改文件GRUB_DEFAULT=0#更改数字设置默认启动项更新sudoupdate-grub
#Ifyouchangethisfile,run'update-grub'afterwardstoupdate
#/boot/grub/grub.cfg.
#Forfulldocumentationoftheoptionsinthisfile,see:
#info-fgrub-n'Simpleconfiguration'GRUB_DEFAULT=7#更改数字设置默认启动项
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release-i-s2>/dev/null||echoDebian`
GRUB_CMDLINE_LINUX_DEFAULT="quietsplash"
GRUB_CMDLINE_LINUX=""#UncommenttoenableBadRAMfiltering,modifytosuityourneeds
#ThisworkswithLinux(nopatchrequired)andwithanykernelthatobtains
#thememorymapinformationfromGRUB(GNUMach,kernelofFreeBSD...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"#Uncommenttodisablegraphicalterminal(grub-pconly)
#GRUB_TERMINAL=console#Theresolutionusedongraphicalterminal
#notethatyoucanuseonlymodeswhichyourgraphiccardsupportsviaVBE
#youcanseetheminrealGRUBwiththecommand`vbeinfo'
#GRUB_GFXMODE=640x480#Uncommentifyoudon'twantGRUBtopass"root=UUID=xxx"parametertoLinux
#GRUB_DISABLE_LINUX_UUID=true#Uncommenttodisablegenerationofrecoverymodemenuentries
#GRUB_DISABLE_RECOVERY="true"#Uncommenttogetabeepatgrubstart
#GRUB_INIT_TUNE="4804401"
配置文件详解http://lesca.me/archives/manage-grub2-config-file.html
二修改/boot/grub/grub.cfg文件,使用sudoupdate-grub会被覆盖掉。打开文件sudogedit/boot/grub/grub.cfg修改文件setdefault='0'修改数字
#
#DONOTEDITTHISFILE
#
#Itisautomaticallygeneratedbygrub-mkconfigusingtemplates
#from/etc/grub.dandsettingsfrom/etc/default/grub
####BEGIN/etc/grub.d/00_header###
if[-s$prefix/grubenv];then
sethave_grubenv=true
load_env
fi
setdefault="7"#改这个数字设置默认启动项,启动项的特征在下面有标记
if["${prev_saved_entry}"];then
setsaved_entry="${prev_saved_entry}"
save_envsaved_entry
setprev_saved_entry=
save_envprev_saved_entry
setboot_once=true
fifunctionsavedefault{
if[-z"${boot_once}"];then
saved_entry="${chosen}"
save_envsaved_entry
fi
}functionrecordfail{
setrecordfail=1
if[-n"${have_grubenv}"];thenif[-z"${boot_once}"];thensave_envrecordfail;fi;fi
}functionload_video{
insmodvbe
insmodvga
insmodvideo_bochs
insmodvideo_cirrus
}insmodpart_msdos
insmodext2
setroot='(hd0,msdos7)'
search--no-floppy--fs-uuid--set=rootdea69c19-08d2-433a-89b9-f917b6d5cce4
ifloadfont/usr/share/grub/unicode.pf2;then
setgfxmode=auto
load_video
insmodgfxterm
insmodpart_msdos
insmodext2
setroot='(hd0,msdos7)'
search--no-floppy--fs-uuid--set=rootdea69c19-08d2-433a-89b9-f917b6d5cce4
setlocale_dir=($root)/boot/grub/locale
setlang=zh_CN
insmodgettext
fi
terminal_outputgfxterm
if["${recordfail}"=1];then
settimeout=30
else
settimeout=10
fi
###END/etc/grub.d/00_header######BEGIN/etc/grub.d/05_debian_theme###
setmenu_color_normal=white/black
setmenu_color_highlight=black/light-gray
ifbackground_color44,0,30;then
clear
fi
###END/etc/grub.d/05_debian_theme######BEGIN/etc/grub.d/10_linux###
functiongfxmode{
setgfxpayload="${1}"
if["${1}"="keep"];then
setvt_handoff=vt.handoff=7
else
setvt_handoff=
fi
}
if["${recordfail}"!=1];then
if[-e${prefix}/gfxblacklist.txt];then
ifhwmatch${prefix}/gfxblacklist.txt3;then
if[${match}=0];then
setlinux_gfx_mode=keep
else
setlinux_gfx_mode=text
fi
else
setlinux_gfx_mode=text
fi
else
setlinux_gfx_mode=keep
fi
else
setlinux_gfx_mode=text
fi
exportlinux_gfx_mode
if["${linux_gfx_mode}"!="text"];thenload_video;fi
#********************这是一个启动项,启动项0,红色的是启动项名字
101menuentry'Ubuntu,Linux3.2.0-101-generic'--classubuntu--classgnu-linux--classgnu--classos{
102recordfail
103gfxmode$linux_gfx_mode
104insmodgzio
105insmodpart_msdos
106insmodext2
107setroot='(hd0,msdos7)'
108search--no-floppy--fs-uuid--set=rootdea69c19-08d2-433a-89b9-f917b6d5cce4
109linux/boot/vmlinuz-3.2.0-101-genericroot=UUID=dea69c19-08d2-433a-89b9-f917b6d5cce4roquietsplash$vt_handoff
110initrd/boot/initrd.img-3.2.0-101-generic
111}

#********************这是一个启动项,启动项1menuentry'Ubuntu,withLinux3.2.0-101-generic(recoverymode)'--classubuntu--classgnu-linux--classgnu--classos{
recordfail
insmodgzio
insmodpart_msdos
insmodext2
setroot='(hd0,msdos7)'
search--no-floppy--fs-uuid--set=rootdea69c19-08d2-433a-89b9-f917b6d5cce4
echo'载入Linux3.2.0-101-generic...'
linux/boot/vmlinuz-3.2.0-101-genericroot=UUID=dea69c19-08d2-433a-89b9-f917b6d5cce4rorecoverynomodeset
echo'载入初始化内存盘...'
initrd/boot/initrd.img-3.2.0-101-generic
}



#********************这是一个启动项,启动项2

menuentry'Ubuntu,Linux3.19.0-68-generic'--classubuntu--classgnu-linux--classgnu--classos{
recordfail
gfxmode$linux_gfx_mode
insmodgzio
insmodpart_msdos
insmodext2
setroot='(hd0,msdos7)'
search--no-floppy--fs-uuid--set=rootdea69c19-08d2-433a-89b9-f917b6d5cce4
linux/boot/vmlinuz-3.19.0-68-genericroot=UUID=dea69c19-08d2-433a-89b9-f917b6d5cce4roquietsplash$vt_handoff
initrd/boot/initrd.img-3.19.0-68-generic
}后边的代码太多删了
submenu"PreviousLinuxversions"算一个,在启动时选择该项,能选择里面的启动内核
谨慎修改grub
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: