Gentoo Archives: gentoo-user

From: Mike Gilbert <floppym@g.o>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] What's happening with grub-install on GPT?
Date: Tue, 15 Apr 2014 17:30:29
Message-Id: CAJ0EP40H+aw8kn=jkKDGYUH2rfMVX6SYQObi_f_NxV4JzLiZBA@mail.gmail.com
In Reply to: [gentoo-user] What's happening with grub-install on GPT? by Nikos Chantziaras
1 On Tue, Apr 15, 2014 at 8:38 AM, Nikos Chantziaras <realnc@×××××.com> wrote:
2 > As an old fart with MBR hardwired into my brain, I'm not sure I understand
3 > how booting from a GPT partitioned disk works now.
4 >
5 > So, I had to (note: "had to", not "wanted to") install Windows 8.1 on my
6 > machine. I had a dual boot Gentoo/Windows7 before that. So I did a backup,
7 > wiped the Windows7 partition, and then ran the W8.1 install (from a USB
8 > flash drive.)
9 >
10 > Windows complained that it can't install into MBR partitioned disks on EFI
11 > systems. So I booted Gentoo again, and converted my disk to GPT (with
12 > sys-apps/gptfdisk.) I backed up my MBR partition table before of course
13 > (with dd). I wasn't sure whether I needed an EFI BIOS boot partition (ID
14 > ef02), so I created one just to be safe by shrinking my swap partition by
15 > 100MB and giving that space to a new ef02 partition. This new partition
16 > ended up as /dev/sda5 and I formatted it with a FAT32 filesystem.
17 >
18 > So far so good. Now what happens with grub-install? I wasn't sure whether I
19 > needed to do:
20 >
21 > grub-install /dev/sda5
22 >
23 > or:
24 >
25 > grub-install /dev/sda
26 >
27 > So I did both. Note: I'm using grub-0.97-r13 and Gentoo ships it with GPT
28 > support.
29 >
30 > I tested it, and it booted OK. So far so good.
31 >
32 > Now I installed Windows 8.1. It took the free space of the Windows 7
33 > partition I had wiped, and created a bunch of new ones, including an EFI
34 > boot partition (ID ef00).
35 >
36 > After that, grub didn't show up anymore. So I booted from a sysrescuecd USB
37 > stick into my Gentoo, and ran this again:
38 >
39 > grub-install /dev/sda5
40 > grub-install /dev/sda
41 >
42 > Now the system boots into grub again, unless I press F11 at the POST screen
43 > and tell my EFI firmware to load the "Windows Boot Loader" instead.
44 >
45 > I'm very, very confused by all this. The EFI boot partition (ef00) created
46 > by Windows is not empty; it contains the Windows EFI boot loader. The EFI
47 > BIOS boot partition I created myself (ef02) is still empty; grub-install
48 > /dev/sda5 didn't seem to put anything in it.
49 >
50 > So what the hell does grub-install do? How is my system able to boot into
51 > grub at all? And, most importantly, how do I boot Windows 8 from grub now?
52 >
53 >
54
55 So you have a few things going on here.
56
57 1. You are booting using EFI. grub-0.97 does not support EFI, so it
58 must have auto-switched to BIOS compatibility mode when you tried to
59 boot using GRUB.
60
61 2. It is probably not possible to load the Windows EFI loader from a
62 BIOS boot loader. You would need to chainload the Windows BIOS boot
63 sector, which probably does not exist on an EFI installation.
64
65 3. I am not sure if Gentoo's grub-0.97 actually knows about the BIOS
66 boot partition (ef02). I'm actually not sure where it copies the stage
67 1.5 loader on a GPT disk.
68
69 If you really want to use grub-0.97, I think you will need to force
70 BIOS compatibility mode on and install Windows in BIOS mode.
71
72 Alternatively, you could convert to GRUB 2, which supports EFI
73 natively and should be able to load the Windows boot loader. Note that
74 I have not personally set up a dual-boot system in a very long time,
75 and never with GRUB 2, so I cannot vouch for how this works in
76 practice.