[Bug 1024383] Re: update-grub generates only BIOS based menu entries for Windows, even on UEFI systems

Etienne URBAH eurbah at free.fr
Tue May 17 00:51:38 UTC 2016


In order to boot Windows on UEFI systems :

WORKAROUND with 'Secure Boot' DISABLED
--------------------------------------
The 'grub.cfg' menuentry below, which may conceivably be generated by 'os-prober', works only with 'Secure Boot' disabled :

menuentry "Windows booted from its NTFS partition" {
    insmod part_msdos          # and/or part_gpt, depending on the partition table(s)
    insmod ntfs
    set WindowsEFI=/EFI/Microsoft/Boot/bootmgfw.efi
    if [ x$feature_platform_search_hint = xy ]; then
      search -n -s --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2 -f $WindowsEFI
    else
      search -n -s -f $WindowsEFI
    fi
    chainloader  $WindowsEFI
}

But with 'Secure Boot' enabled, the above menuentry systematically fails with following error message :
Secure boot forbids loading module from (hd0,msdos2)/boot/grub/x86_64-efi/ntfs.mod


WORKAROUND with 'Secure Boot' ENABLED
-------------------------------------
In order to boot Windows on UEFI with 'Secure Boot' enabled, I have successfully installed following workaround :

-  Think :  On installation of the Linux distribution (Ubuntu or another
one) with UEFI, the installer normally creates an 'EFI boot' partition
formatted as 'vfat'.

-  Think :  This 'EFI boot' partition is read by 'grub' WITHOUT the need
of the insecure 'ntfs.mod', and is precisely dedicated to booting.  So,
let's use it :

-  Under Linux, mount the Windows partition, and copy the content of its '/EFI' folder under '/boot/efi/EFI'.  For example :
   sudo  cp  -p  -r  /media/user/Windows-Label/EFI/*  /boot/efi/EFI/
   (you can safely ignore 'cp: failed to preserve ownership' error messages)

-  Then, replacing 'msdos2' by the partition number of the Windows
partition on your system, write following lines at the END of
'/etc/grub.d/40_custom' :

menuentry "Windows booted from EFI boot partition" {
    insmod part_msdos          # and/or part_gpt, depending on the partition table(s)
    set WindowsEFI=/EFI/Microsoft/Boot/bootmgfw.efi
    if [ x$feature_platform_search_hint = xy ]; then
      search -n -s --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2 -f $WindowsEFI
    else
      search -n -s -f $WindowsEFI
    fi
    chainloader  $WindowsEFI
}


FIXING THE BUG FOR ALL CASES
----------------------------
I suggest that 'os-prober' automatically performs the workaround just above, which involves copying boot files from the Windows partition to the 'EFI boot' partition.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to grub2 in Ubuntu.
https://bugs.launchpad.net/bugs/1024383

Title:
  update-grub generates only BIOS based menu entries for Windows, even
  on UEFI systems

Status in grub2 package in Ubuntu:
  Confirmed
Status in os-prober package in Ubuntu:
  Confirmed
Status in grub2 package in Debian:
  Fix Released

Bug description:
  64bits computer with pre-installed EFI Windows 7. (remark: same bug if
  Windows8)

  Installed Ubuntu 64bits in dual-boot. GRUB (grub-efi) is correctly
  installed and allows to boot Ubuntu, but it does not allow to boot
  Windows.

  Its menu shows 2 INVALID Windows entries. When selecting these
  entries, it displays "Invalid EFI file path" error, and returns to
  GRUB menu.

  It appears that GRUB creates BIOS/mbr entries when it should be
  UEFI/gpt type entries.

  *********************** WORKAROUND **************************

  either boot Windows from the (EFI) BIOS menu, or add valid Windows entries via Boot-Repair.
  ***************************************************************

  (original thread in French: http://forum.ubuntu-
  fr.org/viewtopic.php?pid=10010231#p10010231 )

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1024383/+subscriptions



More information about the foundations-bugs mailing list