Wednesday, March 30, 2016

grub2 - 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: Ubuntu Swap


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.


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/


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.



  1. 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?


  2. A thing to notice is that the Boot Camp Windows 8 boots in EFI mode on MacBook Pro, as the setupact.log shows Callback_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.


  3. 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!




I tried the following commands in Windows Installation Command Prompt:



  • bootrec /fixmbr: Successful

  • bootrec /fixboot: Successful

  • bootrec /scanos: Identified 1 Windows Installation on D:\Windows

  • bootrec /rebuildbcd: Identified 1 Windows Installation on D:\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.

No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...