GRUB does not detect Windows

439,133

Solution 1

  1. Boot Ubuntu and mount your Windows partition (simply open the disk on Nautilus)

  2. Run the following on the command line (Ctrl+Alt+t):

    sudo os-prober
    
  3. If your Windows installation was found, you can run:

    sudo update-grub
    

Note that step 2 is just for your convenience. You could just mount the Windows 7 partition and then run update-grub.

Related question

Solution 2

If the os-prober method above doesn't work try adding a custom grub menu entry. Documented here.

First two steps are for finding your <UUID>.

  1. Run lsblk and find the name of the row with /boot/efi

Example output (here the answer is sda2):

lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0   477G  0 disk 
├─sda1        8:1    0   450M  0 part 
├─sda2        8:2    0   100M  0 part /boot/efi
├─sda3        8:3    0    16M  0 part 
├─sda4        8:4    0    47G  0 part /windows
├─sda5        8:5    0 425,6G  0 part /
└─sda6        8:6    0   3,7G  0 part [SWAP]
mmcblk0     179:0    0  14,9G  0 disk 
└─mmcblk0p1 179:1    0  14,9G  0 part
  1. Run sudo blkid /dev/sdaX where sdaX is the answer from previous step (sda2 in my case).

Example output (here the answer is 58E4-427D):

/dev/sda2: UUID="58E4-427D" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="b81727be-ba90-5f8c-ab98-d3ec67778b7d"
  1. Add the following at the end of the file /etc/grub.d/40_custom:
menuentry "Windows 7" {  
     insmod ntfs  
     set root='(hd0,1)'  
     search --no-floppy --fs-uuid --set <UUID>
     chainloader +1  
}
  1. Run sudo update-grub and reboot.

Solution 3

I had Windows 10 running and then tried dual boot. Once Ubuntu was installed, Win 10 wasn't showing up in my GRUB loader. I tried the following --

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

Worked out pretty well. Was able to find both Windows and Ubuntu in GRUB after that.

Solution 4

I solved a similar problem following steps of Boot-Repair

Install boot-repair

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

Push "Recommended repair" And put in a terminal some commands as it suggested.

I think my Grub doesn't recognize windows due to a bad shutdown, and it solved the problem.

Solution 5

Slightly different method as I copied from a working example on another computer, posting for my own records.

Append the following to /etc/grub.d/40_custom:

menuentry "Windows 10" {
        insmod part_gpt
        insmod fat
        search --no-floppy --fs-uuid --set <boot_efi_uuid>
        chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}

where <boot_efi_uuid> is the UUID of your /boot/efi partition. To find this:

$ lsblk
NAME              MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT                                                  
sda                 8:0    0 119.2G  0 disk
└─md126             9:126  0 357.7G  0 raid0
  ├─md126p1       259:0    0   499M  0 md
  ├─md126p2       259:1    0   100M  0 md    /boot/efi                                                   
$ sudo blkid | grep md126p2 # Replace with your device
/dev/md126p2: UUID=<boot_efi_uuid>

Then of course, once you're saved the file, run:

sudo update-grub

Reboot, you should now be able to successfully start up Windows.

Share:
439,133

Related videos on Youtube

HyperX
Author by

HyperX

Updated on September 18, 2022

Comments

  • HyperX
    HyperX over 1 year

    I have finally installed Ubuntu on my second drive. When I start my computer GRUB only offers me to boot Ubuntu, not Windows 7. What needs to be done so that I can choose between Ubuntu and Windows in GRUB?

    When I press F12 for boot menu at startup and I choose Windows Boot Manager it boots into Windows 7.


    I ran command sudo fdisk -l and here is 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.
    
    • LovinBuntu
      LovinBuntu over 11 years
      Please indicate your Boot-Info URL. This will provide relevant information to help you.
  • Philippe Gachoud
    Philippe Gachoud almost 9 years
    I have 2 partitions with 2 windows install, it only detects my install on another partition, but not the new installed windows (on a SSD)! even mounted... an idea?
  • Elliptical view
    Elliptical view over 7 years
    Thanks. Interesting that the os-prober seems to need step 1. Very important, or windows won't work.
  • Yuvaraj Loganathan
    Yuvaraj Loganathan about 7 years
    mount -t ntfs-3g -o ro /dev/sda4 /media/windows to mount the windows partition
  • Charles Green
    Charles Green almost 7 years
    I believe that this answer while correct, is largely a copy of the answer submitted May 29, 2015
  • Evan
    Evan over 6 years
    I think mine also caused by the raid. But sudo dmraid -rE does not work for me. I finally made it by switch to AHCI in BIOS temporary, then boot to Ubuntu and execute sudo update-grub , then switch RAID ON back.
  • jocull
    jocull over 5 years
    Does this PPA still exist? I wasn't able to add it and it claimed it did not exist from Ubuntu 18.04 boot disk
  • Christopher Markieta
    Christopher Markieta about 5 years
    WARNING: this will destroy your RAID array if you are still using it.
  • winklerrr
    winklerrr about 5 years
    Just received a 404 Not Found error on Debian
  • Carolus
    Carolus over 4 years
    Thanks to @Christopher Markieta for all the details in another answer. Added them to this one as well (even though the specifics of the custom entry are different.
  • Winter
    Winter over 4 years
    If wifi is not connected it will claim it doesn't exist. This exact URL worked for me just now
  • ajaaskel
    ajaaskel about 4 years
    Confirmed: "os-prober" was missing. This time Linux Mint 19.3 Tricia. No error messages while running "update-grub" about missing os-prober, just failed to detect existing Windows partition.
  • aProperFox
    aProperFox about 4 years
    Thanks! FYI, according to /etc/grub.d/README, the filename should be 10_windows (or similar).
  • nomadSK25
    nomadSK25 almost 4 years
    you are a saviour @Hermes
  • Bilal
    Bilal about 3 years
    @PhilippeGachoud Ubuntu 20.04 in my case is not detecting the windows drive at all, and the grub is installed on another partition on the same drive as Ubuntu!