Ask Your Question
1

Windows 8.1 missing from grub2 menu after installing Fedora 21

asked 2015-01-19 14:21:41 -0500

jolaem gravatar image

updated 2015-01-19 20:11:47 -0500

mether gravatar image

I attempted dual boot with Fedora 21 and Windows 7, then Windows 8. I tried both combinations, the only stable one was installing Fedora 21 first and then Windows 8.1, in which case Windows install its bootloader and no grub menu was available, however I was able to boot into Fedora from BIOS menu.

It was quite inconvenient as I use Fedora mainly, so I attempted installing Fedora 21 after installing Windows 8.1, and as exptected it boots to Fedora now through grub2, but no entries for Windows 8.1. I tried couple of solutions from the web, including adding 15_Windows file into /etc/grub.d/ directory, as well as adding entries to /etc/grub.d/40_custom, but nothing worked. The last solution (adding entries to /etc/grub.d/40_custom) resulted in grub2 entry for Windows 8, but nothing happens at all after chosing this option.

The output of my fdisk -l:

Device          Start        End    Sectors   Size Type
/dev/sda1        2048     411647     409600   200M EFI System
/dev/sda2      411648    1435647    1024000   500M Linux filesystem
/dev/sda3     1435648   17688575   16252928   7.8G Linux swap
/dev/sda4    17688576  122546175  104857600    50G Linux filesystem
/dev/sda5   122546176 1253017599 1130471424 539.1G Linux filesystem
/dev/sda6  1253017600 1465147391  212129792 101.2G Microsoft basic data

/etc/grub.d/40_custom content:

> cat /etc/grub.d/40_custom 
#!/bin/sh
exec tail -n +3 $0
# 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.
menuentry 'Microsoft Windows 8' { set root=(hd0,gpt6) chainloader /EFI/Microsoft/Boot/bootmgfw.efi boot }

Has anyone managed to dual boot Fedora 21? Is there any other way to fix this problem? Thanks a lot for any help!

edit retag flag offensive close merge delete

4 Answers

Sort by » oldest newest most voted
1

answered 2015-01-21 12:47:54 -0500

jolaem gravatar image

Okay, fixed it.

First, created a new directory in /boot/efi/EFI/ called Microsoft/Boot/. Then mounted partition with Windows, in my case /dev/sda6 and copied all the files from \Windows\Boot\EFI\ to newly created /boot/efi/EFI/Microsoft/Boot. My /etc/grub.d/40_custom file was at the point pointing to gpt1, as it is my only EFI partition.

menuentry 'Microsoft Windows 8.1' {
set root='hd0,gpt1'
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
boot
}

Reconfigured grub2 running grub2-mkconfig command, however pointing to grub.cfg in fedora directory NOT in BOOT directory:

sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

After rebooting, grub2 was no longer complaining about missing bootmgfw.efi file, as it was copied to Microsoft/Boot . Instead it displayed a screen ( https://drive.google.com/file/d/0Bzbnjqa0kO6LRXBVSmc3TC1yNFZKRzdzdGpOc0JXTEZfbjRB/view?usp=sharing ) complaining:

The Boot Configuration Data for your PC is missing or contains errors.

The screen also suggested to use Windows Live DVD/USB 'Repair' option. I was concerned that it may wipe out grub2 settings, however it didn't. After repair, I got grub2 menu on reboot and after choosing Windows 8.1 entry it still failed, so the next step is important!

I booted back to Fedora 21 and reconfigured grub2 again with

sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

During the run it printed out that it found Windows 8.1 bootloader. After reboot, there was a new grub2 entry for Windows bootloader (so I had two at that point). Turns out it was safe to remove all the entries from /etc/grub.d/40_custom and after reconfigure it still worked. I don't exactly understand what the Windows Repair has changed, but apparently grub2 was now able to find Windows bootloader regardless of the 40_custom file.

I hope that helps if anyone encounters similar issues!

edit flag offensive delete link more

Comments

I created Microsof/Boot when I'm trying to copy the files I'm getting this "The folder “EFI” cannot be copied because you do not have permissions to create it in the destination."

Sir Tmw gravatar imageSir Tmw ( 2015-02-27 05:06:17 -0500 )edit

Sir Tmw, sounds like permission problem. Try with sudo chown

jolaem gravatar imagejolaem ( 2015-04-15 05:29:28 -0500 )edit

This solved an issue I was having earlier this month. Just out of curiosity, I checked the /boot/efi/EFI/Microsoft/Boot folder and the Windows automated repair seemed to have added two folders, named BCD and BCD.log.

Fman1257 gravatar imageFman1257 ( 2015-05-26 19:09:06 -0500 )edit

Thanks a lot! I tried twice to work it out but it worked with Win10.

Danielson Júnior gravatar imageDanielson Júnior ( 2016-01-19 22:44:17 -0500 )edit
1

answered 2015-01-19 18:25:05 -0500

cgonz31 gravatar image

During the F21 installation you used the existing EFI System Partition (ESP) created by W8.1 (/dev/sda1), right? This means F21 installed its EFI bootloader in dev/sda1 alongside the W8.1 EFI bootloader.

There is nothing wrong with this. Now that GRUB2 boots by default, the next step is to add W8.1 to GRUB2. You did this with the addition to /etc/grub.d/40_custom. But it should point to the ESP (not /dev/sda6 like you have it now). There may also be some issues with formatting. I'm not entirely sure that your formatting is wrong but your /etc/grub.d/40_custom should look like this:

#!/bin/sh
exec tail -n +3 $0
# 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.
menuentry 'Microsoft Windows 8.1' {
set root='hd0,gpt1'
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
boot
}

Then run sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg to update GRUB2.

edit flag offensive delete link more

Comments

Thanks for your reply.

Not quite, I let Fedora set up the partitions, only I chose standard partitioning instead of LVM, hence Windows is on /dev/sda6.

/boot/efi was installed on /dev/sda1 and /boot on /dev/sda2, rest of the partitions is root, swap and /home.

I tried your 40_custom version of the file and indeed, it gives me an entry in the grub2 menu, however it returns error complaining that file /EFI/Microsoft/Boot/bootmgfw.efi doens't exist and that I need to load the kernels first.

jolaem gravatar imagejolaem ( 2015-01-20 09:18:49 -0500 )edit

Odd. It's a long shot but with the same /etc/grub.d/40_custom format I gave you, try changing the set root line to point to your W8.1 partition like you had it before. So the line should look like this: set root='hd0,gpt6'.

If this does not work, leave the set root line pointing to gpt6 and change the chainloader line to this: chainloader /Windows/Boot/EFI/bootmgfw.efi

cgonz31 gravatar imagecgonz31 ( 2015-01-20 16:24:01 -0500 )edit

Thanks for your reply.

I tried both with different partition (gpt6) keeping the same format as you suggested. I also tried changing the chainloader path to what you suggested. I updated the grub2 after that and made sure it was updated by looking into /boot/efi/EFI/fedora/grub.cfg, which had the new version of 40_custom file. Both no luck, I get the same result complaining about no file /Windows/Boot/EFI/bootmgfw.efi

I could try re-installing everything again, but the problem is that Fedora requires creating /boot/efi, even though Win already created its boot partition. Any suggestions?

jolaem gravatar imagejolaem ( 2015-01-21 08:02:49 -0500 )edit

So I played around it a bit more and here's an update. I followed this post and copied files from /Windows/Boot/EFI/* to newly created /boot/efi/EFI/Microsoft/Boot and changed the 40_custom file to point to /boot/efi/EFI/Microsoft/Boot on gpt1. This has worked roughly and I got this: https://drive.google.com/file/d/0Bzbnjqa0kO6LRXBVSmc3TC1yNFZKRzdzdGpOc0JXTEZfbjRB/view?usp=sharing

jolaem gravatar imagejolaem ( 2015-01-21 11:19:18 -0500 )edit
0

answered 2015-01-23 16:49:41 -0500

I had the same issue with fedora 21 and windows 8 disappearing from grub. Mounting the windows partition and manually copying the files to correct directory restored my ability to boot into windows. Thanks very much for your sleuthing! Id upvote it but I dont have enough points.

edit flag offensive delete link more

Comments

how to do that please guide me thanks

Sir Tmw gravatar imageSir Tmw ( 2015-02-27 02:05:57 -0500 )edit
0

answered 2015-02-27 02:04:40 -0500

Please help I am totally new in linux, last night I installed fedora 21 x64 on windows disk and from that time I'm having exactly same problem. please guide me from the beginning. I never done it before.

edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2015-01-19 14:21:41 -0500

Seen: 20,099 times

Last updated: Feb 27 '15