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

   2023-02-09 学习力0
核心提示:首先贴出Fedora25下/boot/grub2/grub.cfg的内容:1 #2 # DO NOT EDIT THIS FILE3 #4 # It is automatically generated by grub2-mkconfig using templates5 # from /etc/grub.d and settings from /etc/default/grub6 #7 8 ### BEGIN /etc/grub.d/00_header #

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

  1 #
  2 # DO NOT EDIT THIS FILE
  3 #
  4 # It is automatically generated by grub2-mkconfig using templates
  5 # from /etc/grub.d and settings from /etc/default/grub
  6 #
  7 
  8 ### BEGIN /etc/grub.d/00_header ###
  9 set pager=1
 10 
 11 if [ -s $prefix/grubenv ]; then
 12   load_env
 13 fi
 14 if [ "${next_entry}" ] ; then
 15    set default="${next_entry}"
 16    set next_entry=
 17    save_env next_entry
 18    set boot_once=true
 19 else
 20    set default="${saved_entry}"
 21 fi
 22 
 23 if [ x"${feature_menuentry_id}" = xy ]; then
 24   menuentry_id_option="--id"
 25 else
 26   menuentry_id_option=""
 27 fi
 28 
 29 export menuentry_id_option
 30 
 31 if [ "${prev_saved_entry}" ]; then
 32   set saved_entry="${prev_saved_entry}"
 33   save_env saved_entry
 34   set prev_saved_entry=
 35   save_env prev_saved_entry
 36   set boot_once=true
 37 fi
 38 
 39 function savedefault {
 40   if [ -z "${boot_once}" ]; then
 41     saved_entry="${chosen}"
 42     save_env saved_entry
 43   fi
 44 }
 45 
 46 function load_video {
 47   if [ x$feature_all_video_module = xy ]; then
 48     insmod all_video
 49   else
 50     insmod efi_gop
 51     insmod efi_uga
 52     insmod ieee1275_fb
 53     insmod vbe
 54     insmod vga
 55     insmod video_bochs
 56     insmod video_cirrus
 57   fi
 58 }
 59 
 60 terminal_output console
 61 if [ x$feature_timeout_style = xy ] ; then
 62   set timeout_style=menu
 63   set timeout=5
 64 # Fallback normal timeout code in case the timeout_style feature is
 65 # unavailable.
 66 else
 67   set timeout=5
 68 fi
 69 ### END /etc/grub.d/00_header ###
 70 
 71 ### BEGIN /etc/grub.d/01_users ###
 72 if [ -f ${prefix}/user.cfg ]; then
 73   source ${prefix}/user.cfg
 74   if [ -n "${GRUB2_PASSWORD}" ]; then
 75     set superusers="root"
 76     export superusers
 77     password_pbkdf2 root ${GRUB2_PASSWORD}
 78   fi
 79 fi
 80 ### END /etc/grub.d/01_users ###
 81 
 82 ### BEGIN /etc/grub.d/10_linux ###
 83 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' {
 84     load_video
 85     set gfxpayload=keep
 86     insmod gzio
 87     insmod part_msdos
 88     insmod ext2
 89     set root='hd0,msdos6'
 90     if [ x$feature_platform_search_hint = xy ]; then
 91       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
 92     else
 93       search --no-floppy --fs-uuid --set=root 3732e5b3-67be-4efa-a64e-08e51d341084
 94     fi
 95     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
 96     initrd16 /boot/initramfs-4.8.8-300.fc25.x86_64.img
 97 }
 98 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' {
 99     load_video
100     set gfxpayload=keep
101     insmod gzio
102     insmod part_msdos
103     insmod ext2
104     set root='hd0,msdos6'
105     if [ x$feature_platform_search_hint = xy ]; then
106       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
107     else
108       search --no-floppy --fs-uuid --set=root 3732e5b3-67be-4efa-a64e-08e51d341084
109     fi
110     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
111     initrd16 /boot/initramfs-4.8.6-300.fc25.x86_64.img
112 }
113 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' {
114     load_video
115     insmod gzio
116     insmod part_msdos
117     insmod ext2
118     set root='hd0,msdos6'
119     if [ x$feature_platform_search_hint = xy ]; then
120       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
121     else
122       search --no-floppy --fs-uuid --set=root 3732e5b3-67be-4efa-a64e-08e51d341084
123     fi
124     linux16 /boot/vmlinuz-0-rescue-0c394733687b44ac9de7038631d76a55 root=UUID=3732e5b3-67be-4efa-a64e-08e51d341084 ro rhgb quiet
125     initrd16 /boot/initramfs-0-rescue-0c394733687b44ac9de7038631d76a55.img
126 }
127 
128 ### END /etc/grub.d/10_linux ###
129 
130 ### BEGIN /etc/grub.d/20_linux_xen ###
131 
132 ### END /etc/grub.d/20_linux_xen ###
133 
134 ### BEGIN /etc/grub.d/20_ppc_terminfo ###
135 ### END /etc/grub.d/20_ppc_terminfo ###
136 
137 ### BEGIN /etc/grub.d/30_os-prober ###
138 menuentry 'Windows 10 Enterprise (loader) (on /dev/sdb1)' --class windows --class os $menuentry_id_option 'osprober-chain-10FF15F410FF15F4' {
139     insmod part_msdos
140     insmod ntfs
141     set root='hd1,msdos1'
142     if [ x$feature_platform_search_hint = xy ]; then
143       search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1  10FF15F410FF15F4
144     else
145       search --no-floppy --fs-uuid --set=root 10FF15F410FF15F4
146     fi
147     parttool ${root} hidden-
148     drivemap -s (hd0) ${root}
149     chainloader +1
150 }
151 
152 ### BEGIN /etc/grub.d/40_custom ###
153 # This file provides an easy way to add custom menu entries.  Simply type the
154 # menu entries you want to add after this comment.  Be careful not to change
155 # the 'exec tail' line above.
156 ### END /etc/grub.d/40_custom ###
157 
158 ### BEGIN /etc/grub.d/41_custom ###
159 if [ -f  ${config_directory}/custom.cfg ]; then
160   source ${config_directory}/custom.cfg
161 elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
162   source $prefix/custom.cfg;
163 fi
164 ### END /etc/grub.d/41_custom ### 

显然,其中没有找到传说中的

1 # boot=/dev/sda
2 default=0
3 timeout=5

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

1 # 首先找到windows的menuentry
2 cat /boot/grub2/grub.cfg | grep windows   
3 # 然后设置windows作为默认的启动项
4 grub2-set-default "Windows *** " 
5 # 用第一步得到的结果执行第2步
6 # 验证默认的启动项
7 grub2-editenv list

修改前后使用第三条命令的结果也同样贴出:

1 saved_entry=Fedora (4.8.8-300.fc25.x86_64) 25 (Twenty Five)
2 saved_entry=Windows 10 Enterprise (loader) (on /dev/sdb1)

这样就可以在Fedora25中修改了grub启动配置文件,下一次电脑启动时Win10将会出现在第一条,即默认启动系统。

 

 
反对 0举报 0 评论 0
 

免责声明:本文仅代表作者个人观点,与乐学笔记(本网)无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
    本网站有部分内容均转载自其它媒体,转载目的在于传递更多信息,并不代表本网赞同其观点和对其真实性负责,若因作品内容、知识产权、版权和其他问题,请及时提供相关证明等材料并与我们留言联系,本网站将在规定时间内给予删除等相关处理.

  • [转]Fedora 15 安装与配置一览
    Fedora 15 将于2011.5.24日发布,今日离正式版发布还有4天。笨兔兔这里提前给大家支招用好Fedora 15。下面是笨兔兔在安装、配置Fedora 15 过程中的小结,希望给大家配置自己的Fedora 15 带来方便。仅供参考,如有错误,敬请指出。『一』安装介绍Fedora 15 Bet
    03-08
  • 新换的 Fedora Core Linux 桌面,来秀一秀(多
    1、桌面、终端、文件浏览器,已经设置好字体、自动挂载硬盘,不是很麻烦2、即时通讯:QQ,Skype3、firefox4、D4X、BT、电驴5、开发工具:eclipse netbeans6、openoffice 大开 word 公式文档,输出 PDF7、小企鹅输入法,支持微软双拼8、星际译王,linux 下免费
    02-10
  • Fedora 14添加RPM Fusion源
    RPM Fusion 是 Fedora 和 Red Hat 企业版的软件仓库,是由Dribble, Freshrpms 和 RPM Fusion 合并而来的。各种各样的应用程序包含在这个软件仓库中,比如MP3、未加密的DVD 、Mplayer, VLX, Xine 等多媒体应用程序使用的解码库,以及闭源的 Nvidia 和 ATI 显卡
    02-10
  • Fedora中安装VMtools步骤 vmware虚拟机安装fedo
      第一次玩Fedora的系统,通过VMware工具安装的一个虚拟机,由于公司要求尽可能的留有足够空间,所以安装的时候就没选开发环境选项。安装成功后,又要准备安装VMware--tools工具,在此记录安装的过程,以及安装过程中遇到的一些问题。一、准备工作  确保
    02-10
  • Fedora 23 配置
    刻到u盘上下好iso后准备刻录到u盘...可是查了一下只能在用一个叫dd的东西刻= =于是学了下...然而就是一句话:dd if=/path/xxx.iso of=/dev/sdx其中前面是文件,后面是盘,注意是整个盘sdx而不是什么sdx1啥的,注意这样做会格式化整个盘...请不要乱实验...。(
    02-10
  • Fedora 9安装说明 Fedor
     Fedora 9 安装手册◆准备工作硬件       硬盘空间:5G以上;       内存容量:384 M以上(256M也可以,但在分区后会提示您启用swap分区);       光盘介质:Fedora 9 安装光盘(1张DVD);设置BIOS为从光盘引导;启动计算机,将安装盘的
    02-10
  • fedora linux源代码下载
    fedora linux源代码下载
    yumdownloader --source kernel如果是下载insight就是 yumdownloader --source insight下载到的是当前目录.然后在用rpm2cpio 生成 压缩文件rpm2cpio insight-7.4.50-8.20120403cvs.fc17.src.rpm|cpio -idrpm2cpio 的使用 在 http://www.rpm.org/max-rpm/s1-rp
    02-10
  • Fedora 7系统安装配置心得(转)(有图哦)
    Fedora 7系统安装配置心得(转)(有图哦)
    计算机基本配置如下: CPU:Intel Core 2 Duo E4300 显卡:NVidia GeForce 7600GS 主板:ABit IB9(P965+ICH8) 内存2G/硬盘160G 安装时选择用户定制,加上开发环境,以防止编译时找不到相关的模块. 系统内核为默认的2.6.21-1.3194.fc7. 以下配置基于Gnome环境. 来
    02-10
  • fedora27安装DB2 Express-C 11
    首先在官网下载对应的安装包和语言包两个文件。然后通过tar -zxvf命令将下载的两个文件解压。其中一个文件解压后是名为expc的文件,进入这个文件。里面有一个名为db2setup的文件。在命令行下首先通过命令su切换到超级用户,然后通过./db2setup进入图形化界面
    02-10
  • Red Hat Linux、rhel 和 Fedora Core 以及 Cent
    Red Hat Linux、rhel 和 Fedora Core 以及 Centos 区别与联系1. Red Hat LinuxLinux是GNU/Linux的缩写,通常指各种Linux发行版的通称,Red Hat Linux是redhat最早发行的个人版本的linux, 其1。0版本于1994年11月3日发行。虽然其历史不及其它linux发行
    02-10
点击排行