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=6eaff320-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下修改。
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值