Skip to main content
1 of 2

How to make grub2 chain-boot Win8 after upgrading Fedora18 to Fedora19?

The story

(read just the bold text): (there will be solution at the end, I wanted to share my experience in case anyone will need it) I have Lenovo IdeaPad U310 with 24gb SSD, 500gb HDD and UEFI system. I flashed it with EFI from U410 for more info . There was preinstalled Win7 with all these ultra inovative technologies as iRST and so on.. Disks had old MBR tables so I used live Fedora usb to format both disks to GPT using gparted. This wiped all data. Fedora17 didn't see disks with MBR in UEFI mode but with GPT instalation went flawlessly.

First instalation process; Firstly I installed Fedora17 to SSD as LVM instalation and I let HDD alone with no changes. GRUB2 was installed at the SSD also. (Partition layout;

  • sda1 200M /boot/efi
  • sda2 500M /boot
  • sda3 rest LVM with root and swap)

In Fedora I formated HDD to 400GB ext4 data partition and I let 100GB free for windows instalation. I thaught If I have two OS in two separated disks I can solve booting each from EFI boot menu (F12 during start of the computer) but I was wrong. After a while using only linux computer (that was great and after releasing Steam for linux I could even play games there, C programing in eclipse is perfect too) Then I installed Win8 to HDD. Windows created its useless 128MB partition as Windows reserved partition and then system partition afterwards. It didn't created it's own EFI partition for boot loader! I think it just used Linux one and write the bootloader do sda1.

Everything was going well. Grub2 didn't see Windows 8 so it couldn't chainboot windows but this wasn't problem. I could choose Windows boot manager option in EFI boot menu and it booted Windows 8 and didn't start grub2. I was using it for some months.

After I upgraded Fedora 17 to Fedora 18 (it was rather whole new instalation) I haven't realized, that Windows and Fedora were sharing EFI partition at sda1 (I do not know this exactly but it seems that it worked that way). So new instalation of Fedora 18 formated all partitions on SSD and fresh-installed there. It deleted Windows' data on EFI partition also, so Windows couldn't boot at all.

My solution

I wanted grub2 to boot Windows directly. I simply can not work that way. I made menu-entry for grub2; To /etc/grub.d/40_custom I added

menuentry "Windows 8 UEFI" {
insmod part_gpt
insmod fat
insmod search_fs_uuid
insmod chain
search --fs-uuid --no-floppy --set=root **4013-6F8C**
chainloader (${root})/efi/Microsoft/Boot/bootmgfw.efi

4013-6F8C is UUID of my EFI partition (in my case sda1, only one for win and linux). If your system has its own EFI partition for Windows (in default windows EFI has 100MB when linux one has 200MB) use UUID of windows one. I found which of all partitions are EFI with;gdisk -l /dev/sda and gdisk -l /dev/sdb (I found out I have just one EFI partition). Then I needed UUID of sda1. I used grub2-probe -t fs_uuid -d /dev/sda1 to find it. I edited the 40_custom file, saved it and aplyed settings to the grub 2. grub2-mkconfig and then grub2-install (Some systems have scripts to apply grub settings, but I used this method.) After restarting I had menu-entry for windows in grub2 menu, but it didn't boot windows, because bootmgfw.efi was missing in the /boot/efi/EFI/Microsoft/Boot folder of sda1. I booted Fedora, mounted windows partition and copied all files from \Windows\Boot\EFI (it contained some locale files en-GB, en-US... and .efi files I was looking for bootmgfw.efi, bootmgr.efi...) to the /boot/efi/EFI/Microsoft/Boot folder at the sda1.

After restart grub2 menu showed Windows option and it booted as charm. Fedora is also booting without any problem. Well there was one problem.. First of the grub2 menu-entry do not want to boot, something with corrupted memory. But it keeps "older" kernels in this case, so I booted older one and it runs. I can wait for new kernel and after update things like this solve itself, or I can uninstall the kernel and try to install it manually again.

Oh.. and one thing.. Try to avoid reinstalling windows boot manager via windows instalation DVD. It just wipe boot sector of disks and in the worst case you will end with non bootable linux and windows. (windows boot manager is not very good at finding any other than MS OS, so it will not boot neither linux nor chainboot it via grub)

I will be very happy, if this helped someone a bit. Have a nice day.