i've just installed Ubuntu 12 on my new laptop ( with Win7 64bit pre installed ) in EFI mode and now i can't load Win7 anymore ( Ubuntu just loads fine from grub ). When i select the Windows 7 entry in the grub menu, i get this error:

Invalid EFI file path

The grub.cfg entry ( generated by boot-repair ) is:

menuentry "Windows 7 (loader) (on /dev/sda3)" --class windows --class os {
    insmod part_gpt
    insmod ntfs
    set root='(hd0,gpt3)'
    search --no-floppy --fs-uuid --set=root B8449665449625E2
    chainloader +1

This is the parted output :

GNU Parted 2.3
Viene usato /dev/sda
Benvenuti in GNU Parted. Digitare "help" per l'elenco dei comandi.
(parted) print list
Modello: ATA ST9500325AS (scsi)
Disco /dev/sda: 500GB
Dimensione del settore (logica/fisica): 512B/512B
Tabella delle partizioni: gpt

Numero  Inizio  Fine   Dimensione  File system  Nome                  Flag
 5      1049kB  106MB  105MB       fat32                              avvio
 3      345MB   200GB  200GB       ntfs         Basic data partition
 1      200GB   200GB  1049kB                                         bios_grub
 2      200GB   496GB  296GB       ext4
 4      496GB   500GB  4172MB

The boot EFI partition, mounted as

/dev/sda5 on /boot/efi type vfat (rw) ) 

has the following files ( excluding the grub folder and other files on the boot root ) :


How can i fix this ?


Your GRUB entry for Windows is appropriate for a BIOS-mode boot, but not for an EFI-mode boot. This is a GRUB bug. You can try replacing the entry with something like the following:

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

I make no guarantees that this will work, but it might. If it does, add that entry to /etc/grub.d/40_custom so that it will be created again whenever Ubuntu updates its GRUB configuration.

Another option is to use a different boot manager in addition to or instead of GRUB. rEFInd, for instance, will auto-detect both Windows and GRUB; and if you're using 3.3.0 or later kernels (as shipped with Ubuntu 12.10, but not with Ubuntu 12.04), you can boot Linux directly with rEFInd, bypassing GRUB entirely. gummiboot is another option with similar boot capabilities, but it requires more manual maintenance if you wanted to boot Linux directly with gummiboot.

  • Using that menu entry, sends me from grub to a black screen and then back to grub again :( – Simone Margaritelli Nov 12 '12 at 15:46
  • refind gives me the windows option by if i choose it grub menu is opened O.o – Simone Margaritelli Nov 12 '12 at 15:52
  • 1
    That sounds like Ubuntu has renamed the Windows boot loader and installed itself in its place! My hunch is the EFI/Microsoft/Boot/bootmgfw.efi.grb file on the ESP is the real Windows boot loader, so renaming bootmgfw.efi to something else and then renaming bootmgfw.efi.grb back to bootmgfw.efi will fix it. You can check the file sizes of these files and of EFI/ubuntu/grubx64.efi to verify this, or use diff to compare them. FWIW, Ubuntu's developers might have done this to work around bugs in some EFI implementations, but it's rather naughty of them, if so! – Rod Smith Nov 12 '12 at 23:18
  • 1
    On my laptop I had to set root=(hd0,gpt1) because that is where my DELL keeps its EFI partition. – Mutant Bob Dec 15 '16 at 16:56

Finally i've solved formatting and reinstalling everything from scratch ... basically ( don't know why ) grub had overwritten the windows 7 loader, that was the problem.

  • 1
    Ubuntu used to have a bug where it would wipe the ESP, but I thought that was fixed. Perhaps it's lingering under some circumstances. :-( A tip: Back up your entire ESP. That way if something weird happens, you can restore it in the future. (EFI doesn't rely on boot sector code, so a file-level backup works fine.) – Rod Smith Nov 14 '12 at 14:49

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.