EFI Dual Boot Issue: How to add menu entry for Windows image?

I have a dual boot Win7 - SUSE 12.2 installation. I have the W7 on a SSD (sda), that I installed first. I also have a 1 TB HD (sdb) that I formatted for 500 GB NTFS partion, 8 GB SWAP, and the rest EXT 4 for SUSE. During the installation, it wanted to delete entire windows partition because it was inconsistent. So loaded GParted and formatted the whole disk using a GPT (SUSE installation said it wanted this). Then went back to installation and SUSE ended up creating a FAT partition for boot also.

All fine so far, get GRUB2 boot menu with Win7 and SUSE as options, boot into SUSE, works great.

Then I try to go to GRUB2 and boot into Windows 7, and it gives me:


invalid EFI file path

I can still get into Windows 7 by going manually to boot menu and booting from either the SSD or the HD directly. But I’m wanting to be able to take advantage of my GRUB2.

So from the research I did. I think I need to either edit, or add a menu entry for the Windows 7 partition. I found that I can add stuff to:
/etc/grub.d/40_custom
but I do not know what to put there, or what the name of the image is, etc. Also, how could I find the correct ‘efi file path’ and change the current invalid path to the correct one?

Any help is appreciated.

The output of fdisk -l is:


Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders, total 234441648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00089e98


   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      206847      102400    7  HPFS/NTFS/exFAT
/dev/sda2          206848   234438655   117115904    7  HPFS/NTFS/exFAT


WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.




Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000


   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1  1953525167   976762583+  ee  GPT
Partition 1 does not start on physical sector boundary.


Disk /dev/sdc: 640.1 GB, 640135028736 bytes
255 heads, 63 sectors/track, 77825 cylinders, total 1250263728 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xacdd9b22


   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1              63  1250258624   625129281    7  HPFS/NTFS/exFAT

The output of gdisk -l sda is:


GPT fdisk (gdisk) version 0.8.2


Partition table scan:
  MBR: MBR only
  BSD: not present
  APM: not present
  GPT: not present




***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format.
***************************************************************


Disk /dev/sda: 234441648 sectors, 111.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 217675FD-B1C0-4946-8535-D874647F6843
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 234441614
Partitions will be aligned on 2048-sector boundaries
Total free space is 4973 sectors (2.4 MiB)


Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048          206847   100.0 MiB   0700  Microsoft basic data
   2          206848       234438655   111.7 GiB   0700  Microsoft basic data


the output of gdisk -l /dev/sdb is:


GPT fdisk (gdisk) version 0.8.2


Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present


Found valid GPT with protective MBR; using GPT.
Disk /dev/sdb: 1953525168 sectors, 931.5 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): CAD9DBB9-5F7A-4BAD-BDA8-FFF4861DEE9B
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 1953525134
Partitions will be aligned on 2048-sector boundaries
Total free space is 3437 sectors (1.7 MiB)


Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048        16779263   8.0 GiB     8200  
   2        16779264      1065355263   500.0 GiB   0700  
   3      1065355264      1953116159   423.3 GiB   0700  
   4      1953116160      1953523711   199.0 MiB   EF00  primary

and the output of gdisk -l /dev/sdc is:


GPT fdisk (gdisk) version 0.8.2


Partition table scan:
  MBR: MBR only
  BSD: not present
  APM: not present
  GPT: not present




***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format.
***************************************************************


Disk /dev/sdc: 1250263728 sectors, 596.2 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 9977600E-A59B-4397-A31B-C1F7182D6404
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 1250263694
Partitions will be aligned on 8-sector boundaries
Total free space is 5099 sectors (2.5 MiB)


Number  Start (sector)    End (sector)  Size       Code  Name
   1              63      1250258624   596.2 GiB   0700  Microsoft basic data

I was able to do this for Windows 8 in the following way.

I added the following to the file grub.cfg in boot/grub2-efi:

menuentry “Windows 8” {insmod part_gpt insmod fat insmod search_fs_uuid insmod chain search --fs-uuid --no-floppy --set=root 6453-92F3 chainloader (${root})/efi/Microsoft/Boot/bootmgfw.efi }

between the opensuse entry and the submenu ‘Advanced options for openSUSE’

To get the number **6453-92F3 **I ran os-prober which gave me:

opensuse:/home/garry # os-prober No volume groups found /dev/sda2@/EFI/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows:efi

This told me that the Windows boot was on sda2 and to get the id number I ran blkid which gave me:

Code:

opensuse:/home/garry # blkid /dev/sda1: UUID=“9AD85337D85310BD” TYPE=“ntfs” /dev/sda2: UUID=“6453-92F3” TYPE=“vfat” /dev/sda4: UUID=“58A7-C6C4” TYPE=“vfat” /dev/sda5: LABEL=“System” UUID=“A2F61C7DF61C53BF” TYPE=“ntfs” /dev/sda6: LABEL=“DATA” UUID=“DFA8-AD5C” TYPE=“vfat” /dev/sda7: LABEL=“Videos” UUID=“1836E0A936E08958” TYPE=“ntfs” /dev/sda8: LABEL=“CONFIG” UUID=“DFF1-8CAD” TYPE=“vfat” /dev/sda9: LABEL=“Recover” UUID=“488CA9B28CA99AC8” TYPE=“ntfs” /dev/sda10: SEC_TYPE=“msdos” UUID=“FC2C-3B7C” TYPE=“vfat” /dev/sda11: UUID=“c3c59586-225b-4999-8b90-6e77744840bc” TYPE=“swap” /dev/sda12: UUID=“734f4aa0-d84f-476b-b2e1-580158b8ffac” TYPE=“ext4” opensuse:/home/garry #

Taking the number from the entry for sda2.

I have a bash script you can use to create scripts for Grub 2 you can find here:

GNU Grub2 Command Help/Config Editor - Version: 1.91: https://forums.opensuse.org/blogs/jdmcdaniel3/gnu-grub2-command-listing-helper-help-input-106/

Here are a couple you could try if the boot SSD is not a GPT hard disk.

#!/bin/sh -e
echo "Adding Windows 7 to GRUB 2 menu"
cat << EOF
menuentry "Windows 7" {
set root=(hd0,1)
chainloader (hd0,1)+1
}
EOF       

Or Try This:

#!/bin/sh -e
echo "Adding Windows 7 to GRUB 2 menu"
cat << EOF
menuentry ‘Windows 7′ {
set root=’(hd0,msdos1)’
chainloader +1
}
EOF       

Thank You,

From what I can see, you performed a legacy installation of WIndows. Why?
If you just installed and have a 64bit Windows7 DVD and nothing to lose, I suggest reinstalling Windows in UEFI mode*, then Linux in UEFI mode as well.

This article might contain useful info: Booting openSUSE on UEFI BIOS with ELILO and Grub2 (part II - Windows dual-boot )
But don’t follow the method described there, because it applies to openSUSE 12.1 (not 12.2!)

Once you have a UEFI installation of Windows (with an efi boot loader), it will be easy to boot it from grub2-efi (not grub2!).

  • It is sometimes tricky - you might have to do it a couple times - but it’s doable. Look at the pictures in the articles which show the differences between legacy and UEFI/GPT based Windows installations

dth2
I was able to do this for Windows 8 in the following way.

I added the following to the file grub.cfg in boot/grub2-efi:

menuentry “Windows 8” {insmod part_gpt insmod fat insmod search_fs_uuid insmod chain search --fs-uuid --no-floppy --set=root 6453-92F3 chainloader (${root})/efi/Microsoft/Boot/bootmgfw.efi }

So I tried this following the directions to get the address number, etc, and it would only flicker the screen black and not do anything. I tried to tweak the entry for ‘ntfs’ instead of ‘fat’ also, because I was showing an ntfs partition. I tried tweak my existing ‘windows 7’ entry with the serial address I got from blkid. Still a no go. …

Here are a couple you could try if the boot SSD is not a GPT hard disk.

I tried both scripts, neither seemed to make any changes. Am I supposed to just run them from terminal? I see they are shell scripts, so I don’t think I need to be in bash, but I tried anyway. I scanned the page you gave me, and I 'm wondering if the scripts in your post somehow hook-up to that utility?

From what I can see, you performed a legacy installation of WIndows. Why?
If you just installed and have a 64bit Windows7 DVD and nothing to lose, I suggest reinstalling Windows in UEFI mode*, then Linux in UEFI mode as well.

This article might contain useful info: Booting openSUSE on UEFI BIOS with ELILO and Grub2 (part II - Windows dual-boot )

I had some issues with networking on my last motherboard, and this Windows/SUSE install is the third, and the third time I’ve reinstalled all my programs / backups. I’d REALLY like to avoid reinstalling Windows.

I read the post, but as far as I can see it’s just telling me to reinstall with UEFI Windows.

Is there anything else I can try to get the non GPT SSD Windows 7 boot to work with GRUB2-EFI?

Here is my output from # parted -l :


Model: ATA Samsung SSD 840 (scsi)
Disk /dev/sda: 120GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End    Size   Type     File system  Flags
 1      1049kB  106MB  105MB  primary  ntfs         boot, type=07
 2      106MB   120GB  120GB  primary  ntfs         type=07


Model: ATA WDC WD10EZEX-00R (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Number  Start   End     Size    File system     Name     Flags
 1      1049kB  8591MB  8590MB  linux-swap(v1)
 2      8591MB  545GB   537GB   ntfs
 3      545GB   1000GB  455GB   ext4
 4      1000GB  1000GB  209MB   fat16           primary  boot


Model: WD 6400AAC External (scsi)
Disk /dev/sdc: 640GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End    Size   Type     File system  Flags
 1      32.3kB  640GB  640GB  primary  ntfs         type=07

May be, but it is the wrong forum to ask. You need to a) install EFI Windows bootmanager and b) somehow make Windows to use it. I do not know what additional changes Windows may require to switch from legacy BOOT to EFI platform.

You should ask on Windows forums. There is nothing grub can do here.

On Fri, 08 Feb 2013 06:16:01 GMT, arvidjaar
<arvidjaar@no-mx.forums.opensuse.org> wrote:

>
>lotus360;2525423 Wrote:
>>
>>
> Is there anything else I can try to get the non GPT SSD
>> Windows 7 boot to work with GRUB2-EFI?
>>
>>
>
>May be, but it is the wrong forum to ask. You need to a) install EFI
>Windows bootmanager and b) somehow make Windows to use it. I do not know
>what additional changes Windows may require to switch from legacy BOOT
>to EFI platform.
>
>You should ask on Windows forums. There is nothing grub can do here.

I suspect that you are fundamentally correct. MSWin that is not setup for
EFI boot cannot boot from an EFI system.

More MS wilful stupidity.

?-)