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 ) :

./efi
./efi/efi
./efi/efi/boot
./efi/efi/boot/bootx64.efi
./efi/efi/ubuntu
./efi/efi/ubuntu/grubx64.efi
./efi/efi/Microsoft
./efi/efi/Microsoft/Boot
./efi/efi/Microsoft/Boot/bootmgfw.efi.grb
./efi/efi/Microsoft/Boot/bootmgfw.efi
./efi/efi/Microsoft/Boot/bootx64.efi.grb
./efi/efi/Microsoft/Boot/bootx64.efi

How can i fix this ?

Thanks


Solution 1:

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.

Solution 2:

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.