This discussion is archived
11 Replies Latest reply: Apr 18, 2013 10:26 AM by Dude! RSS

syntax for Linux entry in grub.conf

asmirnov Newbie
Currently Being Moderated
Hi,
I have Windows 7 and OL 6.4 on a Lenovo laptop with UEFI firmware and I have a problem booting Windows from the default GRUB installation.
Would be great if someone who could make work dual boot on a UEFI machine could share a GRUB entry for the windows portion.
The default entry which is generated looks like

title Windows
rootnoverify (hd0,2)
chainloader +1

In my case if I select this option during boot I am getting Invalid EFI filepath message, Linux boot works fine.
Now someone from ubuntu forum pointed out this

menuentry "Windows 7 UEFI" {
search file no-floppy --set=root /efi/Microsoft/Boot/bootmgfw.efi
chainloader (${root})/efi/Microsoft/Boot/bootmgfw.efi
}

here
http://ubuntuforums.org/showthread.php?t=2135762&p=12604528#post12604528

I can not comment on the above, certainly it may be Ubuntu specific, but if someone can the WORKING grub entry for windows7 or windows (I have Windows 7) would be really great!

Thank you

P.S. one more - what is the correct GRUB syntax to propagate the changes done to the grub.conf file?
  • 1. Re: syntax for Linux entry in grub.conf
    Dude! Guru
    Currently Being Moderated
    What references exist that GRUB legacy can chainload a UEFI boot manager or that it was just a matter of the right configuration?

    From what I can see, this is a follow-up of your previous thread:
    where to install boot loader with OL 6.2 with Win7 GPT partition style
    where to install boot loader with OL 6.2 with Win7 GPT partition style

    Perhaps my previous explanations were not clear.

    RHEL6 and OL6 use a patched version of Grub 0.97 to be able to read a GPT partition (/boot), which according to the RHEL 6 installation guide must be created manually when using an UEFI based system, as opposed to MBR (PC BIOS).

    Section F.1. The Boot Process :

    UEFI-based x86 systems mount an EFI System Partition that contains a version of the GRUB boot loader. The EFI boot manager loads and runs GRUB as an EFI application.

    However, this does not mean GRUB legacy can chainload another UEFI boot manager or boot a UEFI based system.

    You have more options if you install Ubuntu, which uses GRUB 2, which fully supports UEFI, for instance:
    menuentry "Windows 7 UEFI" {
      insmod part_gpt
      insmod fat
      insmod search_fs_uuid
      insmod chain
      set root='(hd0,gpt2)'
      search --fs-uuid --no-floppy --set=root 4f84-ee2e
      chainloader (${root})/efi/Microsoft/Boot/bootmgfw.efi
    }
    Reference for above Grub 2 configuration:
    http://ubuntuforums.org/showthread.php?t=1934773
    As one of the replies outline, you can't enter BIOS compatibility and then jump back to EFI.
    P.S. one more - what is the correct GRUB syntax to propagate the changes done to the grub.conf file?
    Stage 2 of GRUB loads the grub.conf configuration file to display configuration options and list the bootable systems. You are perhaps confusing it with the installation of the GRUB bootloader, which typically replaces the Master Boot Record on systems with a legacy PC BIOS. The following link shows you some examples: http://wiki.centos.org/HowTos/GrubInstallation
  • 2. Re: syntax for Linux entry in grub.conf
    asmirnov Newbie
    Currently Being Moderated
    As always, thanks for the quick response.

    You are correct - there is always another option out there, speaking about Ubuntu.

    A while ago, many years back, I used to have RedHat subscription. What discourages me from following the same route is the "Oracle" portion in "Oracle Linux".

    And about the documentation - a quote

    "Because each vendor maintains its own directory of applications in the ESP, chain loading is not
    normally necessary on UEFI-based systems. T he EFI boot manager can load any of the operating
    system bootloaders that are present in the ESP."

    Will be nice to have an example on how to "load any of the operating system bootloaders" from above.

    Anyway, my question was mostly for folks who did it, I was under impression that were a couple of folks here that did the dual boot within UEFI.

    Regards
    A
  • 3. Re: syntax for Linux entry in grub.conf
    Dude! Guru
    Currently Being Moderated
    You cannot use the GRUB legacy version of RHEL to install a Master Boot Record and then use the GRUB menu to switch between legacy and UEFI booting. Your system BIOS may support UEFI and PC-BIOS, but it's only one way or the other. You cannot boot into BIOS compatibility mode and then use UEFI, or the other way around.

    According to the installation guide, your solution is to install the GRUB bootloader of RHEL into the existing EFI system partition (ESP) and create a /boot partition for GRUB manually as outlined in the installation guide.

    Btw, regarding Ubuntu, your system may need a firmware update:
    http://linux.slashdot.org/story/12/11/16/1414251/lenovo-uefi-bug-only-likes-windows-and-rhel
  • 4. Re: syntax for Linux entry in grub.conf
    asmirnov Newbie
    Currently Being Moderated
    OK, do you think it makes sense to go step by step?
    Or you confirm that OL6.4 DOES NOT work on UEFI system with dual boot? In which case I am ready to brush the UEFI off, you are the authority and I have my work to do....


    Here is the disposition: my BIOS is set to UEFI only, Windows does boot (without Linux installed).

    1. I start the OL6.4 installation, choose custom layout, select check box review layout.
    2. I go and create a custom (as in the installation guide) /boot partition, size 500M. The guide says should be ext3. Should I set the file system type to 'ext3' or 'EFI System Partition'?

    Thank you
    A
  • 5. Re: syntax for Linux entry in grub.conf
    Dude! Guru
    Currently Being Moderated
    No, that's not what I wrote. You should be able to use UEFI dual boot with RHEL Linux and Windows.

    You cannot use the GRUB legacy boot loader of RHEL to boot your computer into PC BIOS compatibility mode and then use GRUB to boot a UEFI system or load a UEFI boot loader. For this you will need GRUB 2, which is not part of RHEL/OL.

    Stay with UEFI, remove the GRUB MBR or set the system to UEFI only. The anaconda installer should recognize your primary disk uses a GPT partition and install a version of GRUB into the EFI system partition (ESP), or you may have to specify the EFI system partition. The ESP partition should be vFAT. Your EFI boot manager will then load GRUB as an EFI application, which in turn will load the GRUB boot loader in the /boot partition. The /boot partition must be Linux ext filesystem and you will have to create it manually. The GRUB version of RHEL/OL 6 is patched to be able to read the /boot GPT partition.

    I have not tried it myself, but that is what I understood from the documentation.
  • 6. Re: syntax for Linux entry in grub.conf
    asmirnov Newbie
    Currently Being Moderated
    OK, thanks, let me try.
    If not I will go ahead with GRUB2 install, folks out there say GRUB2 should work, will be nice to find out.
    Regards
    A
  • 7. Re: syntax for Linux entry in grub.conf
    Dude! Guru
    Currently Being Moderated
    If you install RHEL or Oracle Linux I would not install GRUB 2. It is not standard and there might be compatibility issues with kernel and other upgrades, which modify the grub configuration file. Since installing RHEL/OL 6 under UEFI is explained in the installation guide I'd say it works.
  • 8. Re: syntax for Linux entry in grub.conf
    asmirnov Newbie
    Currently Being Moderated
    Yes, it did work.
    The correct chainloader syntax for grub was

    chainloader /EFI/Microsoft/Boot/bootmgfw.efi

    Thank you for your help.
  • 9. Re: syntax for Linux entry in grub.conf
    Dude! Guru
    Currently Being Moderated
    But that should only work in GRUB 2, or not?
  • 10. Re: syntax for Linux entry in grub.conf
    asmirnov Newbie
    Currently Being Moderated
    Grub that is being used is 0.97
  • 11. Re: syntax for Linux entry in grub.conf
    Dude! Guru
    Currently Being Moderated
    That's interesting. So from what I understand, you are booting the system using UEFI and then use the GPT patched GRUB Legacy boot manager to choose between UEFI Windows and Linux.

    As far as I'm aware this is not really how it was meant to be done.

    The EFI firmware of your computer should have a boot manager built-in. You would normally press a key during startup, such as ALT/Option and EFI will scan the ESP partition for available systems and present an option for your to choose from. I'm starting to wonder if this was perhaps your actual problem after all.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points