Bug 15507 - grub2-efi puts broken Windows entry into grub.cfg
Summary: grub2-efi puts broken Windows entry into grub.cfg
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: Installer (show other bugs)
Version: Cauldron
Hardware: x86_64 Linux
Priority: Normal major
Target Milestone: ---
Assignee: Barry Jackson
QA Contact:
URL:
Whiteboard:
Keywords: NEEDINFO
: 15497 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-03-17 08:42 CET by w unruh
Modified: 2015-03-19 08:10 CET (History)
2 users (show)

See Also:
Source RPM: grub2, os-prober
CVE:
Status comment:


Attachments
output of tree command in /boot/EFI (7.93 KB, text/plain)
2015-03-18 03:35 CET, w unruh
Details
os-prober output from Mageia (111 bytes, text/plain)
2015-03-18 04:22 CET, w unruh
Details
os-prober output from fedora on same machine (112 bytes, text/plain)
2015-03-18 04:23 CET, w unruh
Details
/etc/grub.d/30_os-prober output on Mageia (2.30 KB, text/plain)
2015-03-18 04:24 CET, w unruh
Details
/etc/grub.d/30_os-prober output on fedora on same machine (4.29 KB, text/plain)
2015-03-18 04:25 CET, w unruh
Details
Output of parted -l (682 bytes, text/plain)
2015-03-18 15:30 CET, Fryderyk Mazurek
Details

Description w unruh 2015-03-17 08:42:46 CET
Description of problem: Installing Mageia 5 beta 3 onto a Dell XPS 13 laptop with EFI and with windows already installed. The entry in grub.cfg was


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

which did not work -- no file found. Instead it should probably have been


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

which does work. 







Reproducible: 

Steps to Reproduce:
Thierry Vignaud 2015-03-17 08:47:25 CET

Assignee: bugsquad => zen25000
Source RPM: (none) => grub2, os-prober

Comment 1 Barry Jackson 2015-03-17 11:23:19 CET
To workaround this until a solution is found you can add:

menuentry 'Windows Boot Manager' {
          chainloader /boot/EFI/EFI/Microsoft/Boot/bootmgfw.efi
          boot
}

to /boot/grub2/custom.cfg

and to remove the bad entry:

EITHER remove the os-prober package:
urpme os-prober

OR if os-prober is needed to find other OSs add this line to /etc/default/grub and run update-grub:

GRUB_OS_PROBER_SKIP_LIST="<uuid of win partition>@/dev/sdaX" (where /dev/sdX is the windows partition)
e.g. GRUB_OS_PROBER_SKIP_LIST="A3F5-6DF3@/dev/sda1"

Not doing the above until this is fixed, will cause your changes to grub.cfg to be overwritten on some system updates.

To be honest I prefer to do the above anyway rather than use os-prober where Windows is involved.
Comment 2 Fryderyk Mazurek 2015-03-17 23:01:29 CET
This is duplicate of #15497.

CC: (none) => dedykjp

Comment 3 Barry Jackson 2015-03-18 01:30:10 CET
(In reply to Fryderyk Mazurek from comment #2)
> This is duplicate of #15497.

I would say not, since this appears to be related to the path, whereas 15497 seems to require modules not already loaded.
Comment 4 Barry Jackson 2015-03-18 01:49:06 CET
(In reply to w unruh from comment #0)
> Description of problem: Installing Mageia 5 beta 3 onto a Dell XPS 13 laptop
> with EFI and with windows already installed. The entry in grub.cfg was
> 
> 
> ### BEGIN /etc/grub.d/30_os-prober ###
> menuentry 'Windows Boot Manager' {
>           chainloader /EFI/Microsoft/Boot/bootmgfw.efi
>           boot
> }
> 
> which did not work -- no file found. Instead it should probably have been
> 
> 
> ### BEGIN /etc/grub.d/30_os-prober ###
> menuentry 'Windows Boot Manager' {
>           chainloader /boot/EFI/EFI/Microsoft/Boot/bootmgfw.efi
>           boot
> }
> 
> which does work. 

What version of Windows is this?

Please run the following commands in Mageia and copy paste the tree produced
at the end into a reply here.

su
cd /boot/EFI
rpm -q tree || urpmi tree && tree

Thanks

Keywords: (none) => NEEDINFO

Comment 5 w unruh 2015-03-18 03:34:42 CET
It does sound similar to 15497, just the solutions are very different. 
I found that changing the path worked, 14597 found that changing the preamble to tell grub to look in /dev/sda1 for the file worked. Both seem solutions, although I cannot imagine how mine could work:-(

Anyway, Windows 8.1
Comment 6 w unruh 2015-03-18 03:35:45 CET
Created attachment 6076 [details]
output of tree command in /boot/EFI
Comment 7 w unruh 2015-03-18 04:22:14 CET
Created attachment 6077 [details]
os-prober output from Mageia
Comment 8 w unruh 2015-03-18 04:23:07 CET
Created attachment 6078 [details]
os-prober output from fedora on same machine
Comment 9 w unruh 2015-03-18 04:24:11 CET
Created attachment 6079 [details]
/etc/grub.d/30_os-prober output on Mageia
Comment 10 w unruh 2015-03-18 04:25:27 CET
Created attachment 6080 [details]
/etc/grub.d/30_os-prober output on fedora on same machine
Comment 11 w unruh 2015-03-18 04:29:27 CET
To try to help, I have included both the os-prober and /etc/grub.d/30_os-prober
on both Mageia 5 B3 and Fedora 21 on same machine. (They reside in two different partitions.) 
If you want the 30_os-prober script from fedora I could supply that as well.
Comment 12 w unruh 2015-03-18 04:35:18 CET
That probably would not tell anything since the output for the windows section is the same if I run /etc/grub.d/30_os-prober of /fedora/etc/grub.d/30_os-prober on Mageia. Ie, the differences if any in the scripts seem to make no difference.
Comment 13 Fryderyk Mazurek 2015-03-18 08:16:58 CET
*** Bug 15497 has been marked as a duplicate of this bug. ***
Comment 14 Fryderyk Mazurek 2015-03-18 08:30:34 CET
A solution:

menuentry 'Windows Boot Manager' {
          chainloader /boot/EFI/EFI/Microsoft/Boot/bootmgfw.efi
          boot
}

doesn't work to me to fix https://bugs.mageia.org/show_bug.cgi?id=15497 .
Barry Jackson 2015-03-18 13:15:09 CET

Summary: grub2-efi puts wrong Windows file path into grub.conf => grub2-efi puts broken Windows entry into grub.cfg

Comment 15 Marja Van Waes 2015-03-18 15:10:46 CET
(In reply to Fryderyk Mazurek from comment #14)
> A solution:
> 
> menuentry 'Windows Boot Manager' {
>           chainloader /boot/EFI/EFI/Microsoft/Boot/bootmgfw.efi
>           boot
> }
> 
> doesn't work to me to fix https://bugs.mageia.org/show_bug.cgi?id=15497 .

do you maybe have more than one EFI partition?
(you can check by running "parted -l" as root)

CC: (none) => marja11

Comment 16 Fryderyk Mazurek 2015-03-18 15:29:54 CET
I have only one EFI partition.
Comment 17 Fryderyk Mazurek 2015-03-18 15:30:23 CET
Created attachment 6083 [details]
Output of parted -l
Comment 18 Barry Jackson 2015-03-18 16:10:07 CET
(In reply to w unruh from comment #12)
> That probably would not tell anything since the output for the windows
> section is the same if I run /etc/grub.d/30_os-prober of
> /fedora/etc/grub.d/30_os-prober on Mageia. Ie, the differences if any in the
> scripts seem to make no difference.
Thanks for your work on this, you are right there is no difference in the Fedora  30_os-prober script, except for one unrelated patch that we don't need. It's looking more likely that this one is down to os-prober.
Comment 19 Barry Jackson 2015-03-18 17:03:53 CET
Could you both please test with os-prober-1.65-1.mga5 which will appear on the mirrors soon in the cauldron core/updates_testing repo.

Enable and update the repo, then install os-prober and *Don't forget* to disable that repo afterwards.

Simply installing the package will update your grub.cfg.

This version has several new patches from Fedora, and could explain the differences we are seeing.

Thanks,

Barry
Comment 20 w unruh 2015-03-18 17:20:42 CET
I ran some tests last night. Unlike my statement above, the Fedora and the Mageia output from os-prober IS different on the two distros. The Mageia output of os-prober is Microsoft/Boot/... while that on fedora is /dev/sda1@EFI/Microsoft/Boot

Strangly the output of
 /lib/os-prober/mounted/50_efi /dev/sda1 /boot/EFI vfat
 on Mageia is (after about 6 errors in the "error()" function) contains that 
/dev/sda1@ preamble. It would seem that it is stripped off by something.

I will try the patched version. I presume I can just download the patched os-prober package and install via rpm, rather than using urpmi.
Comment 21 w unruh 2015-03-18 17:52:03 CET
Woops. Memory.
Here is the Fedora (on fedora) output 
/dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows:efi
and here is the Mageia output
Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows

Here is the Fedora output on fedora from 
/usr/libexec/os-prober/mounted/05efi /dev/sda1 /boot/efi vfat
/dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows5:efi
 
and the Mageia  output on Mageia of
 /usr/lib/os-prober/mounted/05efi /dev/sda1 /boot/efi vfat
/dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows5:efi

Ie, the output of that probe is identical. Somewhere along the line Mageia is stripping off that /dev/sda1@/EFI/ from the head of that output in producing the output from os-prober. I cannot exactly figure out where that is happening. 

(This is still the old version of os-prober)
Comment 22 w unruh 2015-03-18 17:58:41 CET
Just installed the new version of os-prober and it has created a windows entry that looks much more reasonable.

menuentry 'Windows Boot Manager (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-efi-E463-1429' {
        insmod part_gpt
        insmod fat
        set root='hd0,gpt1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  E463-1429
        else
          search --no-floppy --fs-uuid --set=root E463-1429
        fi
        chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
Comment 23 Barry Jackson 2015-03-18 18:30:02 CET
(In reply to w unruh from comment #22)
> Just installed the new version of os-prober and it has created a windows
> entry that looks much more reasonable.

Good - does it boot Windows?
Comment 24 Fryderyk Mazurek 2015-03-18 18:41:24 CET
New version of os-prober completely resolved my issue. Now in VirtualBox and in real UEFI machine I can boot to windows.
Comment 25 Barry Jackson 2015-03-18 18:49:22 CET
 (In reply to Fryderyk Mazurek from comment #24)
> New version of os-prober completely resolved my issue. Now in VirtualBox and
> in real UEFI machine I can boot to windows.

\o/ Excellent 
Please also look out for any regressions booting Linuxes.

I have VM tested this in EFI VBox with multiple Mageia installs and also on my real hardware with PC BIOS and also btrfs with no issues, so looking good.

Lets see how w unruh get on booting Win.

Thanks for your help testing.
Comment 26 Marja Van Waes 2015-03-18 21:52:28 CET
(In reply to Barry Jackson from comment #25)
>  (In reply to Fryderyk Mazurek from comment #24)
> > New version of os-prober completely resolved my issue. Now in VirtualBox and
> > in real UEFI machine I can boot to windows.
> 
> \o/ Excellent 
> Please also look out for any regressions booting Linuxes.
> 

On real hw, booting into Windows from the GRUB2-efi bootloader works fine by default, too, now.

I see no regressions when booting (only Mageia) Linuxes on the same laptop, only issues that already existed (a  minor grub one that I don't care about, and a dracut one that already has a bug report).
Comment 27 w unruh 2015-03-19 06:32:29 CET
Yup. Seems to work. Booted into both Windows and into Fedora from the Mageia EFI grub menu. And works into Mageia as well. So I think this can regarded as solved.
Comment 28 Marja Van Waes 2015-03-19 08:10:07 CET
Thx unruh :-)

os-prober-1.65-2.mga5 was pushed to core/release over 9 hours ago, so should have landed on all mirrors

Status: NEW => RESOLVED
Resolution: (none) => FIXED


Note You need to log in before you can comment on or make changes to this bug.