Bug#698914: grub-efi booting Windows 8 in UEFI mode

Drasko DRASKOVIC drasko.draskovic at gmail.com
Wed Apr 24 15:11:16 UTC 2013


Hi all,
I experienced similar problem on an ASUS X20E1 with pre-installed
Windows 8 image and UEFI.

I used Wheezy RC1 netinst image fetched from the site and dd-ed to the
USB stick.

In order to install Debian I had to turn off Secure Boot in ASUS UEFI
menu. After I checked if Windows 8 still boots with Secure Boot turned
off and it was OK, so I proceeded with Debian installation.

Once installed, Debian could boot, but Windows 8 no, because Grub menu
entries produced by `od-prober` were wrong. Here are the entries :

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows Recovery Environment (loader) (on /dev/sda2)"
--class windows --class os {
	insmod part_gpt
	insmod ntfs
	set root='(hd0,gpt2)'
	search --no-floppy --fs-uuid --set=root F0A837FBA837BF42
	drivemap -s (hd0) ${root}
	chainloader +1
}
menuentry "Windows 8 (loader) (on /dev/sda4)" --class windows --class os {
	insmod part_gpt
	insmod ntfs
	set root='(hd0,gpt4)'
	search --no-floppy --fs-uuid --set=root 86B23B6FB23B633B
	drivemap -s (hd0) ${root}
	chainloader +1
}
### END /etc/grub.d/30_os-prober ###

Trying to boot these will fail, as bootloader will complain that it
does not recognize "drivemap" directive.

I tried replacing the entries by :

menuentry "Windows (UEFI)" {
   search --set=root --file /EFI/Microsoft/Boot/bootmgfw.efi
   chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}

That helped find `bootmgfw.efi` but went directly into Windows
Recovery blue screen, saying that device is not connected and gving an
error 0xc000000f.

At least this confirms that Windows 8 bootloader was found, but the
way it was executed was wrong.

To confirm that Windows 8 still boots fine after Debian installation,
I changed ASUS UEFI boot menu (i.e. BIOS menu), to boot Windows 8
bootloader directly, and this worked fine, so I deducted that only
Grub path to the Windows 8 bootloader is wrong in the grub.cfg.

Here is a list of my partitions :

root at Mali:/home/drasko# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 465.8G  0 disk
├─sda1   8:1    0   300M  0 part /boot/efi
├─sda2   8:2    0   900M  0 part
├─sda3   8:3    0   128M  0 part
├─sda4   8:4    0  97.5G  0 part
├─sda5   8:5    0  93.1G  0 part /
├─sda6   8:6    0   7.5G  0 part [SWAP]
└─sda7   8:7    0 266.4G  0 part /home

Windows 8 resides on /dev/sda4.

I then tried to mount bot Windows partitions : OS and Recovery and
look for "bootmgfw.efi" file. On Rrcovery partition it is located in
EFI/Microsoft/Boot/bootmgfw.efi, but on OS partition it is located in
Windows/EFI/Boot/bootmgfw.efi (or similar), so I tried replacing
entries by this path, hoping that it will boot Windows in normal mode,
and not give me Recovery screen.

The boot starts but immediately fails, with similar message (only that
Recovery screen is not showed this time). This potentially might work,
maybe some modules were not probed (see below).

Finally, I found that solution escribed here worked fine :
http://falstaff.agner.ch/2012/12/18/ubuntu-12-10-and-windows-8-with-secure-boot-mode/

This script : https://gist.github.com/falstaff84/4330598/raw/adaf598a78d568dbfada596441bdfad3b4dd3f97/25_windows_uefi
seem to be doing a job of broken `os-prober` and creates correct
grub.cfg entry :

### BEGIN /etc/grub.d/25_windows_uefi ###
menuentry "Windows 8 (loader)" {
	insmod search_fs_uuid
	insmod chain
	insmod part_gpt
	insmod fat
	set root='(hd0,gpt1)'
	search --no-floppy --fs-uuid --set=root BA44-790F
	chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
### END /etc/grub.d/25_windows_uefi ###

It is similar as the workaround proposed in this bug earlier, but  I
can notice two things here : UUID dieffers and adequate modules are
inserted (like `fat` for example).

I hope that this helps bug discovery and elimination.

Best regards,
Drasko



More information about the Pkg-grub-devel mailing list