Dual boot UEFI Windows 7 and Ubuntu 12.04 (both 64 bits). W7 entry doesn't appear in GRUB

37,711

Solution 1

Find where the windows bootloader resides by mounting the efi partition:

sudo mount -t vfat /dev/sdx1 /mnt/efi/

And search for bootmgfw.efi. Then, find the UUID of the drive:

sudo grub-probe --target=fs_uuid /mnt/efi/EFI/Microsoft/Boot/bootmgfw.efi

Add this UUID to /etc/grub.d/40_custom:

menuentry "Windows x86_64 UEFI-GPT" {
    search --fs-uuid --no-floppy --set=root UUID
    chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi
}

Finally run update-grub.

Solution 2

jarondl's solution is perfectly good, but another one is to use a separate boot manager program to select between GRUB and the Windows boot loader. I know of three EFI boot managers you can install:

  • rEFIt, which is available in Ubuntu's repositories. Note that the version from rEFIt's site won't work on UEFI-based PCs, since it uses a Mac-specific file format. Even Ubuntu's version has a number of minor glitches on UEFI-based PCs. Ideally, rEFIt presents a pretty GUI boot menu (although it's also got a text mode).
  • rEFInd, which is an updated version of rEFIt with fixes for the various UEFI glitches and extensions to work with a 3.3.0 kernel's built-in EFI boot loader. Note that I forked/maintain rEFInd.
  • gummiboot, which is a text-only boot manager. (This site keeps forgetting who I am and refuses to let me post more than two hyperlinks as a result, or I would have provided one.)

Both rEFIt and rEFInd auto-detect other boot loaders, so once you've configured them, they should detect any OS's boot loader and give you a menu. I've not yet tried gummiboot, so I don't know how simple it is to set up, but it's similar conceptually to rEFIt/rEFInd. Using any of these programs adds complexity to the boot process, so if GRUB works and you're happy with it, there's little point to using any of these programs. They're most useful if GRUB is temperamental or just plain doesn't work, as is often the case with GRUB 2 on UEFI systems, in my experience. In such a situation, you can ditch GRUB 2 in favor of ELILO or a 3.3.0 or later kernel's EFI stub loader. These boot loaders can't redirect the boot process to Windows, making a separate boot manager very useful. With a distribution that uses a 3.3.0 or later kernel, rEFInd can be very easy to maintain, depending on the configuration details.

Share:
37,711

Related videos on Youtube

Joe
Author by

Joe

Updated on September 18, 2022

Comments

  • Joe
    Joe over 1 year

    After trying to install both OS during 2 days, I'm confused and getting mad... I have SSD 128 GB and HDD 500 GB both empty. My laptop is Asus K55VM. BIOS support UEFI.

    What I have done:

    1. Install new SSD (Samsung 830 128GB)

    2. Use GParted on liveCD to create new table of partitions (GPT) and create 3 partitions (in the SSD) for different purposes:

      • Partition 1: 80 GB (w7);
      • Partition 2: 30 GB (Ubuntu 12.04 -Just / -);
      • Partition 3: 10 GB unused (for future extesion of the other partitions)
    3. Install Windows 7 (with UEFI) in Partition 1. This create:

      • /dev/sda1 -> 100 MB for System (UEFI boot I guess) - FAT32
      • /dev/sda2 -> 100 MB aprox. for MSR
      • /dev/sda3 -> 79.800 MB aprox. for Windows7 data

    In this point everything works fine. I have W7. Now I install Ubuntu 12.04 amd64 (with UEFI) as follows:

    1. Install / in Partition 2 -> /dev/sda4 30 GB ext4, and in the hdd I install /home and swap.

    2. I select bootloader in /dev/sda1 (where it's supposed to be the UEFI boot).

    3. I install updates and reboot.

    Problem: Now just appears grub menu with Ubuntu entries and not Windows 7.

    Alternative solution found: When I turn on laptop, before loading GRUB I press ESC key and appear BIOS boot, so I can select to boot the Windows partition, Ubuntu partition, DVD, USB, etc... but I think is not the best way to boot different OS.

    I've tried: sudo update-grub2 with no success.

    What can I do??

  • Joe
    Joe over 11 years
    You are my bloody hero !! Thanks a lot that worked pretty fine. You made my day =)
  • LovinBuntu
    LovinBuntu over 11 years
    For information, Boot-Repair would have added the entry in 1 click. help.ubuntu.com/community/Boot-Repair
  • fccoelho
    fccoelho over 11 years
    Except Boot-repair does not work on my system...
  • fccoelho
    fccoelho over 11 years
    Refind does not support ntfs partitions...
  • Rod Smith
    Rod Smith over 11 years
    The fact that rEFInd doesn't come with an NTFS driver is irrelevant. Windows' EFI boot loader resides on the EFI System Partition (ESP), which is FAT, so rEFInd doesn't need to access an NTFS volume. Also, it's unfair to single out rEFInd on this score; neither rEFIt nor gummiboot comes with an NTFS driver, either.