1. 程式人生 > >CentOs 7 下修改 Windows 預設啟動順序

CentOs 7 下修改 Windows 預設啟動順序

#修復引導win 10(或Windows 7等):
1、增加windows啟動 選單
root許可權執行:
$ sudo vim /etc/grub.d/40_custom
得到開啟檔案後並編輯

#!/bin/sh
exec tail -n +3 $0
# 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``

menuentry 'Windows 10'{
set root=(hd0,1)
chainloader +1
}
~
~

按Esc,在按ZZ(或者Shift+:並輸入wq),儲存編輯並退出。
括號內的hd0為第一啟動順序硬碟 。如果是第二塊硬碟則為hd1…
括號內的1為第一分割槽。如果是第二分割槽則為 2…
例子:如果第二塊硬碟的第二分割槽 (hd1,2)
#插入一條啊
vim /etc/default/grub
GRUB_TIMEOUT=35 預設5秒,插入一個3,改成35秒,這樣有時間選擇
2、root執行:
grub2−mkconfig −o /boot/grub2/grub.cfg生成grub.cfg檔案。
執行: reboot
重啟既可以看到為windows 10的引導了。
3.檢視有那些選單項
cat /boot/grub2/grub.cfg | grep menuentry

if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="–id"
menuentry_id_option=""
export menuentry_id_option


menuentry “Windows 10”
這裡的值也許是’Windows Boot Manager …
反正就是它了

4.
root執行將需要的選項設為預設值
grub2-set-default "Windows 10"
執行
grub2-editenv list 檢視結果

saved_entry=Windows 10

好了哦。
學習的記錄,,,