openSUSE 12.2/Windows 8 (UEFI) dual boot / grub2

So I FINALLY got grub2 to recognize my Windows 8 install through reading various sources. I had to create a ‘30_windows’ custom grub config because even after installing grub2 & os-prober packages patched with updated proper UEFI support I still couldn’t get grub2 to recognize my Windows 8 install. I couldn’t get far enough with grub2-efi (failed on locating modules). Windows 8 is installed on a separate 3 TB HDD on my desktop PC with a UEFI & Legacy (BIOS) motherboard. (UEFI & Legacy BIOS is enabled for boot devices in the BIOS). The only problem (I think), is that in the ‘30_windows’ config file I set it to the wrong hd and/or partition before generating the grub config file with ‘grub2-mkconfig -o /boot/grub2/grub.cfg’ . When tyring to boot the Windows 8 entry in grub2 it says ‘error: no such partition’. Can someone please help me determine what the proper config should be for my Windows 8 grub entry so I can boot to it without having to tweak my BIOS/UEFI settings every time I want to boot to Windows?
Here is my info:

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

Disk /dev/sda: 3000.6 GB, 3000592982016 bytes
256 heads, 63 sectors/track, 363376 cylinders, total 5860533168 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/sda1               1  4294967295  2147483647+  ee  GPT
Partition 1 does not start on physical sector boundary.

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: 0x000837c8

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048  1953523711   976760832    f  W95 Ext'd (LBA)
/dev/sdb5            4096      321535      158720   83  Linux
/dev/sdb6          323584     4530175     2103296   82  Linux swap / Solaris
/dev/sdb7         4532224    88422399    41945088   83  Linux
/dev/sdb8        88424448  1953503231   932539392   83  Linux

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


Disk /dev/sdc: 3000.6 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 364801 cylinders, total 5860533168 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: 0x4bafcb6a                                                                                                                                                                                                                    
                                                                                                                                                                                                                                              
Device Boot      Start         End      Blocks   Id  System                                                                                                                                                                                
/dev/sdc1            2048  4294969342  2147483647+  83  Linux                                                                                                                                                                                  
/dev/sdc4               1           1           0+  ee  GPT                                                                                                                                                                                    
                                                                                                                                                                                                                                              
Partition table entries are not in disk order                                                                                                                                                                                                  
Note: sector size is 4096 (not 512)
GNU Parted 2.4
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                                
Model: ATA ST3000DM001-1CH1 (scsi)
Disk /dev/sda: 3001GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Number  Start   End     Size    File system  Name                          Flags
 1      1049kB  316MB   315MB   ntfs         Basic data partition          hidden, diag
 2      316MB   419MB   104MB   fat32        EFI system partition          boot
 3      419MB   554MB   134MB                Microsoft reserved partition  msftres
 4      554MB   3001GB  3000GB  ntfs         Basic data partition
grub.cfg
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if  -s $prefix/grubenv ]; then
  load_env
fi
set default="${saved_entry}"

if  x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if  "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if  -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if  x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if  x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_msdos
insmod btrfs
set root='hd1,msdos7'
if  x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos7 --hint-efi=hd1,msdos7 --hint-baremetal=ahci1,msdos7 --hint='hd1,msdos7'  71242393-d510-4a6c-b749-018bd581ccf5
else
  search --no-floppy --fs-uuid --set=root 71242393-d510-4a6c-b749-018bd581ccf5
fi
    font="/usr/share/grub2/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
insmod part_msdos
insmod ext2
set root='hd1,msdos5'
if  x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos5 --hint-efi=hd1,msdos5 --hint-baremetal=ahci1,msdos5 --hint='hd1,msdos5'  1ca76a6f-ea35-405b-a93c-a7c7f657d7d9
else
  search --no-floppy --fs-uuid --set=root 1ca76a6f-ea35-405b-a93c-a7c7f657d7d9
fi
insmod gfxmenu
loadfont ($root)/grub2/themes/openSUSE/ascii.pf2
loadfont ($root)/grub2/themes/openSUSE/DejaVuSans10.pf2
loadfont ($root)/grub2/themes/openSUSE/DejaVuSans12.pf2
loadfont ($root)/grub2/themes/openSUSE/DejaVuSans-Bold14.pf2
insmod png
set theme=($root)/grub2/themes/openSUSE/theme.txt
export theme
if  x${boot_once} = xtrue ]; then
  set timeout=0
elif sleep --interruptible 0 ; then
  set timeout=10
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'openSUSE 12.2' --class opensuse --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-71242393-d510-4a6c-b749-018bd581ccf5' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd1,msdos5'
        if  x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos5 --hint-efi=hd1,msdos5 --hint-baremetal=ahci1,msdos5 --hint='hd1,msdos5'  1ca76a6f-ea35-405b-a93c-a7c7f657d7d9
        else
          search --no-floppy --fs-uuid --set=root 1ca76a6f-ea35-405b-a93c-a7c7f657d7d9
        fi
        echo    'Loading Linux 3.7.2-1-desktop ...'
        linux   /vmlinuz-3.7.2-1-desktop root=UUID=71242393-d510-4a6c-b749-018bd581ccf5   video=1920x1080 splash=0 splash=silent showopts
        echo    'Loading initial ramdisk ...'
        initrd  /initrd-3.7.2-1-desktop
}
submenu 'Advanced options for openSUSE 12.2' $menuentry_id_option 'gnulinux-advanced-71242393-d510-4a6c-b749-018bd581ccf5' {
        menuentry 'openSUSE 12.2, with Linux 3.7.2-1-desktop' --class opensuse --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.7.2-1-desktop-advanced-71242393-d510-4a6c-b749-018bd581ccf5' {
                load_video
                set gfxpayload=keep
                insmod gzio
                insmod part_msdos
                insmod ext2
                set root='hd1,msdos5'
                if  x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos5 --hint-efi=hd1,msdos5 --hint-baremetal=ahci1,msdos5 --hint='hd1,msdos5'  1ca76a6f-ea35-405b-a93c-a7c7f657d7d9
                else
                  search --no-floppy --fs-uuid --set=root 1ca76a6f-ea35-405b-a93c-a7c7f657d7d9
                fi
                echo    'Loading Linux 3.7.2-1-desktop ...'
                linux   /vmlinuz-3.7.2-1-desktop root=UUID=71242393-d510-4a6c-b749-018bd581ccf5   video=1920x1080 splash=0 splash=silent showopts
                echo    'Loading initial ramdisk ...'
                initrd  /initrd-3.7.2-1-desktop
        }
        menuentry 'openSUSE 12.2, with Linux 3.7.2-1-desktop (recovery mode)' --class opensuse --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.7.2-1-desktop-recovery-71242393-d510-4a6c-b749-018bd581ccf5' {
                load_video
                set gfxpayload=keep
                insmod gzio
                insmod part_msdos
                insmod ext2
                set root='hd1,msdos5'
                if  x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos5 --hint-efi=hd1,msdos5 --hint-baremetal=ahci1,msdos5 --hint='hd1,msdos5'  1ca76a6f-ea35-405b-a93c-a7c7f657d7d9
                else
                  search --no-floppy --fs-uuid --set=root 1ca76a6f-ea35-405b-a93c-a7c7f657d7d9
                fi
                echo    'Loading Linux 3.7.2-1-desktop ...'
                linux   /vmlinuz-3.7.2-1-desktop root=UUID=71242393-d510-4a6c-b749-018bd581ccf5  showopts apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset  x11failsafe
                echo    'Loading initial ramdisk ...'
                initrd  /initrd-3.7.2-1-desktop
        }
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_ppc_terminfo ###
### END /etc/grub.d/20_ppc_terminfo ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_windows ###
menuentry "Windows 8" {
        insmod part_gpt
        insmod chain
        set root='(hd0,gpt2)'
        chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
### END /etc/grub.d/30_windows ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if  -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif  -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

### BEGIN /etc/grub.d/90_persistent ###
### END /etc/grub.d/90_persistent ###

You should use the UUID of the partition, not the disk/partition number. See examples here: Manually adding a new entry (e.g. Windows) to the GRUB2-EFI boot loader menu an here: Confused with grub2-efi / opensuse / win 8

Is anyone going/willing to tell me some day if updategrub is able ta add this entry automatically or not (on openSUSE 12.2 + WIndows 8) … If not, we will never know, as I’m certainly not going to buy a crappy (or even not crappy) Windows8 laptop!

  • Under 12.1 and WIndows7, it would have added a boot entry for Windows, even before we patched os-prober for UEFI.

Thank you very much for that information. I will try using the UUID method.

I don’t know if this quite answers your question, but… if you’re referring to update-grub, it was featured with grub only, technically not grub2. Some distros still ship grub2 with the update-grub stub (not SUSE from what I can tell), but from what I’ve read, upgrade-grub was deprecated with grub2 in place of the command ‘grub2-mkconfig -o /boot/grub2/grub.cfg’.

Well, I tried the UUID method, re-generated my grub.cfg file & chose Windows 8 from the grub screen but unfortunately it didn’t work. It said:
‘error: invalid signature.’
What troubleshooting steps can I take next?

Are you sure you put the UUID of the ESP partition? (the one containing Windows efi boot loader).

Yes. What I did was, looked at the YaST Partitioner which showed me that /dev/sda2 is the partition that contains the Windows EFI boot loader:
http://t.imgbox.com/adzrraRy.jpg](http://imgbox.com/adzrraRy)

So then I ran this:
sudo /usr/sbin/grub2-probe -t fs_uuid -d /dev/sda2

and it told me that the UUID is: B855-E9C8.

I then edited my 30_windows file to reflect this:

#!/bin/bash
cat << EOF
menuentry "Windows 8" {
        insmod part_gpt
        insmod fat
        insmod search_fs_uuid
        insmod chain
        search --fs-uuid --no-floppy --set=root B855-E9C8
        chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
EOF

I then re-generated my grub.cfg file with this command: grub2-mkconfig -o /boot/grub2/grub.cfg

Restarted the PC and selected Windows 8 from the grub screen but it just says:
error: invalid signature.

Update:
Upon further research, I’ve found two common causes of the ‘invalid signature’ error.

#1 is that one is mistakenly pointing the root at the recovery partition instead of the boot partition. Based on my screenshot though, we know that is not the case. The EFI boot partition is clearly listed as /dev/sda2.

#2 is that the device map is outdated/stale. The Arch wiki recommends deleting the existing device map and regenerating the grub.cfg file, which I did, however, this didn’t have any effect at all.

Grub2 still complains of an invalid signature.

@echoes-

Do you mind trying something - which might even fix your problem if it still works?

Install the package updategrub from my repo (it has nothing to do with Ubuntu’s update-grub).
Here are some relevant threads:

latest os-prober and updategrub development …

Installing Grub2 with updateGrub2

It was previously intended to install grub2-efi on UEFI systems under openSUSE 12.1 (where it wan’t installed by default). It can be used to refresh the grub menu on both UEFI and legacy systems and has a couple features (some of them require os-prober from my repo - which might be the one you installed alreaydy (?) )

The following command will just display the boot menu without writing anything:

# updategrub -d

But I’m not sure it will actually write 40_custom.

You don’t need a separate script such as your 30_windows. Is it exectuable by the way?

Again, I don’t know it updategrub is going to work. I’m afraid it won’t. That’s why I’m asking you. Unfortunately I don’t have an openSUSE 12.2 + Window 8 UEFI system nor time to fix it… Otherwise it would be “simple”.

Something is unclear though. When you say “grub2”, do you mean “grub2-efi” ?

If you have 12.2, configuration is in /boot/grub2-efi/grub.cfg

[quote="“arvidjaar,post:10,topic:86384”]

If you have 12.2, configuration is in /boot/grub2-efi/grub.cfg[/QUOTE]

And it should not be grub2-mkconfig but grub2-efi-mkconfig (unless it has changed).
That’s what troubles me here.

Before starting this thread I had installed grub2 & os-prober from a different repo than yours, only because those packages had been updated more recently than yours.
I went ahead and downgraded back to openSUSE-12.2-update, removed that repo and then added yours. I installed the os-prober & updategrub packages.
I ran the ‘updategrub -d’ command. I also removed my custom windows script (which was executable BTW). I then regenerated my grub2.cfg file. None of this worked though because it completely failed to see or at least add my Windows drive/partition to the grub menu. I’m back at square one.

I mean grub2. I mentioned in my first post that installing grub2-efi failed because it couldn’t find the required modules. Keep in mind that oS12.2 is installed on a separate HDD than Windows 8.

Referring to my last statement… I am on 12.2 but I’m running grub2 not grub2-efi, which failed like I said. So are you saying I should be using grub2-efi? If so, I’m going to need some help getting it working beyond a certain point.

I suspect that you have a UEFI/GPT installation of WIndows8 and a legacy/MBR installation of openSUSE. I suggest you first read this article Booting openSUSE on UEFI BIOS with ELILO and Grub2 (part II - Windows dual-boot ) - not too carefully because it was written for openSUSE 12.1 and lots of things have changed. Thus the procedure described in this article to install grub2-efi doesn’t apply anymore, because it is now installed by default. But it still contains some helpful information about Windows and openSUSE UEFI.

As for openSUSE, if you installed it on a separate disk and you don’t mind reinstalling, I suggest you reinstall it in UEFI mode by following the simple steps I described in this other thread: Installation with secure boot disabled- no active partition. Once you have a UEFI/GPT openSUSE, it won’t be difficult to boot Windows, either by adding a boot entry manually or having it written by updategrub (if is still works). That it didn’t work in you system as it is now is not surprising - it could not work.

It should be possible however to combine both UEFI and legacy systems together, but I don’t know how and I have no way to test. James in this forum has this kind of setup, I guess. Maybe, he could help. In your case, I recommand reinstalling Linux in UEFI mode though. It is much simpler and much better.

That type of set is what I have. Sorry I wasn’t clear.

I think it should be possible too, but grub2-efi just didn’t want to work no matter how much I fussed around with it & tweaked it.
Weird that openSUSE can’t be “converted” from using MBR to UEFI because I’ve read and seen that it is possible to convert Windows with multiple versions of Windows.

Did a bit of searching on this subject. Found this on the Arch wiki on the GUID Partition Table page:
Convert from MBR to GPT One of the best features of gdisk (and sgdisk and cgdisk too) is its ability to convert MBR and BSD disklabels to GPT without data loss. Upon conversion, all the MBR primary partitions and the logical partitions become GPT partitions with the correct partition type GUIDs and Unique partition GUIDs created for each partition.
Just open the MBR disk using gdisk and exit with “w” option to write the changes back to the disk (similar to fdisk) to convert the MBR disk to GPT. Watch out for any error and fix them before writing any change to disk because you may risk losing data. See http://www.rodsbooks.com/gdisk/mbr2gpt.html for more info. After conversion, the bootloaders will need to be reinstalled to configure them to boot from GPT.
** Note: **Remember that GPT stores a secondary table at the end of disk. You may have to make sure that the last 1 MiB of the disk is not used by any partition.

It will work if you have a UEFI/GTP installation of openSUSE. You should see these two setups as very different. Also to install Linux in UEFI mode, it will be necessary to wipe out the first track of the hard disk. And, as I said in the other thread, if you don’t see “ELILO” while booting, you’re on the wrong path. But I already described the steps in detail.

Well … you could try and finally reinstall in UEFI mode if it doesn’t work. If you managed, you should be able to use grub2-efi. I don’t need to tell you that reinstalling will be a lot easier. But converting is certainly worth a try if you have nothing to loose.

@arvidjaar will probably have some suggestions and be interested in solving this problem. If you’re unsure, just wait for him.

I think I may just reinstall in UEFI mode. Sigh…

Thanks for the help. I may wait on arvidjaar and see what he has to say.

Be aware that it might be tricky with some mainboards - not difficult but tricky. The install DVD includes the two setups and will be seen as two boot devices in UEFI BIOS. If the BIOS default is to boot in compaitibility mode, it will always boot the non UEFI device and perform a legacy installation (which means MBR partitioning, etc). To make sure that it will run the UEFI setup, you might have to call the BIOS setup with the DVD inserted and set the boot priority at this moment. openSUSE live CD as in 12.2 doesn’t include the UEFI setup at all. Thus it can not be used to install in this mode.

What is the final goal? If using ESP on /dev/sda to boot Linux is acceptable, there is no need to mess around with converting partition table. Just install grub2-efi, boot from any Live CD in UEFI mode, and “repair” bootloader on Linux using in this case grub2-efi. After reboot set grub2-efi as default bootloader in YaST2. I could give more precise instructions in this case.

If the goal is to have self-contained Linux disk, which can be booted separately, the main problem is to create ESP on sdb. You have less than 2MB in the beginning and ~10MB at the end. In principle, this should be enough for a single grub.efi (could someone check size?) It is still doable, just needs to be done more carefully. UEFI should be able to boot from MBR (modulo bugs in specific implementation) so in this case I would start with creating ESP on /dev/sdb and checking whether it is visible in EFI boot menu. If yes, just proceed as in previous case but use ESP on /dev/sdb :slight_smile:

If new installation is an option, it is probably much easier.

The goal is simply to get grub to recognize (i.e. create an entry for) my Windows installation so that I can boot into Windows with grub without having to tweak my BIOS/UEFI settings every time.

I will have to try what you suggested.

I may need some clarification though. By repairing it, do you mean simply telling grub to generate a new cfg file?