當前位置: 首頁>>技術教程>>正文


GRUB不檢測Windows

, , , ,

問題描述

我終於在第二個驅動器上安裝了Ubuntu。當我啟動計算機時,GRUB隻提供我啟動Ubuntu,而不是Windows 7.需要做什麽才能在GRUB中選擇Ubuntu和Windows?

當我在啟動時按F12啟動菜單並選擇Windows Boot Manager時,它會啟動到Windows 7。


我運行了命令sudo fdisk -l,這裏是log(http://pastebin.com/Cgv1igHc):

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0xc3ffc3ff

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1  1953525167   976762583+  ee  GPT
Partition 1 does not start on physical sector boundary.

最佳解決辦法

  1. 啟動Ubuntu並掛載Windows分區(隻需在Nautilus上打開磁盤)

  2. 在命令行上運行以下命令(Ctrl + Alt + t):

    sudo os-prober
    
  3. 如果找到了Windows安裝,則可以運行:

    sudo update-grub
    

請注意,第2步隻是為了您的方便。您可以掛載Windows 7分區,然後運行update-grub

相關問題

次佳解決辦法

如果上麵的os-prober方法不起作用,請嘗試添加自定義grub菜單項

記錄here編輯/etc/grub.d/40_custom文件

menuentry "Windows 7" {  
     insmod ntfs  
     set root='(hd0,1)'  
     search --no-floppy --fs-uuid --set a3f1ea41fc67a3f1  
     chainloader +1  
}

你可以通過blkid /dev/sdx命令獲得uuid

第三種解決辦法

我讓Windows 10運行,然後嘗試雙啟動。一旦安裝了Ubuntu,Win 10就不會出現在我的GRUB加載器中。我試過以下 –

First of all, I disabled Secure Boot in Win10. Then ran the below commands in Ubuntu :

sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair && boot-repair

工作得很好。之後能夠在GRUB中找到Windows和Ubuntu。

第四種辦法

我按照Boot-Repair的步驟解決了類似的問題

安裝boot-repair

sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair && boot-repair

按”Recommended repair”並按照建議將一些命令放入終端。

我認為我的Grub由於關機不好而無法識別Windows,它解決了這個問題。

第五種辦法

如果您之前安裝了可能導致問題的RAID。在我的情況下,我在2010年構建了我的桌麵,並且我使用條帶RAID安裝了兩個1.5 TB。 User gracemercy54 mentions here that this is left over metadata from the former RAID configuration.

當我最初嘗試Hermes的步驟時,我收到一條錯誤,指出“RAID集中的設備數量錯誤”。所以,如果你碰巧打開一個終端並運行:

   sudo dmraid -rE
   sudo os-prober
   sudo update-grub

這為我解決了這個問題。

第六種辦法

我在Windows 10中遇到了同樣的問題。我在筆記本電腦上安裝了Linux Mint 18.1 Cinnamon 64-bit,用於WIN10的雙啟動。安裝完成後,GRUB僅提供啟動Linux而不啟動Windows。我發現這個視頻https://www.youtube.com/watch?v=0fCA7ToywoY和這篇文章https://forums.linuxmint.com/viewtopic.php?f=46&t=209082,但不幸的是兩個都不適合我,所以我使用這兩個的組合來解決我的問題。

打開終端並按照這些命令打開名為40_custom的文件:

sudo gedit /etc/grub.d/40_custom

將這些行添加到文件中,然後保存並退出。

menuentry "Windows 10" {

   set root='{hd0,1}'

   chainloader + 1

}

保存文件後,使用以下行更新GRUB:

sudo update-grub

然後重新啟動計算機以查看它是否有效。

希望這也適用於其他人。

參考資料

本文由Ubuntu問答整理, 博文地址: https://ubuntuqa.com/zh-tw/article/2348.html,未經允許,請勿轉載。