Bug 986731

Summary: Dual boot of uefi Windows 7 and Fedora 19 fails to boot Windows
Product: [Fedora] Fedora Reporter: Greta Watson <greta_watson>
Component: grub2Assignee: Peter Jones <pjones>
Status: CLOSED INSUFFICIENT_DATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: awilliam, bcl, dan, dennis, gibsg2510, hedayatv, jdines, KleiserDominik, kparal, loganjerry, lonelywoolf, mads, pjones, restekker, robatino, shigorin, slick, solomonsunder, the.ridikulus.rat
Target Milestone: ---Keywords: CommonBugs
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: https://fedoraproject.org/wiki/Common_F21_bugs#uefi-windows-dual RejectedBlocker
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-05-29 16:08:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Greta Watson 2013-07-22 00:33:16 UTC
Description of problem:
UEFI Windows 7 installation on disk 1 (sda) went well.
UEFI installation of Fedora 19 on disk 2 went well.
  Custom disk partitioning:
    /boot/efi on /dev/sdb1
    /         on /dev/sdb2
    swap      on /dev/sdb3
    /home     on /dev/sdb4
Running: sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
  resulted in entries for fedora, and for Windows 7:
    Found Windows Boot Manager on Microsoft/Boot/bootmgfw.efi

Fedora boots each time, without problem.

However, if I select the Windows entry on the boot screen, I get an error message:
error: /EFI/Microsoft/Boot/bootmgfw.efi not found.

So, I cannot boot Windows 7 from the grub2 boot menu.  The only way I can boot Windows 7 is to enter the boot order menu before the grub2 menu comes on the screen, and select the disk on which Windows resides.  It then boots fine.  On my machine, the boot order can be selected by pressing F8 as soon as the ASUS logo appears.

Version-Release number of selected component (if applicable):
Fedora 19 

Expected results:  ability to boot Fedora or Windows from the grub2 menu.


Additional info:  The grub2 boot menu is not graphical, no matter if I install starfield or not.  Doubt it's related, though.

Comment 1 Greta Watson 2013-07-22 18:26:52 UTC
In addition to the desktop described above, I have a laptop that also runs a dual boot, Windows 7 and Fedora 19.  It does not use UEFI.  Windows can be selected and started from its grub2 menu.  Also on the laptop, the grub2 splash screen does not work.

Comment 2 Greta Watson 2013-09-21 23:40:08 UTC
By searching the internet, looking at grub files on the desktop and on the laptop, and modifying grub files on the desktop, I have been able to get a grub boot menu that will actually allow me to boot either Fedora or Windows 7, both efi installations.  However, when I select Windows, I get the following before it boots into Windows:
/EndEntire
file path: /ACPI(a0341d0,0)/PCI(2,1f)/)UnknownMessaging(12)
/HD(1,800,32000,950e88571f64e74a,b5,8f)/File(\EFI\Microsoft\Boot)
/File(bootmgfw.efi)/EndEntire

Here's what I did, as root:
1.  cat GRUB_DISABLE_OS_PROBER="true" >> /etc/default/grub
2.  mount -t vfat /dev/sda1 /mnt/winboot
    grub2-probe \
      --target=hints_string /mnt/winboot/EFI/Microsoft/Boot/bootmgfw.efi
(output is:  --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1)
3.  create an entry in /etc/grub.d/40_custom, where EA39-C50F is the UUID of /dev/sda1:
	menuentry 'Microsoft Windows 7' {
	    insmod part_gpt
	    insmod fat
	    insmod search_fs_uuid
	    insmod chain
	    search --fs-uuid --no-floppy --set=root <output from #2> EA39-C50F
	    chainloader /EFI/Microsoft/Boot/bootmgfw.efi
	}
4. grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

Most of what's in #3 came from a webpage on dual booting Ubuntu and Windows 8.  I don't know if the insmod lines are appropriate for fedora 19.

Comment 3 Mads Kiilerich 2013-09-22 19:24:38 UTC
What is the output of "os-prober"?

What do the entries created without GRUB_DISABLE_OS_PROBER look like?

Comment 4 Greta Watson 2013-09-22 19:44:22 UTC
If the GRUB_DISABLE_OS_PROBER line is removed from /etc/default/grub, then the non-working entry below is the output of os-prober:

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows Boot Manager' {
          chainloader /EFI/Microsoft/Boot/bootmgfw.efi
          boot
}
### END /etc/grub.d/30_os-prober ###

A message is output that the file can't be found, and one ends up back in the boot menu.

Comment 5 Mads Kiilerich 2013-09-22 19:56:44 UTC
What is the output of "os-prober"?

Is every single of the new lines necessary?

Comment 6 Greta Watson 2013-09-22 20:22:51 UTC
Comment 4 provides the output from os-prober as seen in /boot/efi/EFI/Fedora/grub.cfg.  If os-prober is run from the command line, as root, it produces the following output:
Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows

I don't know which lines in 40_custom are actually necessary.  As I said in comment 2, most of what's in the file was taken from the internet, and applies to Ubuntu and Windows 8.  What I know is that it worked for me, but produced an unexpected message.

I'm hoping someone can tell me how to eliminate the message, and what lines are actually necessary in 40_custom for Fedora and Windows 7.

Comment 7 Mads Kiilerich 2013-09-22 21:38:18 UTC
Hedayat, FYI, this seems to be a pretty clear case where os-prober doesn't provide enough information to let grub2-mkconfig do the right thing ... but where there also is no way it could have done it the way grub2-mkconfig is and with the "API" to os-prober.

Comment 8 Greta Watson 2013-09-22 21:54:52 UTC
During the last hour, I've been paring down what I put in the 40_custom file, and then rebooting into Windows.

This is the smallest entry appended to 40_custom, that works.  It still gives the message (/EndEntire ... /EndEntire).

menuentry 'Microsoft Windows 7' {
    search --fs-uuid --no-floppy --set=root EA39-C50F
    chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}

EA39-C50F is the UUID of the hard drive partition containing /EFI/Microsoft/Boot/bootmgfw.efi.

Comment 9 Hedayat Vatankhah 2013-09-22 22:02:07 UTC
Isn't this bug related to bug #873207 , which I fixed but was reverted since the syntax wasn't supported in grub2? TBH, I forgot about it (and I was upset because of the revert). 

Please check comment #50 and see if it provides the needed information.

Since Fedora 19 release is over, I'll re-apply the patch and push updated os-prober packages to repos.

Comment 10 Mads Kiilerich 2013-09-22 22:35:54 UTC
(In reply to Greta Watson from comment #8)
> This is the smallest entry appended to 40_custom, that works.

Thank you. That makes it clear what the problem is - and that no other problems are interfering.

(In reply to Hedayat Vatankhah from comment #9)
> Isn't this bug related to bug #873207

Related, yes. But not the same.

> Since Fedora 19 release is over, I'll re-apply the patch and push updated
> os-prober packages to repos.

If grub is ready to handle it, fine. But please don't break it - make sure it is ready.

Comment 11 Hedayat Vatankhah 2013-09-23 07:06:05 UTC
Will this bug be fixed (os-prober side) with the same solution? It seems that the only missing item is the partition, which is provided by the fix in the other bug. 

OK, I'll wait. But if the current UEFI entries for grub2 are not bootable, applying the fix should not make things worse anyway?! 

I hope grub will support the new syntax very soon.

Comment 12 Pedro Francisco 2013-10-28 17:33:47 UTC
This bug still happens in Fedora 20 when using two different EFS.

Comment 13 Hedayat Vatankhah 2013-11-23 09:22:43 UTC
Just a note: the os-prober bug was a Fedora bug, so os-prober in other distros already print the output which I fixed in the pending patch. So, while grub2 is not "READY", all distros are broken. The current os-prober output is unique to Fedora. I wonder how upstream grub2 is ignoring this bug completely.

Comment 14 Dan Scott 2013-12-13 14:48:30 UTC
Confirming that this still happens in Fedora 20 (in my case, on a fresh Lenovo T440s, UEFI secure boot, Windows 8, all on sda drive). Tagging as a CommonBug as I believe newer hardware is going to make this more common.

Comment 15 Pedro Francisco 2013-12-13 14:54:42 UTC
Comment 14: Are you using one EFS / EFI partition?

I still have this bug but I have two EFS / EFI partitions.

Comment 16 Dan Scott 2013-12-13 16:11:49 UTC
(In reply to Pedro Francisco from comment #15)
> Comment 14: Are you using one EFS / EFI partition?

Looks like a single EFS / EFI partition:

From 'fdisk -l':

Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 1E5A1267-A9B1-481C-B92B-79A94FC34F4A

Device           Start          End   Size Type
/dev/sda1         2048      2050047  1000M Windows recovery environment
/dev/sda2      2050048      2582527   260M EFI System
/dev/sda3      2582528      2844671   128M Microsoft reserved
/dev/sda4      2844672    198850559  93.5G Microsoft basic data
/dev/sda5    950480896    951197695   350M Windows recovery environment
/dev/sda6    951197696    976773119  12.2G Windows recovery environment
/dev/sda7    198850560    199874559   500M Microsoft basic data
/dev/sda8    199874560    950480895 357.9G Microsoft basic data

From "df -h":

Filesystem                          Size  Used Avail Use% Mounted on
/dev/mapper/fedora_feddenials-root   50G  4.2G   43G   9% /
devtmpfs                            5.9G     0  5.9G   0% /dev
tmpfs                               5.9G  376K  5.9G   1% /dev/shm
tmpfs                               5.9G  1.3M  5.9G   1% /run
tmpfs                               5.9G     0  5.9G   0% /sys/fs/cgroup
tmpfs                               5.9G  156K  5.9G   1% /tmp
/dev/sda7                           477M   73M  376M  17% /boot
/dev/sda2                           256M   61M  196M  24% /boot/efi
/dev/mapper/fedora_feddenials-home  300G  127G  158G  45% /home

And from "ls /boot/efi/EFI":

Boot  fedora  Lenovo  Microsoft

Let me know if there's anything else you want / need :)

Comment 17 Dan Scott 2013-12-16 15:29:02 UTC
Here's a stab at supplying the CommonBugs info for the wiki page:

CommonBugs title: Dual-booting from native UEFI mode to a previously existing OS such as Windows 8 from the GRUB menu may fail.

CommonBugs summary: While the Anaconda installer can successfully shrink an existing partition and install Fedora 20 in native UEFI mode, and the GRUB boot menu lists both the new Fedora 20 installation and the previously existing OS, attempting to boot the previously existing OS may fail consistently. The reason for this failure is because os-prober currently fails to set the correct boot options for the previously existing OS in the GRUB menu.

Known workarounds: You may be able to use your system's native UEFI boot menu to boot the previously existing OS directly. The native UEFI boot menu is often accessible at reboot time by interrupting the boot process and choosing to boot from a different device.

You may be able to manually edit the GRUB configuration to supply the parameters required to boot the previously existing OS.

Assessment of impact on Fedora users: As more Fedora users adopt UEFI-capable systems and install in UEFI mode, this is likely to become a more common install error.

Comment 18 Michael Shigorin 2014-01-10 17:50:07 UTC
(In reply to Greta Watson from comment #2)
> [...] I have been able to get a grub boot menu that will actually
> allow me to boot either Fedora or Windows 7, both efi installations.
> However, when I select Windows, I get the following before it boots
> into Windows:
But it does boot eventually?  Is SecureBoot enabled, disabled or unavailable?

> /EndEntire
> file path: /ACPI(a0341d0,0)/PCI(2,1f)/)UnknownMessaging(12)
> /HD(1,800,32000,950e88571f64e74a,b5,8f)/File(\EFI\Microsoft\Boot)
> /File(bootmgfw.efi)/EndEntire
I get the same (only HD parameters differ) *but* with one more line:

error: cannot load image

with ALT Linux 7.0.2 releases when SecureBoot is enabled; disabling it allows to chainload bootmgfw.efi just fine (os-prober-1.61-alt1 and grub2-2.00-alt20 result in a snippet that is virtually identical to your 40_custom one).

This error is fatal as in "any keypress or timeout returns to boot menu (or entry editor)".

> Most of what's in #3 came from a webpage on dual booting Ubuntu and Windows
Not sure if these two are related directly or being a next (SB chainload) problem but just in case...

Here's the corresponding Ubuntu bug regarding grub2:
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1091464

Here's the ALT Linux one just in case (in Russian; SB-only problem):
https://bugzilla.altlinux.org/show_bug.cgi?id=29705

I haven't seen anything regarding openSUSE, hope to test myself.

(In reply to Hedayat Vatankhah from comment #13)
> I wonder how upstream grub2 is ignoring this bug completely.
Erm, http://git.savannah.gnu.org/gitweb/?p=grub.git;a=commitdiff;h=fba31b5f69f955dc6e7041a80de52979403a1042 is all I see so far.

Comment 19 Greta Watson 2014-01-10 22:07:09 UTC
The advanced boot section of the UEFI menu states that secure boot is enabled, platform key (PK) state is unloaded, and OS type is Other OS.  There does not seem to be a way to alter secure boot status.

Windows boots fine after the 4-line message has been on the screen a couple of seconds.

Comment 20 Matt Maggio 2014-01-28 06:21:29 UTC
I am confirming this happens to me as well, just as Greta described it. Machine began with Windows 8.1 on a SSD drive. Fedora was installed to the machine's HDD with the EFI bootloader on the SSD.

Using grub, Fedora boots fine, but booting Windows first shows the 4 line message for 3-4 seconds then continues to boot successfully into Windows. Secure Boot is enabled.

This is on a Gigabyte P34G.

Comment 21 Jim Dines 2014-08-11 19:10:14 UTC
I have the same problem on a Lenovo Yoga 2 11 with Windows 8

Adding:

set root='(hd0, 2)'

... to /boot/grub2/grub.cfg solves the issue.

My drive is Partitioned as follows:

[root@fireball grub.d]# fdisk -l /dev/sda

Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 498EE8A2-F8FE-4D64-B035-1A8ED2D4C1CE

Device           Start          End   Size Type
/dev/sda1         2048      2050047  1000M Windows recovery environment
/dev/sda2      2050048      2582527   260M EFI System
/dev/sda3      2582528      4630527  1000M unknown
/dev/sda4      4630528      4892671   128M Microsoft reserved
/dev/sda5      4892672    236165119 110.3G Microsoft basic data
/dev/sda6    901834752    954263551    25G Microsoft basic data
/dev/sda7    954263552    976773119  10.8G Windows recovery environment
/dev/sda8    236165120    237189119   500M Microsoft basic data
/dev/sda9    237189120    901834751   317G Linux LVM

Note:

I also added insmods which may not be needed, but it works now and I don't have time to investigate further :-(

menuentry 'Windows Boot Manager' {
          insmod part_gpt
          insmod chain
          insmod ntfs
          set root='(hd0, 2)'
          chainloader /EFI/Microsoft/Boot/bootmgfw.efi
          boot
}

Comment 22 Frank 2014-09-14 14:43:17 UTC
I'm not sure if this warrants a separate bug report or not, but I'm having a similar problem. Like Greta, both my Windows 7 and Fedora installations go smoothly. When I turn on my computer \grub gives me the option of using Fedora or the Windows Boot Manager. I can boot into Fedora no problem UNTIL I choose to boot into Windows once. If I select Windows just once, it seems as though Grub is overwritten and I can never go back into Fedora, I can only go straight into Windows.

I should probably note that my computer was originally a Windows 8 machine which I downgraded to Windows 7, so it does have UEFI. However, I turned that off in the BIOS and so it should be able to boot.

Comment 23 Hedayat Vatankhah 2014-09-14 15:54:11 UTC
This seems to be completely unrelated to this bug. And actually, it doesn't seem to be a Fedora bug at all. You should probably disable something in your Windows OS.

Comment 24 Frank 2014-09-14 18:58:03 UTC
(In reply to Hedayat Vatankhah from comment #23)
> This seems to be completely unrelated to this bug. And actually, it doesn't
> seem to be a Fedora bug at all. You should probably disable something in
> your Windows OS.

I'm pretty sure everything in Windows is ok. Could you tell me what settings in Windows might be causing this?

Comment 25 Hedayat Vatankhah 2014-09-14 20:13:38 UTC
Nothing in Windows itself, but usually there are some 'protector' applications installed which would overwrite boot loader if it is changed! Specially if you've installed vendor provided software suit, it is very likely that they've provided such software to make sure that your machine always boot Windows successfully!

Anyway, you got problems when you boot Windows; so there is nothing wrong with Fedora/grub!

Comment 26 Adam Williamson 2014-09-22 18:56:06 UTC
Frank: it's also something that OEMs sometimes customize at the Windows or firmware level, though entirely *deleting* alternative boot entries is very rude.

If you have an option to just do a UEFI boot from the hard disk in question, that might work to make Fedora boot, as what it'll really do is hit the fallback boot path, which Fedora takes over when you install it. Recent Fedora will even re-generate its efibootmgr entry when booted via the fallback path.

Comment 27 Adam Williamson 2014-09-22 19:11:20 UTC
added to F20 and F21 commonbugs.

Comment 28 lonelywoolf 2014-09-23 16:29:09 UTC
I have similar issue, but oly with secureboot enabled. See bug 1144657

Comment 29 lonelywoolf 2014-09-23 16:37:46 UTC
(In reply to Dan Scott from comment #14)
> Confirming that this still happens in Fedora 20 (in my case, on a fresh
> Lenovo T440s, UEFI secure boot, Windows 8, all on sda drive). Tagging as a
> CommonBug as I believe newer hardware is going to make this more common.

When I diasbling secureboot all booting as expected. Try it.

Comment 30 Dan Scott 2014-09-23 16:52:28 UTC
(In reply to lonelywoolf from comment #29)
> (In reply to Dan Scott from comment #14)
> > Confirming that this still happens in Fedora 20 (in my case, on a fresh
> > Lenovo T440s, UEFI secure boot, Windows 8, all on sda drive). Tagging as a
> > CommonBug as I believe newer hardware is going to make this more common.
> 
> When I diasbling secureboot all booting as expected. Try it.

Err, no. I expect to be able to keep secure boot enabled. If that's a limitation, it should be clearly documented as such.

Comment 31 lonelywoolf 2014-09-23 16:59:09 UTC
But yor system botting properly with seccureboot disabled? If so, May be problem with signing keys?

Comment 32 Solomon Sunder 2014-10-23 14:25:33 UTC
I have the same problem on my Lenove S540 Touch laptop. Also the installer (ananconda?) does not detect Windows as an OS while trying to partition. It would be better if it showed up the Windows OS and data partitions too. These issues are present in CentOS as well.

Comment 33 Adam Williamson 2014-10-25 14:27:50 UTC
solomon: not detecting your Windows install for the custom partitioning screen sounds like a different bug to this one, if you could report it separately that might be useful - thanks! file it against anaconda, and include the log files from /tmp while the installer is running, especially /tmp/storage.log and /tmp/program.log .

Comment 34 Adam Williamson 2014-11-03 23:48:18 UTC
I believe this is appropriate to nominate as an F21 final release blocker under https://fedoraproject.org/wiki/Fedora_21_Final_Release_Criteria#Windows_dual_boot :

"The installer must be able to install into free space alongside an existing clean Windows installation and install a bootloader which can boot into both Windows and Fedora."

Comment 35 Kamil Páral 2014-11-05 18:54:05 UTC
Discussed at 2014-11-05 blocker review meeting [1]. We decided the punt the decision. This requires some more testing to confirm. Will rediscuss at next meeting.

[1] http://meetbot.fedoraproject.org/fedora-blocker-review/2014-11-05/

Those of you who tested this, can you please state clearly who of you used F21 installer (and which compose)? Do you have a single EFI system partition, or two? And your result is? Thanks.

Comment 36 Kamil Páral 2014-11-06 12:40:23 UTC
I have tested with a clean installation of Windows 8 and Fedora 21 TC1. Everything installed over UEFI with SecureBoot enabled. I also tested a single shared ESP (default anaconda behavior), or a second separate ESP (using manual partitioning). In all cases, everything works absolutely flawlessly. I can boot both systems from grub and from UEFI one-time boot menu. I can toggle SecureBoot on and off and both systems still boot properly.

If you have any problems, please try with a clean Fedora 21 installation. If that doesn't work for some reason, please attach all appropriate log files.

Comment 37 Kamil Páral 2014-11-12 16:43:09 UTC
Discussed at today's blocker review meeting [1]. Rejected as a blocker. This doesn't seem to be reproducible on F21. If it is, please update the bug and reproduce.

[1] http://meetbot.fedoraproject.org/fedora-blocker-review/2014-11-12/

Comment 38 Adam Williamson 2014-12-06 23:12:16 UTC
pjones: do you think we should close this?

Comment 39 Kamil Páral 2014-12-08 09:28:21 UTC
As shown in bug 1170245, on a different machine I could not boot Windows with SecureBoot enabled (even though on a different machine I could). Maybe this bug is also just about SecureBoot issues?

Comment 40 Adam Williamson 2014-12-08 18:37:29 UTC
Given the OP was about Win7 I rather doubt it - Win7 doesn't usually have SB enabled. But I think regardless it's best to just go with 1170245 in that case, I don't think this bug adds any useful data.

Comment 41 Fedora End Of Life 2015-05-29 09:12:29 UTC
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '20'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.