修改Fedora 25与Windows 10的默认启动顺序

首先贴出Fedora25下/boot/grub2/grub.cfg的内容:

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
set pager=1

if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="${saved_entry}"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

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 load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

terminal_output console
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/01_users ###
if [ -f ${prefix}/user.cfg ]; then
  source ${prefix}/user.cfg
  if [ -n "${GRUB2_PASSWORD}" ]; then
    set superusers="root"
    export superusers
    password_pbkdf2 root ${GRUB2_PASSWORD}
  fi
fi
### END /etc/grub.d/01_users ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Fedora (4.8.8-300.fc25.x86_64) 25 (Twenty Five)' --class fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-4.8.6-300.fc25.x86_64-advanced-3732e5b3-67be-4efa-a64e-08e51d341084' {
    load_video
    set gfxpayload=keep
    insmod gzio
    insmod part_msdos
    insmod ext2
    set root='hd0,msdos6'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6 --hint='hd0,msdos6'  3732e5b3-67be-4efa-a64e-08e51d341084
    else
      search --no-floppy --fs-uuid --set=root 3732e5b3-67be-4efa-a64e-08e51d341084
    fi
    linux16 /boot/vmlinuz-4.8.8-300.fc25.x86_64 root=UUID=3732e5b3-67be-4efa-a64e-08e51d341084 ro rhgb quiet LANG=zh_CN.UTF-8
    initrd16 /boot/initramfs-4.8.8-300.fc25.x86_64.img
}
menuentry 'Fedora (4.8.6-300.fc25.x86_64) 25 (Twenty Five)' --class fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-4.8.6-300.fc25.x86_64-advanced-3732e5b3-67be-4efa-a64e-08e51d341084' {
    load_video
    set gfxpayload=keep
    insmod gzio
    insmod part_msdos
    insmod ext2
    set root='hd0,msdos6'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6 --hint='hd0,msdos6'  3732e5b3-67be-4efa-a64e-08e51d341084
    else
      search --no-floppy --fs-uuid --set=root 3732e5b3-67be-4efa-a64e-08e51d341084
    fi
    linux16 /boot/vmlinuz-4.8.6-300.fc25.x86_64 root=UUID=3732e5b3-67be-4efa-a64e-08e51d341084 ro rhgb quiet LANG=zh_CN.UTF-8
    initrd16 /boot/initramfs-4.8.6-300.fc25.x86_64.img
}
menuentry 'Fedora (0-rescue-0c394733687b44ac9de7038631d76a55) 25 (Twenty Five)' --class fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-0c394733687b44ac9de7038631d76a55-advanced-3732e5b3-67be-4efa-a64e-08e51d341084' {
    load_video
    insmod gzio
    insmod part_msdos
    insmod ext2
    set root='hd0,msdos6'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6 --hint='hd0,msdos6'  3732e5b3-67be-4efa-a64e-08e51d341084
    else
      search --no-floppy --fs-uuid --set=root 3732e5b3-67be-4efa-a64e-08e51d341084
    fi
    linux16 /boot/vmlinuz-0-rescue-0c394733687b44ac9de7038631d76a55 root=UUID=3732e5b3-67be-4efa-a64e-08e51d341084 ro rhgb quiet
    initrd16 /boot/initramfs-0-rescue-0c394733687b44ac9de7038631d76a55.img
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###

### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_ppc_terminfo ###
### END /etc/grub.d/20_ppc_terminfo ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows 10 Enterprise (loader) (on /dev/sdb1)' --class windows --class os $menuentry_id_option 'osprober-chain-10FF15F410FF15F4' {
    insmod part_msdos
    insmod ntfs
    set root='hd1,msdos1'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1  10FF15F410FF15F4
    else
      search --no-floppy --fs-uuid --set=root 10FF15F410FF15F4
    fi
    parttool ${root} hidden-
    drivemap -s (hd0) ${root}
    chainloader +1
}

### 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 ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
显然,其中没有找到传说中的

# boot=/dev/sda
default=0
timeout=5

所以无法通过修改grub.cfg来调整系统的默认启动顺序。不过无意中,发现可以用三条命令解决这个问题,具体代码如下:

# 首先找到windows的menuentry
cat /boot/grub2/grub.cfg | grep windows   
# 然后设置windows作为默认的启动项
grub2-set-default "Windows *** " 
# 用第一步得到的结果执行第2步
# 验证默认的启动项
grub2-editenv list
修改前后使用第三条命令的结果也同样贴出:

saved_entry=Fedora (4.8.8-300.fc25.x86_64) 25 (Twenty Five)
saved_entry=Windows 10 Enterprise (loader) (on /dev/sdb1)
这样就可以在Fedora25中修改了grub启动配置文件,下一次电脑启动时Win10将会出现在第一条,即默认启动系统。

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值