grub2 設置Windows爲默認啓動系統

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

結果: 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' {windows

[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;it

PS: 若是不成功,能夠手動修改 /etc/default/grub 文件,將裏面的DEFAULT=0 OR DEFAULT=saved;改成DEFAULT=3 個人windows是3,就能夠。io

相關文章
相關標籤/搜索