grub2-efi-mkconfig creates wrong stanza in cfg file for win7 on efi system

Installed RC2 onto a duel boot system with existing win7 efi install.

I have the openSUSE 12.2RC2 booting fine with grub2-efi install but the win7 entry is unbootable. The efi partition
is at the end partition which I think is causing the problem.


Model: ATA WDC WD5000AAKS-0 (scsi)Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt


Number  Start   End    Size   File system  Name                  Flags
 1      32.3kB  500GB  500GB  ntfs         Microsoft basic data
 2      500GB   500GB  209MB  fat32                              boot

The stanza created automatically by the 30_os-prober in /etc/grub.d creates this which points to the first partition (btfs)
and appears to be a mbr boot config.


### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows 7 (loader) (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-746C89606C891E4C' {
        insmod part_gpt
        insmod ntfs
        set root='hd0,gpt1'
        if  x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  746C89606C891E4C
        else
          search --no-floppy --fs-uuid --set=root 746C89606C891E4C
        fi
        chainloader +1
}
### END /etc/grub.d/30_os-prober ###

The uuids are for the ntfs partition not the gpt partition and the chainloader command is should be:

chainloader (${root})/efi/Microsoft/Boot/bootmgfw.efi


grub2-probe --target=fs_uuid /boot/efi/EFI/Microsoft/Boot/bootmgr.efi 
3185-A28F

grub2-probe --target=fs_uuid /windows/C/
746C89606C891E4C



As seen the uuid being used is the one for the ntfs but should be the uuid for the efi partition. And
what I think is casuing the problem is that it isn’t on the first partition.

I can fix the issue by adding a custom menu item in the /etc/gub.d/40_custom using please_try_again’s guide but
the automatic generation produces a extra menu item.

Please file a bug report.

Does it mean that the ESP was not the first partition on your installed Windows? It’s pretty uncommon. Windows itself doesn’t do that.

If it’s parted -l - which I had to guess because you didn’t post the command, just the output -, it should describe the ESP as “EFI system”. Make sure that its GUID (not UUID) starts with C12A7328. Being from type Fat32 and mounted in /boot/efi is not sufficient. (See the last example in this post: http://forums.opensuse.org/english/other-forums/development/programming-scripting/475610-lspart-alternative-fdisk-l.html#post2465354).

It was a conversion from a mbr install to a efi install w/o re-installing windows

The output is from parted -l

I used this for the openSUSE uuids


grub2-probe --target=fs_uuid /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi

and

grub2-probe --target=fs_uuid /windows/C

The uuid from the 30_os-prober matches what the ntfs uuid is and all entries match what a mbr boot
would look like. The problem is the automatic discovery of the partitions doesn’t find the second partition
once it finds a ntfs partition (I think).

If I create a stanza using correct parameters from your guide, all works fine. The problem is that other
will have a unbootable system and give up. I can get around this different ways using the efi shell if
worst come to worse.

In your guide it clearly shows obtaining the uuid of the efi partition and it does work, the automatic
system also uses the uuid (wrong one but uuid never the less).

I have entered a bug report, this could be a show stopper for some.

I didn’t mean the UUID. It’s irrelevant. I meant the GUID. According to your parted -l, the EFI partition is not seen as EFi but as ordinary Fat32 paritition. That’s why I suggested taking a look at its GUID (for example with lspart). It will show you if it starts with C12A7328 (it has to). If a Fat32 partition was created but was not assigned the type ESP, you could have this kind of error, IMO.

Had some time to take a closer look. Running gdisk:


 Command (? for help): pDisk /dev/sda: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 5764CF42-7216-4B1F-AB05-46632D2B7E4F
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 8-sector boundaries
Total free space is 44 sectors (22.0 KiB)


Number  Start (sector)    End (sector)  Size       Code  Name
   1              63       976365567   465.6 GiB   0700  Microsoft basic data
   2       976365568       976773119   199.0 MiB   EF00  


Command (? for help): i
Partition number (1-2): 1
Partition GUID code: EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 (Microsoft basic data)
Partition unique GUID: 9726E65F-AF5E-48CE-971B-D77656922049
First sector: 63 (at 31.5 KiB)
Last sector: 976365567 (at 465.6 GiB)
Partition size: 976365505 sectors (465.6 GiB)
Attribute flags: 0000000000000000
Partition name: 'Microsoft basic data'


Command (? for help): i   
Partition number (1-2): 2
Partition GUID code: C12A7328-F81F-11D2-BA4B-00A0C93EC93B (EFI System)
Partition unique GUID: 9A397281-0D55-4D29-97F9-A5339DC6E3BD
First sector: 976365568 (at 465.6 GiB)
Last sector: 976773119 (at 465.8 GiB)
Partition size: 407552 sectors (199.0 MiB)
Attribute flags: 0000000000000000
Partition name: ''



The second partition is the uefi partition.

I have opened a bug report and unless I’m missing something the os-prober script only sees the first partition which
it thinks is a bootable win partition.

os-prober 
/dev/sda1:Windows 7 (loader):Windows:chain

the same i see in win8.

grub2-efi in yast give me other map of hardware(diso duro).IT can boot in opensuse 12.2, but can’t boot win8 with error 0xc0000001.

sorry my english…

Solution: start win8 installation disk, all the way down to the partition, you can see several partitions, indeed there are a lot of non-partitioned part, it can not be established in the new partition. The disk head a 0mb of partition. Figures from largest to smallest, delete partition, to be restored to the last 0 partition delete the original partition table. Then do not delete. . And then delete the gods could not save. Then exit the installation, restart the computer is restored. Linux can still be used.

yo uso dvd de win8 arrancar otra vez, hast instalar, no recuperacion, cuando se ve partición del disco duro, hay uno partipacion con 0MB…y yo eliminar todo partición, ok , ahora se me devulve todo partición antigua. reiniciar PC, win8, y Opensue todo se puede trabajar…