windows和linux双系统修改启动项顺序

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

?windows和linux双系统修改启动项顺序

在windows下安装ubuntu双系统,启动时默认选择ubuntu,至少有三种方法可以修改启动顺序。

1. 修改/boot/grub/grub.cfg

sudo vim /boot/grub/grub.cfg (如果对vim不太熟悉,可以试试sudo gedit /etc/default/grub)

有如下内容

#
# 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="0"
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

...

menuentry 'Ubuntu,Linux 3.0.0-28-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
set gfxpayload=$linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos8)'
search --no-floppy --fs-uuid --set=root 6eaff320-f96f-4e63-91d3-9b45bb387d1d
linux /boot/vmlinuz-3.0.0-28-generic root=UUID=6eaff320-f96f-4e63-91d3-9b45bb387d1d ro quiet splash vt.handoff=7
initrd /boot/initrd.img-3.0.0-28-generic
}

...

我们修改的是set default="0"。在开机画面中有启动项列表,如

Ubuntu,Linux 3.0.0-28-generic

Ubuntu,Linux 3.0.0-28-generic (恢复模式)

Previous Linux versions

Memory test (memtest86+)

Memory test (memtest86+, serial console 115200)

Windows 7 (loader) (on /dev/sda1)

从0计数,windows是5,所以修改为set default="5". 保存退出,其它任何东西都不要修改。下次启动就默认windows。

注:windows一般是第5个,如果你用了很久的ubuntu,会有内核更新,一般会形成上面的启动列表。




2. 仍然修改/boot/grub/grub.cfg。

第一个方法修改的是默认序号,类似的,我们可以把windows移到第0个位置。具体的就是把

menuentry "Windows 7 (loader) (on /dev/sda1)" --class windows --class os {
insmod part_msdos
insmod ntfs
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root A2DE6972DE693FA1
chainloader +1
}

剪切到第一个menuentry之前,即

if [ "$linux_gfx_mode" != "text" ]; then load_video; fi

menuentry "Windows 7 (loader) (on /dev/sda1)" --class windows --class os {
insmod part_msdos
insmod ntfs
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root A2DE6972DE693FA1
chainloader +1
}
menuentry 'Ubuntu,Linux 3.0.0-28-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
set gfxpayload=$linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos8)'
search --no-floppy --fs-uuid --set=root 6eaff320-f96f-4e63-91d3-9b45bb387d1d
linux /boot/vmlinuz-3.0.0-28-generic root=UUID=6ea

ff320-f96f-4e63-91d3-9b45bb387d1d ro quiet splash vt.handoff=7
initrd /boot/initrd.img-3.0.0-28-generic
}

保存退出。

注:不要剪切错了,错了的话我也不知道会有什么后果,可能没事。




3. 修改/etc/default/grub, 然后update-grub。

sudo vim /etc/default/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=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=""

将GRUB_DEFAULT=0改成GRUB_DEFAULT=5, 保存退出然后运行sudo update-grub。


注:1) 前两种方法只是暂时的,如果更新内核就会还原回去,从注释中我们也看到,不要我们修改grub.cfg文件

2) 第三种方法比较好,修改了默认启动项,之后即使更新内核,也会默认从5启动;

3) 这里的方法是对GRUB2而言,从ubuntu11.04开始,GRUB升级,不在使用原先的/boot/grub/menu.lst,老版本修改可以查询网络更多内容。

4)以上都是在ubuntu下修改,前提是你安装的是纯正的双系统,而不是wubi,如果是后者,需要到windows下修改。














相关文档
最新文档