设为首页 收藏本站
查看: 1001|回复: 0

[经验分享] 修改Fedora 25与Windows 10的默认启动顺序

[复制链接]

尚未签到

发表于 2017-6-28 14:22:07 | 显示全部楼层 |阅读模式
  首先贴出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将会出现在第一条,即默认启动系统。

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-389030-1-1.html 上篇帖子: Windows Server 2008 R2 服务器系统安装及配置全过程图文详解 下篇帖子: 无法从命令行或调试器启动服务,必须首先安装Windows服务(使用installutil.exe),然后用ServerExplorer、Windows服务器管理
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表