Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Dual-boot with Win8 on UEFI
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
Havin_it
Veteran
Veteran


Joined: 17 Jul 2005
Posts: 1070
Location: Edinburgh, UK

PostPosted: Thu Jun 20, 2013 3:30 pm    Post subject: Dual-boot with Win8 on UEFI Reply with quote

Hi,

So my trusty NC10 blew up :( and I've replaced it with a HP DM1 which comes with Win8 and, of course, UEFI. It does have a legacy mode, but I'd like to make my Gentoo install fully EFI anyway if possible. I've gotten as far as turning off Secure Boot (ptooey!) and booting into a SystemRescueCD USB key with added rEFInd to boot in EFI mode, and have done my partitining... or have I?

I just realised I'd need an EFI boot partition, but of course there already is one (for Windows). Inside, it contains a /boot/EFI folder with various sublevels (/HP, /Microsoft etc) that contain further /EFI folders and *.efi files. The partition is 200MB with about 60MB used.

My initial question here is, should I place linux EFI files in there too, or will Windows get "upset" about this? If it's OK, is the existing space likely to be sufficient (both for whatever I add with grub2 and whatever HP or MS in their wisdom may add later) or should I enlarge it, and to what size?

I'm reading as much as I can about this but haven't found a parallel case study yet, so any advice would be very welcome.
Back to top
View user's profile Send private message
py-ro
Veteran
Veteran


Joined: 24 Sep 2002
Posts: 1368
Location: St. Wendel

PostPosted: Thu Jun 20, 2013 4:16 pm    Post subject: Reply with quote

You can just add your Bootloader files, no problem.

You can also use an additional boot-Partition to store Kernel-Images, if you use a bootloader to chainload Linux.

Bye
Py
Back to top
View user's profile Send private message
srs5694
Guru
Guru


Joined: 08 Mar 2004
Posts: 420
Location: Woonsocket, RI

PostPosted: Thu Jun 20, 2013 4:35 pm    Post subject: Reply with quote

The partition you identify is known as an EFI System Partition (ESP). Why some tools refer to it by another name is beyond me; that just creates confusion. In any event, the ESP is intended to hold EFI-specific files, and as a practical matter, that means that all OSes installed on the computer must be able to access it, so as to store their boot loaders and related files.

In Linux, the ESP is traditionally mounted at /boot/efi and holds a Linux boot loader like ELILO or GRUB 2. Some configurations also place the Linux kernel and initrd file (if used) on the ESP. If you do that, a larger ESP may be in order. Also, some users have reported problems (apparently caused by EFI bugs) when a FAT32 ESP is smaller than 512MiB. Overall, I'd say to leave it sized as it is unless you run into problems with files seeming to disappear or if you store enough kernels on the ESP for 200MiB to become cramped.

Since you say you're using rEFInd, you should be aware that rEFInd comes with drivers for ext2/3fs, ext4fs, and ReiserFS. If you store your kernel on any of these filesystems, rEFInd can launch the kernel from its native filesystem. If not, you may want to copy your kernel to the ESP. This is a bit easier if you mount your ESP at /boot, since then the traditional location for the kernel is on the ESP. This is a bit unconventional, but it can work well.

If you're chainloading from rEFInd to ELILO, GRUB Legacy, or GRUB 2, then you'll need to pay attention to the boot loader's requirements. ELILO works best with the kernel on its own partition, but GRUB Legacy and GRUB 2 can both read other filesystems. IMHO, though, using one of these boot loaders with rEFInd just complicates matters, at least in most cases. (There are some odd bugs that can be worked around by such configurations, though; or you may need a unique feature of GRUB 2.)
Back to top
View user's profile Send private message
Havin_it
Veteran
Veteran


Joined: 17 Jul 2005
Posts: 1070
Location: Edinburgh, UK

PostPosted: Thu Jun 20, 2013 8:27 pm    Post subject: Reply with quote

Hi, thanks both for the replies :D

Sorry, rEFInd is sort of a red herring: I'm not intending to use it in the final setup, just used it to make the SRCD liveusb bootable in EFI mode.

Really I prefer the setup to have as few moving parts as possible: in fact, though I haven't quite got my head around this part, I just read that the kernel itself (appropriately configured) can be booted "directly" by EFI - does this in fact mean somehow that I don't even need GRUB2?

I usually keep just one old kernel besides the active one, so I reckon this should be OK to put in the ESP (especially if there is nothing else needing to be added there?).
Back to top
View user's profile Send private message
srs5694
Guru
Guru


Joined: 08 Mar 2004
Posts: 420
Location: Woonsocket, RI

PostPosted: Fri Jun 21, 2013 1:24 am    Post subject: Reply with quote

Havin_it wrote:
Really I prefer the setup to have as few moving parts as possible: in fact, though I haven't quite got my head around this part, I just read that the kernel itself (appropriately configured) can be booted "directly" by EFI - does this in fact mean somehow that I don't even need GRUB2?


Yes, that's right. Since version 3.3.0, the Linux kernel has included its own EFI boot loader. To the firmware, the kernel looks like an EFI application, and you can register the kernel with the firmware just like you'd register GRUB or rEFInd.

The problem with doing this is that it's inflexible and often awkward. With most computers, you need to hit a function key during the boot process to get the built-in boot manager with which to select your kernel. Some implementations don't even give you that option, so there's no way to select one kernel over another -- a real problem if your freshly-compiled kernel is a dud! You also can't change kernel options on a per-boot basis, and setting the kernel options is rather awkwardly done via the "efibootmgr" command. Despite these drawbacks, some people prefer to boot in this way because it minimizes the software on the computer. Others, myself included, prefer to have a more functional boot manager in which to set kernel options.

Quote:
I usually keep just one old kernel besides the active one, so I reckon this should be OK to put in the ESP (especially if there is nothing else needing to be added there?).


If you boot without the benefit of GRUB, rEFInd, gummiboot, or another boot loader or boot manager (other than the firmware's own bare-bones boot manager), then you'll need to store the kernel on the ESP, or at least on a FAT partition.
Back to top
View user's profile Send private message
Havin_it
Veteran
Veteran


Joined: 17 Jul 2005
Posts: 1070
Location: Edinburgh, UK

PostPosted: Sat Jun 22, 2013 12:42 pm    Post subject: Reply with quote

Heh, you make a very good point there: dual-booting a bit tricky without a menu :roll:

So GRUB2 it is. However I don't seem to be getting installation right. Following the Wiki page, I've put the kernel in /boot, mounted the ESP at /boot/efi and run the following in the chroot:

Code:
sysresccd efi # mkdir /boot/efi/GRUB2

sysresccd efi # grub2-mkconfig -o /boot/efi/GRUB2/grub.cfgGenerating grub.cfg ...
Found linux image: /boot/kernel-3.9.7-gentoo
Found Windows 8 (loader) on /dev/sda4
Found Windows Recovery Environment (loader) on /dev/sda5
done

sysresccd efi # grub2-install --target=x86_64-efi --efi-directory=/boot/efi --boot-directory=/boot/efi
BootCurrent: 0000
Timeout: 0 seconds
BootOrder: 2001,3001,3002,2002,2003
Boot0000* USB Hard Drive (UEFI) - USB DISK 2.0
Boot0001* Windows Boot Manager
Boot2001* USB Drive (UEFI)
Boot3001* Internal Hard Disk or Solid State Disk
Boot3002* Internal Hard Disk or Solid State Disk
BootCurrent: 0000
Timeout: 0 seconds
BootOrder: 0002,2001,3001,3002,2002,2003
Boot0000* USB Hard Drive (UEFI) - USB DISK 2.0
Boot0001* Windows Boot Manager
Boot2001* USB Drive (UEFI)
Boot3001* Internal Hard Disk or Solid State Disk
Boot3002* Internal Hard Disk or Solid State Disk
Boot0002* gentoo
Installation finished. No error reported.


All seems OK. However when I reboot it just continues to boot Windows immediately, so I take it it's not getting to GRUB. If it helps any, here's where all the .efi files on the partition are (this should give you an idea of the existing layout as well):

Code:
sysresccd efi # find /boot/efi -iname '*.efi'
/boot/efi/EFI/Microsoft/Boot/bootmgfw.efi
/boot/efi/EFI/Microsoft/Boot/bootmgr.efi
/boot/efi/EFI/Microsoft/Boot/memtest.efi
/boot/efi/EFI/Boot/bootx64.efi
/boot/efi/EFI/HP/SystemDiags/SystemDiags.efi
/boot/efi/EFI/HP/SystemDiags/CryptRSA.efi
/boot/efi/EFI/HP/SystemDiags/SystemDiags32.efi
/boot/efi/EFI/HP/SystemDiags/CryptRSA32.efi
/boot/efi/EFI/HP/BIOSUpdate/HpBiosUpdate.efi
/boot/efi/EFI/HP/BIOSUpdate/CryptRSA.efi
/boot/efi/EFI/HP/BIOSUpdate/HpBiosUpdate32.efi
/boot/efi/EFI/HP/BIOSUpdate/CryptRSA32.efi
/boot/efi/EFI/HP/boot/bootmgfw.efi
/boot/efi/EFI/HP/boot/bootmgr.efi
/boot/efi/EFI/HP/boot/memtest.efi
/boot/efi/EFI/HP/EFI/Boot/bootx64.efi
/boot/efi/EFI/HP/EFI/Microsoft/Boot/memtest.efi
/boot/efi/EFI/gentoo/grubx64.efi
/boot/efi/GRUB2/x86_64-efi/core.efi
/boot/efi/GRUB2/x86_64-efi/grub.efi


What have I missed?[/topic]
Back to top
View user's profile Send private message
Logicien
l33t
l33t


Joined: 16 Sep 2005
Posts: 738
Location: Montréal

PostPosted: Sat Jun 22, 2013 1:15 pm    Post subject: Reply with quote

I had the same problem. After installing Grub2 in UEFI mode, Windows Seven was continuing to boot automatically at the next reboot. I haven't found any way to make the UEFI firmware boot directly Grub and then choose the OS I want including Windows. I had to press the UEFI boot device key to select Grub and have his menu.

It's look like the Windows UEFI bootloader is always the default for the UEFI firmware when Windows is install in UEFI mode. I tried to change the boot order with efibootmgr and the EFI shell and put the Grub EFI file in the default or boot directory of the EFI System Partition, without success.

I tried some other hacks too in the EFI System Partition, but then Windows refused to boot. Possible reason, only the EFI firmware can boot Windows EFI because of the secure boot.

So, because I did'nt want to press the UEFI boot device key at any boot to select a bootloader, I just remove Windows that I did'nt really need and his directories in the EFI System Partition and than I have been able to make Grub appearing automatically at boot up.

:D

It could be interesting to know if there's a way to allow an other bootloader than the Windows one be the default when Windows is install in UEFI mode. If not, Grub EFI must be load from the Windows boot menu if possible to advoid the need to press the UEFI boot device key.

I think the futur will less compliant to a dual boot with Windows if the EFI mode become generalised. I keep interested in Coreboot.
_________________
Paul
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1122

PostPosted: Sat Jun 22, 2013 2:20 pm    Post subject: Reply with quote

Logicien wrote:
I tried some other hacks too in the EFI System Partition, but then Windows refused to boot. Possible reason, only the EFI firmware can boot Windows EFI because of the secure boot.

So, because I did'nt want to press the UEFI boot device key at any boot to select a bootloader, I just remove Windows that I did'nt really need and his directories in the EFI System Partition and than I have been able to make Grub appearing automatically at boot up.

If "secure boot" is that easy to circumvent it wouldn't be secure
:)

You probably didn't have the bug free tools then to change the EFI default enty:

Code:

/boot/efi/EFI/Microsoft/Boot/bootmgfw.efi
/boot/efi/EFI/Microsoft/Boot/bootmgr.efi
...
/boot/efi/EFI/Boot/bootx64.efi
Since bootx64.efi is the untouched DEFAULT per specification:
If win7-install set up itself as default by just copying its bootmgr.efi to EFI/Boot/bootx64.efi
then you could do the same. You can test what bootx64.efi really is:
md5sum /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi /boot/efi/EFI/Microsoft/Boot/bootmgr.efi /boot/efi/EFI/Boot/bootx64.efi

If you are very sure you have a runable efi application:
You can copy it to /EFI/Boot/bootx64.efi
And move/rename all the other EFI/_directories. This way an EFI entry previously set as DEFAULT is not valid any more and Efi should fall back to EFI/Boot/bootx64.efi

But be carefull, because your system will probably not be bootable any more if $if_you_are_very_sure is not valid!
_________________
fun2gen2
Back to top
View user's profile Send private message
ppurka
Advocate
Advocate


Joined: 26 Dec 2004
Posts: 3181

PostPosted: Sat Jun 22, 2013 3:34 pm    Post subject: Reply with quote

I followed this guide:
http://xtothei.wordpress.com/2012/05/08/gentoo-uefi/
from Step 4 onwards. This guide uses Grub2 and I found the directions very clear. In my configuration, I don't have a separate /boot partition. I do mount /dev/sda1 to /boot/efi. I also used ~amd64 grub2 and not the live version.
_________________
emerge --quiet redefined | E17 vids: I, II
Back to top
View user's profile Send private message
Havin_it
Veteran
Veteran


Joined: 17 Jul 2005
Posts: 1070
Location: Edinburgh, UK

PostPosted: Sat Jun 22, 2013 5:00 pm    Post subject: Reply with quote

OK, well I have now got as far as booting Gentoo from the HD, although I needed to go through rEFInd to do it :(

rEFInd (on my USB stick) detected the Gentoo loader fine, and showed it in its menu, which put me through to GRUB and a straightforward boot. I've since discovered the boot-order menu at F9 on startup that also lets me boot gentoo, but this doesn't seem to be editable from within the the machine's setup screens. (And no, it's not appearing in the Windows boot manager either.) At least I know my install is otherwise good.

@ulenrich, I just looked and your hunch is correct:

[ESP]/EFI/Boot/bootx64.efi

is the same file as

[ESP]/EFI/Microsoft/Boot/bootmgfw.efi

So when I'm able to reboot next I'll try replacing it with

[ESP]/EFI/gentoo/bootx64.efi

The only other thing that's occurred is using efibootmgr, which I presume must have been invoked by grub to get the "gentoo" item into the menu to begin with. Currently it shows this:

Code:
happy ~ # efibootmgr -v
BootCurrent: 0000
Timeout: 0 seconds
BootOrder: 2001,3001,3002,2002,2003
Boot0000* USB Hard Drive (UEFI) - USB DISK 2.0   ACPI(a0341d0,0)PCI(13,2)USB(0,0)HD(1,1,eeffff,000126b0)RC
Boot0001* Windows Boot Manager   HD(2,c8800,82000,b7164fc8-eec2-409a-8f37-1006ca5c9612)File(\EFI\Microsoft\Boot\bootmgfw.efi)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}...1................
Boot0002* gentoo   HD(2,c8800,82000,b7164fc8-eec2-409a-8f37-1006ca5c9612)File(\EFI\gentoo\grubx64.efi)
Boot2001* USB Drive (UEFI)   RC
Boot3001* Internal Hard Disk or Solid State Disk   RC
Boot3002* Internal Hard Disk or Solid State Disk   RC


...if that's any help whatsoever...(?) I can't see a way of backing this bit up, so I don't want to go trial-and-error at this, at any rate.


In other news, Win8 isn't booting from inside GRUB, so there's another headache, but gentoo is by far the priority right now :wink:
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 6250
Location: Goose Creek SC

PostPosted: Sat Jun 22, 2013 6:45 pm    Post subject: Reply with quote

booted in windows:

Download and extract rEFInd from:
http://sourceforge.net/projects/refind/files/0.6.12/refind-bin-0.6.12.zip/download

Install rEFInd from windows as described at
http://www.rodsbooks.com/refind/installing.html#windows

reboot

no grubs, no copying kernels to esp's, only the windows ESP, multiboot menu, add more efi stub configured kernels on gpt disks in ext2/3/4fs, hfs, or reiserfs file systems and refind finds them and adds them to the menu ...
_________________
Defund the FCC.


Last edited by DONAHUE on Sat Jun 22, 2013 8:46 pm; edited 2 times in total
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1122

PostPosted: Sat Jun 22, 2013 7:53 pm    Post subject: Reply with quote

DONAHUE wrote:
Install rEFInd from windows as described at
http://www.rodsbooks.com/refind/installing.html#windows

Yes, the other option I got well through using
gummiboot-32
_________________
fun2gen2
Back to top
View user's profile Send private message
srs5694
Guru
Guru


Joined: 08 Mar 2004
Posts: 420
Location: Woonsocket, RI

PostPosted: Sun Jun 23, 2013 1:51 am    Post subject: Reply with quote

Havin_it wrote:
So GRUB2 it is. However I don't seem to be getting installation right. Following the Wiki page, I've put the kernel in /boot, mounted the ESP at /boot/efi and run the following in the chroot:


IMHO, GRUB 2 is klunky and unreliable, although many people disagree with me on that. Still, GRUB 2 doesn't seem to be your problem; your problem is getting to GRUB 2....

Quote:
Code:
sysresccd efi # grub2-install --target=x86_64-efi --efi-directory=/boot/efi --boot-directory=/boot/efi
BootCurrent: 0000
Timeout: 0 seconds
BootOrder: 2001,3001,3002,2002,2003
Boot0000* USB Hard Drive (UEFI) - USB DISK 2.0
Boot0001* Windows Boot Manager
Boot2001* USB Drive (UEFI)
Boot3001* Internal Hard Disk or Solid State Disk
Boot3002* Internal Hard Disk or Solid State Disk
BootCurrent: 0000
Timeout: 0 seconds
BootOrder: 0002,2001,3001,3002,2002,2003
Boot0000* USB Hard Drive (UEFI) - USB DISK 2.0
Boot0001* Windows Boot Manager
Boot2001* USB Drive (UEFI)
Boot3001* Internal Hard Disk or Solid State Disk
Boot3002* Internal Hard Disk or Solid State Disk
Boot0002* gentoo
Installation finished. No error reported.


Note the change to the BootOrder line and the new Boot0002 entry. Unfortunately, the information you've posted is incomplete; you need to type "efibootmgr -v" to get a more complete listing of the contents of each of the boot items. This extra output often reveals problems with the boot entries. Still, even what you've posted suggests that GRUB should have launched when you restarted, but it didn't....

Unfortunately, many computers have buggy EFIs on which efibootmgr's changes don't "take." There seem to be at least three problems, based on reports I've seen:


  • On some computers, efibootmgr (which is called by grub-install and some other tools) doesn't have any effect at all. This is not the case for you, since the second efibootmgr output shown by grub-install is different from the first.
  • On some computers, efibootmgr seems to work, but the computer "forgets" its changes as soon as you reboot. You can check this by running "efibootmgr" or "efibootmgr -v" after rebooting back into Linux in any way you can manage; if you see your "gentoo" entry, then this is not your problem. If your "gentoo" entry has disappeared, then this is likely what's happening. There may be multiple causes for this, and there are multiple possible workarounds. In a best-case scenario, you can use the Windows "bcdedit" command or the "bcfg" command in an EFI version 2 shell to fix the problem. See the rEFInd Windows installation instructions (and especially step #10) for the basics of using "bcdedit" in Windows, and the Arch Linux wiki for some pointers on "bcfg". If neither "bcdedit" nor "bcfg" helps, you may need to use a fallback filename for your boot loader, such as EFI/BOOT/bootx64.efi; or if dual-booting with Windows, "hijack" the Windows boot loader's filename, renaming the Windows boot loader so that you can launch it from your preferred boot manager.
  • Some computers remember their NVRAM entries just fine, but ignore entries unless they're named "Windows Boot Manager," or possibly something else, like "Red Hat Enterprise Linux." See Matthew Garrett's blog post about this bizarre bug for more details.


Unfortunately, you need to track down the cause of your bug on a case-by-case basis, and new variants are still cropping up.

Logicien wrote:
It could be interesting to know if there's a way to allow an other bootloader than the Windows one be the default when Windows is install in UEFI mode.


On a properly-functioning EFI implementation, yes, you can set any program you like as the default. Unfortunately, some implementations are buggy and slavishly boot the Windows boot loader or none at all. In an extreme case, you may need to rename the boot loaders so that whatever you want (GRUB, gummiboot, rEFInd, etc.) is stored under the Windows boot loader's filename.

ulenrich wrote:
If "secure boot" is that easy to circumvent it wouldn't be secure


Secure Boot is not intended to secure the computer against somebody with physical access to the computer. Given physical access, you can enter the firmware setup utility and disable Secure Boot -- at least, this is true on x86 and x86-64 systems. (Some ARM systems are locked down against this, and so are exceptions to the rule.) Secure Boot is aimed more at protecting the computer against boot kits installed by malware, which can't adjust the firmware settings without the user's intervention, thus adding a significant social engineering hurdle to the task of installing boot kit malware.

ulenrich wrote:
Since bootx64.efi is the untouched DEFAULT per specification:
If win7-install set up itself as default by just copying its bootmgr.efi to EFI/Boot/bootx64.efi
then you could do the same.


Windows normally installs its boot loader to two locations:

Code:
EFI/Microsoft/Boot/bootmgfw.efi
EFI/BOOT/bootx64.efi


It then registers the first of those locations with the firmware, so that the computer will run that boot loader. I can't speak for the Microsoft programmers, but I presume that the duplicate installed to EFI/BOOT/bootx64.efi is meant as a fallback in case the computer has buggy firmware or hardware that "forgets" its NVRAM entries or in case those entries get overwritten or erased by accident. In that case, the computer will probably continue to boot normally; however, use of EFI/BOOT/bootx64.efi is a backup, not the way it's supposed to boot. Thus, simply copying your desired boot loader over EFI/BOOT/bootx64.efi will not guarantee that it's used; if EFI/Microsoft/Boot/bootmgfw.efi is present and is registered with the NVRAM (or if the firmware is hard-coded to use it in preference to EFI/BOOT/bootx64.efi, as some are), then copying your boot loader over EFI/BOOT/bootx64.efi will have no effect.

ulenrich wrote:
If you are very sure you have a runable efi application:
You can copy it to /EFI/Boot/bootx64.efi
And move/rename all the other EFI/_directories. This way an EFI entry previously set as DEFAULT is not valid any more and Efi should fall back to EFI/Boot/bootx64.efi


This will probably work. There are still a few caveats, though. For one thing, the use of EFI/BOOT/bootx64.efi is only guaranteed on external media. The use of that filename as a fallback on internal disks is a relatively recent addition to the EFI spec, and I'm not even 100% sure that all new computers use it. Also, some boot loaders may look for their files in expected locations, so renaming their directories may render those boot loaders useless. Of course, if you just want to boot Linux, this isn't an issue, but if you want to dual-boot, it is a problem.

Havin_it wrote:
rEFInd (on my USB stick) detected the Gentoo loader fine, and showed it in its menu, which put me through to GRUB and a straightforward boot.


You should be able to boot a Linux kernel directly from rEFInd, without using GRUB. This depends on having a kernel with the EFI stub support, which was added with the 3.3.0 kernel (and which you might or might not have compiled in already). The EFI must also be able to read the kernel, which means that it must be stored on a FAT filesystem or (with appropriate EFI drivers included with rEFInd) on ext2/3/4fs or ReiserFS. (There's also a brand-new Btrfs driver; see the announcement for details.)

Havin_it wrote:
I've since discovered the boot-order menu at F9 on startup that also lets me boot gentoo, but this doesn't seem to be editable from within the the machine's setup screens.


You should be able to adjust the boot order with the "-o" option to "efibootmgr", via "bcfg" in an EFI version 2 shell, via "bcdedit" in Windows, or in various other ways.

Havin_it wrote:
Win8 isn't booting from inside GRUB, so there's another headache


There are several possible causes of such problems. The prototype GRUB 2 entry that seems most likely to work for me is:

Code:

menuentry "Windows 7" {
        insmod part_gpt
        insmod chain
        set root='(hd0,gpt1)'
        chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}


If yours is different, you may need to change it; and you should also report the precise problem with yours -- what (if any) error messages you see, etc.

Generally speaking, rEFInd and gummiboot seem much more reliable about launching Windows than GRUB is.
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 6250
Location: Goose Creek SC

PostPosted: Sun Jun 23, 2013 5:02 am    Post subject: Reply with quote

http://wiki.gentoo.org/wiki/UEFI_Dual_boot_with_Windows_7/8 long winded and tedious exposition of what worked on a hard case resistant asrock board with ami hybrid bios implementing a stripped down aptio uefi.
_________________
Defund the FCC.
Back to top
View user's profile Send private message
Havin_it
Veteran
Veteran


Joined: 17 Jul 2005
Posts: 1070
Location: Edinburgh, UK

PostPosted: Sun Jun 23, 2013 12:44 pm    Post subject: Reply with quote

@srs5694, some of your points were discussed above, but thanks for the expansive post anyhoo :D

Sure enough, replacing the bootx64.efi made no difference, and efibootmgr -v shows why (was posted above, but here it is when booted without the aid of the USB stick, FWIW):

Code:
happy ~ # efibootmgr -v
BootCurrent: 0002
Timeout: 0 seconds
BootOrder: 3001,3002,2001,2002,2003
Boot0001* Windows Boot Manager   HD(2,c8800,82000,b7164fc8-eec2-409a-8f37-1006ca5c9612)File(\EFI\Microsoft\Boot\bootmgfw.efi)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}...1................
Boot0002* gentoo   HD(2,c8800,82000,b7164fc8-eec2-409a-8f37-1006ca5c9612)File(\EFI\gentoo\grubx64.efi)
Boot2001* USB Drive (UEFI)   RC
Boot3001* Internal Hard Disk or Solid State Disk   RC
Boot3002* Internal Hard Disk or Solid State Disk   RC


No idea what all that gubbins after the file path in the Win8 entry is, any ideas?

Also, how come the numbers for the Win8 and gentoo items (0001 and 0002) aren't even in the BootOrder declaration?

I didn't know about bcdedit, I'll have a look at that and see whether I can make good with it. Still in cautious mode though...

I did also notice among HP's driver downloads etc for this machine, there's a UEFI "Support Environment". Its description doesn't explicitly say it manages the boot menu, but you never know...
Back to top
View user's profile Send private message
srs5694
Guru
Guru


Joined: 08 Mar 2004
Posts: 420
Location: Woonsocket, RI

PostPosted: Sun Jun 23, 2013 11:40 pm    Post subject: Reply with quote

Havin_it wrote:
Sure enough, replacing the bootx64.efi made no difference, and efibootmgr -v shows why (was posted above, but here it is when booted without the aid of the USB stick, FWIW):

Code:
happy ~ # efibootmgr -v
BootCurrent: 0002
Timeout: 0 seconds
BootOrder: 3001,3002,2001,2002,2003
Boot0001* Windows Boot Manager   HD(2,c8800,82000,b7164fc8-eec2-409a-8f37-1006ca5c9612)File(\EFI\Microsoft\Boot\bootmgfw.efi)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}...1................
Boot0002* gentoo   HD(2,c8800,82000,b7164fc8-eec2-409a-8f37-1006ca5c9612)File(\EFI\gentoo\grubx64.efi)
Boot2001* USB Drive (UEFI)   RC
Boot3001* Internal Hard Disk or Solid State Disk   RC
Boot3002* Internal Hard Disk or Solid State Disk   RC


No idea what all that gubbins after the file path in the Win8 entry is, any ideas?


I'm pretty sure those are options passed to the loader. In EFI, most strings are UCS-2/UTF-16, which are 16-bit codes, and efibootmgr is reporting them as if they were 8-bit ASCII, so they look strange.

Quote:
Also, how come the numbers for the Win8 and gentoo items (0001 and 0002) aren't even in the BootOrder declaration?


The 0002 entry was in the first efibootmgr output you posted. If you didn't mess with efibootmgr or any other utility that might have made such changes, it could be that your EFI has "selective amnesia" and is "forgetting" any but a restricted set of items, at least in its BootOrder variable. If I'm right, this is an EFI bug, and you should complain to the manufacturer about it. (The manufacturer will probably do nothing, but they will certainly do nothing if nobody complains about bugs!)
Back to top
View user's profile Send private message
Havin_it
Veteran
Veteran


Joined: 17 Jul 2005
Posts: 1070
Location: Edinburgh, UK

PostPosted: Tue Jun 25, 2013 11:54 am    Post subject: Reply with quote

Looks like it is indeed "selective amnesia". I plucked up courage and changed the BootOrder using efibootmgr, but on reboot the order reverted to put Win8 first again. So far there are two approaches that work:

  • Issue an automated call to efibootmgr on every boot, to set BootNext to the gentoo entry. Bit scissors-and-tape, but effective.
  • Overwrite /EFI/Microsoft/Boot/bootmgfw.efi with the GRUB loader. Not sure how I'll be able to boot Windows now though :S
Back to top
View user's profile Send private message
srs5694
Guru
Guru


Joined: 08 Mar 2004
Posts: 420
Location: Woonsocket, RI

PostPosted: Tue Jun 25, 2013 3:46 pm    Post subject: Reply with quote

Havin_it wrote:
Looks like it is indeed "selective amnesia". I plucked up courage and changed the BootOrder using efibootmgr, but on reboot the order reverted to put Win8 first again. So far there are two approaches that work:

  • Issue an automated call to efibootmgr on every boot, to set BootNext to the gentoo entry. Bit scissors-and-tape, but effective.
  • Overwrite /EFI/Microsoft/Boot/bootmgfw.efi with the GRUB loader. Not sure how I'll be able to boot Windows now though :S


For the second option, you can move or rename the "real" bootmgfw.efi and adjust GRUB (or whatever boot manager you use) to launch the moved/renamed file from its new location/name. Do not move or rename any other files in the EFI/Microsoft directory tree -- bootmgfw.efi seems to refer to them by hard-coded absolute pathnames. Personally, I think that moving bootmgfw.efi down one level (so that it becomes EFI/Microsoft/bootmgfw.efi) is a good solution. This has the advantage that rEFIt and rEFInd will detect it as a valid boot loader, but of course if you're not using one of them, this won't matter. Ubuntu's Boot Repair tools renames bootmgfw.efi but keeps it in the same directory. The new name varies depending on the version of Boot Repair installed. Recent versions seem to be using bkpbootmgfw.efi, but other names have been used in the past. (That's one of many confusing things about Boot Repair.)
Back to top
View user's profile Send private message
Havin_it
Veteran
Veteran


Joined: 17 Jul 2005
Posts: 1070
Location: Edinburgh, UK

PostPosted: Fri Jun 28, 2013 1:05 pm    Post subject: Reply with quote

OK, well I'm going with the approach of moving the Win8 loader one level up, but this still leaves me unable to boot Win8.

@srs5694, I tried using your custom menuentry above:
Code:
menuentry "Windows 8" {
        insmod part_gpt
        insmod chain
        set root='(hd0,gpt2)'
        chainloader /EFI/Microsoft/bootmgfw.efi
}


But I get this error:
Code:
/endEntire
file path: /ACPI(ao341d0,0)/PCI(0,11)/ATAPI(0,0,0)/HD(2,C8800,82000,c04f16b7c2ee9a40,8f,37)/File(\EFI\Microsoft)/File(bootmgfw.efi)/EndEntire
error: invalid cluster 0.

Press any key to continue...


Also worth noting that os-prober doesn't find the Windows loader now either (although the entries it created previously didn't work either).
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1122

PostPosted: Fri Jun 28, 2013 1:56 pm    Post subject: Reply with quote

Havin_it wrote:
@srs5694, I tried using your custom menuentry above:
Code:
menuentry "Windows 8" {
        insmod part_gpt
        insmod chain
        set root='(hd0,gpt2)'
        chainloader /EFI/Microsoft/bootmgfw.efi
}

This means your second partition has an EFI directory containing the boomgfw.efi ????
_________________
fun2gen2
Back to top
View user's profile Send private message
Havin_it
Veteran
Veteran


Joined: 17 Jul 2005
Posts: 1070
Location: Edinburgh, UK

PostPosted: Fri Jun 28, 2013 2:54 pm    Post subject: Reply with quote

ulenrich wrote:
Havin_it wrote:
@srs5694, I tried using your custom menuentry above:
Code:
menuentry "Windows 8" {
        insmod part_gpt
        insmod chain
        set root='(hd0,gpt2)'
        chainloader /EFI/Microsoft/bootmgfw.efi
}

This means your second partition has an EFI directory containing the boomgfw.efi ????


It sure does: 2nd partition is the ESP.

I get the feeling I'm about to be told I've done it wrong :oops: The above is just me translating srs5694's example to my own setup, with some guesswork. My assumption was that since the chainloader argument was pointing to the MS EFI loader, the root= argument should be pointing to the ESP. Wrong?
Back to top
View user's profile Send private message
srs5694
Guru
Guru


Joined: 08 Mar 2004
Posts: 420
Location: Woonsocket, RI

PostPosted: Fri Jun 28, 2013 4:13 pm    Post subject: Reply with quote

The "invalid cluster" error sounds like a filesystem error to me. In fact, I think I found it in the source code:

https://github.com/jolicloud/grub2/blob/master/fs/fat.c

(Search on "invalid cluster" for the context.) If I'm right, then you should umount the ESP and run dosfsck on it from Linux, or use CHKDSK in Windows. If that fails, try backing up the entire ESP, re-creating it with mkdosfs, and restoring all its files. (This may also require you to update your /etc/fstab, if you mount it via its "UUID.")
Back to top
View user's profile Send private message
Havin_it
Veteran
Veteran


Joined: 17 Jul 2005
Posts: 1070
Location: Edinburgh, UK

PostPosted: Fri Jun 28, 2013 7:53 pm    Post subject: Reply with quote

Good spot, thanks :D I dunno how I managed to corrupt it, I've been very gentle with it so far :roll:

That got it working. However, more weirdness! After booting into Win8 and rebooting from there (which took a suspiciously long time), I got booted back into Win8. On inspecting the ESP contents, I discovered that the /EFI/Microsoft/Boot/bootmgfw.efi (which I'd overwritten with GRUB's loader) had been overwritten again.

As if that weren't odd enough, the "new" bootmgfw.efi is *not* the same file as the original (different md5sum). Where did it come from? WTH are HP up to?
Back to top
View user's profile Send private message
srs5694
Guru
Guru


Joined: 08 Mar 2004
Posts: 420
Location: Woonsocket, RI

PostPosted: Fri Jun 28, 2013 10:45 pm    Post subject: Reply with quote

Have you tried "bcdedit" in Windows? I mentioned it earlier, but I don't see any explicit mention that you've tried it. The command, typed from a Windows Administrator Command Prompt window, would be:

Code:
bcdedit /set {bootmgr} path \EFI\gentoo\grubx64.efi


If that doesn't work, then I recommend you return the computer for a refund, buy something from a different manufacturer, and write a letter to HP telling them that you've returned their computer because of its defective firmware. Mince no words in your letter. Manufacturers will sell us junk if we let them, and all too often, that's precisely what happens. A single return of a computer will cost the manufacturer a significant amount of money, so that's one of the few actions that we can take as consumers to motivate them to create better products.
Back to top
View user's profile Send private message
Havin_it
Veteran
Veteran


Joined: 17 Jul 2005
Posts: 1070
Location: Edinburgh, UK

PostPosted: Sat Jun 29, 2013 1:47 am    Post subject: Reply with quote

srs5694 wrote:
Have you tried "bcdedit" in Windows? I mentioned it earlier, but I don't see any explicit mention that you've tried it. The command, typed from a Windows Administrator Command Prompt window, would be:

Code:
bcdedit /set {bootmgr} path \EFI\gentoo\grubx64.efi

Eh, well I certainly would do, except that and most of the rest of grub's files (and its menu entry even in the F9 menu) got deleted after my last venture into Windows... 8O
srs5694 wrote:

If that doesn't work, then I recommend you return the computer for a refund, buy something from a different manufacturer, and write a letter to HP telling them that you've returned their computer because of its defective firmware. Mince no words in your letter. Manufacturers will sell us junk if we let them, and all too often, that's precisely what happens. A single return of a computer will cost the manufacturer a significant amount of money, so that's one of the few actions that we can take as consumers to motivate them to create better products.

Oh, I am composing something in my head at this moment, but I'm still wondering what I'm going to encounter next... getting my root partition re-taken by Windows?
I will give bcdedit a go as well (and see if it sticks), but either way it looks like it leaves /EFI/Boot/bootx64.efi alone so I can always point at that instead (touch wood). I think the main lesson learned was to avoid using Windows where possible, which I pretty much do 99% of the time anyway.
I just noticed this sucker has a pop-in SD card slot where the card can sit fully recessed to the machine. /me ponders booting from a permanently-housed SD card ... :twisted:
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum