Repair Windows Boot Loader after installing Ubuntu on MacBook Pro
I installed Ubuntu 14.04.2 LTS on MacBookPro11,5 (Retina) with Mac OS X Yosemite following this guide: https://help.ubuntu.com/community/MacBookPro11-1/Saucy
The thing is that I already have Windows 8.1 Pro installed via Boot Camp, so the Disk Utility on Mac OS cannot be used for re-partitioning the SSD. I used resizeStack
in Terminal to shrink the OS X partition (guide here). Now the SSD is partitioned as:
-
/dev/sda1
: EFI partition -
/dev/sda2
: OS X Yosemite -
/dev/sda3
: OS X Recovery HD -
/dev/sda4
: Boot Camp Windows 8 -
/dev/sda5
: Ubuntu Disk mounted to/
-
/dev/sda6
: UbuntuSwap
The Ubuntu boot loader is selected to install to /dev/sda1
, but the installer notified that the Windows Boot Loader also exists in sda1
. After installation, Ubuntu and Mac OS successfully booted from GRUB2, but the Windows cannot be booted either from GRUB2 or from the native Apple boot manager (pressing option
when booting). I used Parallels Desktop to load the Boot Camp partition as a Virtual Machine and the Windows works.
Solution #1
I installed Boot Repair on Ubuntu and used the Recommended Repair, no luck; more entries are added to the Grub2 menu after repair. GRUB worked and Mac OS could be booted. Here is the Boot Info page created: http://paste.ubuntu.com/11897269/
Solution #2
I plugged in the Windows Installation flash drive and tried the automatic Startup Repair, which did not work. Then I attempted to repair the Master Boot Record by Command Prompt:
bootrec /fixmbr
After the repair Mac OS was set to be the first system to boot, so Grub menu did not appear while starting the computer. I used efibootmgr
on the Ubuntu Installation flash drive to set back Ubuntu to be the first boot drive and Mac OS to be the second. Windows still cannot be booted.
The weird thing is that this time the Apple boot manager did not attempt to boot Windows after the "Windows" disk icon is clicked; both the "Macintosh HD" and "Windows" icon will lead to Mac OS being booted. So the repair must have changed the Apple boot manager.
Several Questions
-
Seems that the Windows Boot Loader in
/dev/sda1
is overwritten by Grub. So is there a way to make the Windows Boot Loader and Linux boot loader (it is Grub now, right?) coexist? -
A thing to notice is that the Boot Camp Windows 8 boots in EFI mode on MacBook Pro, as the
setupact.log
showsCallback_BootEnvironmentDetect: Detected boot environment: EFI
. guide I also checked Grub that it works in EFI mode. Therefore does Windows also use GUID Partition Table (GPT) similar as Mac OS, instead of MBR? If so repairing MBR may not be useful. -
I am not sure where does the Apple boot switch reside, and how it can be changed by the Windows Installation drive? Is it also in
/dev/sda1
?
I am a beginner on the subject. Thanks a lot for your answers!
Updates:
I tried the following commands in Windows Installation Command Prompt:
-
bootrec /fixmbr
: Successful -
bootrec /fixboot
: Successful -
bootrec /scanos
: Identified 1 Windows Installation onD:\Windows
-
bootrec /rebuildbcd
: Identified 1 Windows Installation onD:\Windows
; The requested system device cannot be found. -
bcdedit
: The requested system device cannot be found.
Windows cannot be booted, with error code 0xc000000e
.
Updates #2
I followed Rod Smith's answer to convert my EFI partition from MBR: MBR only
to MBR: protective
and GPT: present
, but then the 'Windows' option disappears from Apple boot manager and Grub cannot be booted.
Also I followed Terrance's answer to rebuildbcd
but did not succeed. See comments on their answers.
Your problem is that your Windows installation is in EFI mode, but your disk is configured with a hybrid MBR, which forces Windows to treat the disk as an MBR disk. The Mac boot loader might also be taking this as a signal to attempt a BIOS-mode boot of Windows, but there's no BIOS-mode boot loader on the disk. Since Windows will boot in EFI mode only from a GPT disk, this configuration results in a failed boot. There may be other problems, too, but this one is the first issue I see, and it will definitely cause a failure to boot, so you should fix this problem.
Fortunately, the solution is fairly straightforward, albeit non-intuitive:
- Boot to Ubuntu. (You can also do this from OS X, but you'd need to install
gdisk
and use a different disk device filename.) - Open a Terminal window.
- Type
sudo gdisk /dev/sda
. After you're prompted for your password,gdisk
should launch and tell you, among other things,MBR: hybrid
. - Type
p
to view the partition table. Assuming you know enough about your partitions, you should be able to verify that you're looking at the right disk. If not, typeq
to quit and try another disk device. - Type
x
to enter the experts' menu. - Type
n
to create a fresh protective MBR to replace your existing hybrid MBR. - Type
p
again to verify that your partitions are all still in place. This is just a precaution to ensure you didn't accidentally hit the wrong key. - Type
w
to save your partition table. You'll be asked to verify this action. Do so.
With any luck, this should fix your problem.
If Bootrec shows the “The requested system device cannot be found” error, the following steps will help build a new BCD:
-
Type this command:
bcdedit /export D:\BCDBackup
-
Type
d:
where
d:
is where your Windows is installed -
Type
cd boot
-
Type this command:
attrib bcd -s -h -r
-
Type this command:
ren d:\boot\bcd bcd.old
-
Type this command:
bootrec /RebuildBcd
Hope this helps.
Credit