Grub2 cannot detect Windows 8

7,757

Solution 1

First, try disabling Secure Boot. Although Ubuntu theoretically supports Secure Boot, there are still a lot of problem reports concerning Secure Boot, particularly in dual-boot configurations. I think it's unlikely that disabling Secure Boot will immediately solve your problems, but it will make it more likely that any given thing you try to fix your problem will succeed.

Second, there are a number of things you can try to fix your boot problem, including:

  • Install my rEFInd boot manager. Note that there are USB flash drive and CD-R images you can try before trying the whole thing; however, they won't boot your Linux kernels directly unless you hit F2 or Insert twice and add ro root=/dev/sda9. If you install the Debian package, you should no longer need to do this. The USB/CD-R images should also boot both Windows and Linux via GRUB successfully.
  • Run the Boot Repair tool. This program can fix a lot of boot problems, although it does sometimes fail, and on rare occasion it can actually make matters worse by rendering Ubuntu unbootable.
  • Create a proper /etc/grub.d/40_custom entry for Windows. The one in your original question might work on a BIOS-based system, but under EFI, it will fail. You'd want something that looks more like this:

.

menuentry "Windows" {
    insmod part_gpt
    insmod chain
    set root='(hd0,gpt1)'
    chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}

Note that this exact 40_custom entry doesn't always work; you may need to tweak it for your system. (What works on one computer often fails miserably on another.)

Solution 2

You might take the execute permission completely off the /etc/grub.d/30_os-prober, because even if it doesn't find anything, it sets the timeout to 0, so no grub screen seen. Next, fix the chainloader command, the +1 is for an msdos partition disk, and you have a gpt partition disk, so it should look like:

chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi

The update-grub will create a new grub.cfg file, but it puts in into /boot/grub. You either need to copy it to /boot/efi/EFI/ubuntu, or ensure the grub.cfg file in ...ubuntu is just a stub which pulls in the one in /boot/grub (I think the later releases do this by default, but 12.04 may not.)

Even with the fixed chainloader, Windows may still not successfully boot (bug 1091464), so you may still have to boot Windows as the default or via the UEFI boot menu, like you do now.

Make sure the boot flag is set on the EFI parition. The bootloader location really is /EFI/ubuntu in the efi parition, even with just the disk selection. The files there should be shim.efi, grubx64.efi (the signed version), grub.cfg (and maybe gcdx64.efi). They must be right for you to successfully boot with secure boot on from the UEFI menu.

Share:
7,757
MetaChrome
Author by

MetaChrome

Updated on September 18, 2022

Comments

  • MetaChrome
    MetaChrome over 1 year

    At installation it did not detect Windows. I mounted the Windows partition and have run os-prober with no results returning.

    I am able to boot Windows or Ubuntu by specifying the partition in UEFI boot order. The bios does not appear to allow booting with legacy. SecureBoot is on.

    This is with Ubuntu 12.04 LTS on a Inspiron 15.

    Here is the gdisk:

       1            2048         1026047   500.0 MiB   EF00  EFI system partition
       2         1026048         1107967   40.0 MiB    FFFF  Basic data partition
       3         1107968         1370111   128.0 MiB   0C01  Microsoft reserved part
       4         1370112         2394111   500.0 MiB   2700  Basic data partition
       5         2394112       544743423   258.6 GiB   0700  Basic data partition
       6       606183424       625140399   9.0 GiB     2700  Microsoft recovery part
       7       544743424       545230847   238.0 MiB   0700  (/boot)
       8       545230848       556949503   5.6 GiB     8200  (swap)
       9       556949504       606181375   23.5 GiB    0700  (/)
    

    When installing ubuntu, I believe I specified that the bootloader be installed on /dev/sda.

    I added the following to /etc/grub.d/40_custom but booting ubuntu did not offer a grub menu:

    menuentry "Windows 8" {
    set root = "(hd0,4)"
    
      chainloader +1
    
      }
    

    When booting I think I see "EFI Disk error" flash very quickly before Ubuntu starts booting.

  • oldfred
    oldfred over 10 years
    The sda1 is the efi partition as with gdisk it shows as ef00. With gparted it uses the boot flag to indicate the efi partition. And in both cases the actual internal code is a long GUID to indicate the type of partition.