i've just installed Ubuntu 12.04 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 ?


4 Answers 4


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 :( Nov 12, 2012 at 15:46
  • refind gives me the windows option by if i choose it grub menu is opened O.o Nov 12, 2012 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, 2012 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, 2016 at 16:56
  • Don't be fooled into thinking because the tab autocomplete can see the gpt labels, etc. that it will use them to boot. The insmod part_gpt is needed. If you're here for a non-Windows GRUB chainloading fix and your path is correct, that is your answer.
    – SleighBoy
    Nov 18, 2019 at 23:01

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, 2012 at 14:49

As of today, in Xubuntu 22.04, I have been using the information provided above for my laptop using UEFI. However now I have had to add the location of the ESP partition to the chainloader line.

This is what my working configuration looks like now:

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


Also, the file in which I have had to insert it in order for it to work, is the file " custom " located under /etc/grub.d/proxifiedScripts.

One more annoyance was occurring at the same time : several sets of entries had appeared in the Grub boot stanza for the same Xubuntu install (not several installs). I have used grub-customizer, installed from its PPA, to fix it.

It seemed to me that the different entries had been generated through several proxy files located under /etc/grub.d, probably 10_linux_proxy, 31_linux_proxy, and 41_linux_proxy.

I would not dare change the default settings manually, of course.

  • I forgot to explain why I had to add the path to the ESP partition in the chainloader line : the boot failed with an error stating that the said file could not be found. I tried this as a guess as good as another, and it worked.
    – meylodie
    Oct 28 at 15:18

This an Update to the Answer for this question -- Ubuntu 22.04 MATE either ignores or otherwise over wrote my Win 10 Pro boot ... a quick jump to Ventoy and loading the Win10 ISO installer and then select Repair Boot fixes the issue ... whether it comes back after a kernel update remains to be seen :P


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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