zoukankan      html  css  js  c++  java
  • grub2 设置Windows为默认启动系统

    1. 首先找到Windows的菜单menuentry.
    <blockquote># cat /boot/grub2/grub.cfg | grep Windows

    结果: menuentry 'Windows 7 (loader) (on /dev/sda1)' --class windows --class os {</blockquote>
    2. 设置Windows 作为默认的启动项(这儿只能使用上面命令输出中双引号 " " 或 者单引号 '' 中的内容)。
    <blockquote># grub2-set-default 'Windows 7 (loader) (on /dev/sda1)'
    这里最好是复制上面输出的内容,连同单引号一起复制,不然可能不成功哦~~</blockquote>
    (3). 验证默认启动项
    <blockquote># grub2-editenv list
    输出:saved_entry=Windows 7 (loader) (on /dev/sda1)</blockquote>
    4.写入配置文件中
    <blockquote>grub2-mkconfig -o /boot/grub2/grub.cfg</blockquote>
    &nbsp;
    <blockquote>[sbso@localhost ~]$ cat /boot/grub2/grub.cfg | grep Windows
    menuentry 'Windows 7 (loader) (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-9278835A78833C4B' {

    [sbso@localhost ~]$ sudo grub2-set-default "Windows 7 (loader) (on /dev/sda1)"
    [sbso@localhost ~]$ grub2-editenv list
    saved_entry=Windows 7 (loader) (on /dev/sda1)
    [sbso@localhost ~]$
    [sbso@localhost ~]$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
    Generating grub configuration file ...
    Found linux image: /boot/vmlinuz-4.1.6-201.fc22.x86_64
    Found initrd image: /boot/initramfs-4.1.6-201.fc22.x86_64.img
    Found linux image: /boot/vmlinuz-4.0.4-301.fc22.x86_64
    Found initrd image: /boot/initramfs-4.0.4-301.fc22.x86_64.img
    Found linux image: /boot/vmlinuz-0-rescue-75741f182de6460990f27c895f165f1f
    Found initrd image: /boot/initramfs-0-rescue-75741f182de6460990f27c895f165f1f.img
    Found Windows 7 (loader) on /dev/sda1
    done
    [sbso@localhost ~]$</blockquote>
    &nbsp;

    PS: 如果不成功,可以手动修改 /etc/default/grub 文件,将里面的DEFAULT=0 OR DEFAULT=saved;改为DEFAULT=3 我的windows是3,就可以。

  • 相关阅读:
    竞赛图和哈密顿回路
    Hall 定理
    Vim 和 Gdb 学习笔记
    AT4996 [AGC034F] RNG and XOR(FWT)
    UOJ310 黎明前的巧克力(fwt)
    AT5202 [AGC038E] Gachapon(min-max)
    AT2289 [ARC067D] Yakiniku Restaurants(水题)
    拉格朗日插值
    [CSP-SJX2019]散步(模拟)
    Leetcode547 朋友圈 图的DFS与unionFind算法
  • 原文地址:https://www.cnblogs.com/liweilijie/p/4984592.html
Copyright © 2011-2022 走看看