[CentOS] Dual boot with Windows 8.1, UEFI

Andrew Daviel

advax at triumf.ca
Tue Aug 26 00:57:16 UTC 2014


(apologies for the length - there are questions at the end...)

I've been running Linux for 20 years, and done a lot of dual-boots. I know 
that's old-school now, but I run Linux 95% of the time yet don't want to 
lose a Windows system I've paid for - but I've never tried removing it 
from a system and reinstalling the same licenced copy inside a virtual machine.

I bought a new laptop back in April this year, after trying to check 
online for Linux certification to match what was in the local stores. 
There's so many models and variants that's almost impossible, but I found 
various "HP Pavilion 14" in www.ubuntu.com/certification
and a couple of "HP EliteBook" in hardware.redhat.com/laptop.
So I bought an "HP Pavilion 14-n228ca TouchSmart Notebook",
which came with Windows 8.1 installed.

So I start off doing what I've done on previous occasions - get into the 
BIOS, change the boot order, boot a CentOS 6 installation CD as used on 
my desktop, go into rescue mode and look at the partitions. Normally I'd
use fdisk, but that says it doesn't understand GPT and I should use 
parted. There's 5 partitions, so I use resizefs to shrink the main NTFS 
data partition, then delete the partition and recreate it shorter at the 
same start location. Then reboot the CD into install mode, create a 
Linux partition in the free space, and install CentOS, which adds a 
choice of "Other" in grub.conf to boot Windows.

Then I boot CentOS and finish the install - a couple of glitches; it needs 
a kernel parameter "iommu=soft" to get the USB mouse to work
("nommu_map_single overflow" messages), and it needs a firmware file 
rt3290.bin for the RT3290 WiFi chip to work (submitted bug 1133288).

Then I try to boot into Windows. From GRUB, I get a screen "windows boot 
manager" with an error message "file \Boot\BCD - missing or contains 
errors".


The boot sequence is a bit weird compared to what I'm used to - this is my 
first machine with UEFI. The BIOS has a UEFI boot order and a legacy boot 
order, which has to be enabled. UEFI takes precedence. With legacy 
enabled, F9 gives a boot menu with
   OS boot Manager
   Boot from EFI file
   Notebook hard drive
   Internal CD/DVD ROM Drive
"Notebook hard drive" takes me to GRUB.
"EFI file" takes me walkabout on a Windows file system with folders like 
"HP", "Boot", Windows" and what looks like hundreds of locale files - 
maybe I can boot in Turkish.
"OS boot Manager" takes me to an HP/Windows system recovery screen with
various options - continue, troubleshoot, turn off.
"continue" goes to a splash screen like "attempting to repair" which 
fails. "troubleshoot" has a command prompt option. That's running Windows 
cmd.exe in one of the other partitions, mounted as X:
In that, I find commands "chkdsk", "diskpart", "bootrec", "bcdedit" etc.
To cut an even longer story short, I did something like:
X:\ diskpart
diskpart> select disk 0
diskpart> select partition 4 (the NTFS system one)
diskpart> set id=ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
X:\ bcdedit /set {default} device partition=C:
X:\ bcdedit /set {default} osdevice partition=C:
X:\ bootrec /rebuildbcd

After doing that, the system partition appears as C:, passes chkdsk, and 
the system boots successfully into Windows.

3 questions:
- what should I have done instead to create a dual-boot system on this
   hardware (the above is ridiculous and took hours of trials and research)
- how can I make CentOS boot by default (since there is a valid EFI
   record for Windows 8, that seems to take preference unless I hit F9 at
   boot and manually select the disk)
   - is it possible to make CentOS boot via EFI rather than from the legacy
   partition boot record ?
- how can I make Windows boot from GRUB ? (I tried
   "bcdedit /export C:\Boot\BCD", but that did not help - or I have the
   wrong file or syntax)

Some documentation refers to a tool in Windows 8 called "EasyBCD", but I 
can't find it in my system.



-- 
Andrew Daviel, TRIUMF, Canada
Tel. +1 (604) 222-7376  (Pacific Time)



More information about the CentOS mailing list