linux or linux efi commands generated by grub2-mkconfig

I wanted to install Windows 8.1 on my sda and openSuSE 13.2 on sdb. I can’t remember all the steps I tried but the final step to get things working correctly was a manual adjustment to the grub.cfg file created by grub2-mkconfig. grub2 documentation is still somewhat sparse but I found articles on http://ordinatechnic.com/general-guides/grub-for-efi-systems

and https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/
System_Administrators_Guide/ch-Working_with_the_GRUB_2_Boot_Loader.html)
helpful, in particular the comment that

Statement 1:doing an EFI boot grub2 will read its grub.cfg from the EFI System Partition (EFI/opensuse/grub.cfg), not from /boot/grub2/grub.cfg.

My system looked likesda - GPT partitioned with protective MBR (for Windows 8.1)

[INDENT=2]sda1 - Windows 8.1 on sda1 Windows 8.1 - GPT partitioning and secure boot
sda2 - theEFI System Partition sda6 - openSuse 13.2
sda6 - openSuSE 13.2
[/INDENT]
sbd - GPT partitioned with hybrid MBR (selected by openSuSE install)

[INDENT=2]sdb1 - openSuSE 13.2
[/INDENT]

I think the old MBR scheme with its ‘extended partition’ is clumsy compared to the much cleaner GPT scheme so I got rid of the hybrid MBR running gdisk expert menu -n option.

With sdb1 as root and having mounted the EFI System Partition on /boot/efi running

   grub2-mkconfig -o /boot/efi/EFI/opensuse grub 

created a config file with the grub2 menuentry for booting from sdb1 executing linux and initrd commands.

 ... 
menuentry 'openSUSE' --class opensuse --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-cb726bc4-faee-4de8-b5e5-77b40cbe0ae6' {
     load_video
     set gfxpayload=keep
     insmod gzio
     insmod part_gpt
     insmod ext2
     set root='hd0,gpt1'
     if  x$feature_platform_search_hint = xy ]; then
       search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt1 --hint-efi=hd1,gpt1 --hint-baremetal=ahci1,gpt1 --hint='hd0,gpt1'  cb726bc4-faee-4de8-b5e5-77b40cbe0ae6
     else
       search --no-floppy --fs-uuid --set=root cb726bc4-faee-4de8-b5e5-77b40cbe0ae6
     fi
     echo    'Loading Linux 3.16.7-21-desktop ...'
     linux    /boot/vmlinuz-3.16.7-21-desktop root=UUID=cb726bc4-faee-4de8-b5e5-77b40cbe0ae6   quiet resume=/dev/sdb10 splash=silent quiet showopts
     echo    'Loading initial ramdisk ...'
     initrd    /boot/initrd-3.16.7-21-desktop
}
 ...
menuentry 'openSUSE 13.2 (x86_64) (on /dev/sda6)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-eeab051c-993a-4ed3-8230-267a2e94c6d8' {
     insmod part_gpt
      insmod ext2
     set root='hd1,gpt6'
     if  x$feature_platform_search_hint = xy ]; then
       search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt6 --hint-efi=hd0,gpt6 --hint-baremetal=ahci0,gpt6 --hint='hd1,gpt6'  eeab051c-993a-4ed3-8230-267a2e94c6d8
     else
       search --no-floppy --fs-uuid --set=root eeab051c-993a-4ed3-8230-267a2e94c6d8
     fi
     linux /boot/vmlinuz-3.16.6-2-desktop root=UUID=eeab051c-993a-4ed3-8230-267a2e94c6d8 ro BOOT_IMAGE=/boot/x86_64/loader/linux ramdisk_size=512000 ramdisk_blocksize=4096 resume=/dev/disk/by-uuid/3c71e2fd-afc5-47df-bc50-0d76e6d26a65 splash=silent quiet showopts
     initrd /boot/initrd-3.16.6-2-desktop
 } 

That didn’t work. Manually editing the commands to linuxefi and initrdefi does work. I have never seen any documentation (yet) about the linuxefi and initrdefi but assume they imply some kind of booting using a GPT partition rather than MBR. If so then:

Statement 2It would seem logical that grub2-mkconfig seeing a root device on a GPT partitioned disk with a protective MBR should the generate linuxefi and inirdefi commands for the grub.cfg file

Could someone comment whether statements 1 and/or 2 are correct.

If 2 is correct, is grub2-mkconfig behaviour a openSuSE or a grub problem?

Finally, what is the difference between .mod and .module as in /usr/lib/grub2/x86_64-efi/ntfs.mod /usr/lib/grub2/x86_64-efi/ntfs.module

Appreciate any comments.
Enno

Not quite right. There can be a grub.cfg in the EFI partition, but that normally tells it to read the grub.cfg in “/boot/grub2”.

Manually editing the commands to linuxefi and initrdefi does work.

If you turn off secure-boot in your BIOS settings, then you won’t need to do that editing. I’m not suggesting that, just explaining what is happening. When you use “linuxefi” it loads the kernel in a different way, and does the signature checking that secure-boot requires.

Add the line

GRUB_USE_LINUXEFI=true

to “/etc/default/grub”. It might already be there, but commented out. With that line added, it should generate the “linuxefi” commands when you run “grub2-mkconfig”.

Normally that’s there. But if you originally installed grub2 in the MBR, and later switched to using EFI, then it fails to add that line.

Finally, what is the difference between .mod and .module as in /usr/lib/grub2/x86_64-efi/ntfs.mod /usr/lib/grub2/x86_64-efi/ntfs.module

On my system, the files all end in “.mod”. I suspect that your “.module” file was added manually, and may be bogus.

.mod is final binary that is loaded at boot time and .module is intermediate unstripped object file that contains symbol and debug information.

GRUB_USE_LINUXEFI was not in the original /etc/default/grub file but adding it worked like a song.
I added the comment that this variable controlled whether loading was in secure mode or not.
Thanks.

I’m glad you have things working now.