I have an external hard drive where I installed Windows 10 to use on my MacBook when needed. It works great, I just need to toggle the boot disk.
But I had to install Linux. To do this I separated space from the HD and installed Linux through a pen drive. Now whenever I boot the computer with this HD it opens GRUB and asks me to select between UBUNTU and WINDOWS BOOT MANAGER.
Initializing the ubuntu is easy but when I try to boot Windows it gets stuck. I checked through Ubuntu and all Windows files are still there …
Some information i get when i type fdisk -l
in ubuntu:
Disk /dev/sda: 113 GiB, 121332826112 bytes, 236978176 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: AF2EB9E1-8E5E-41A3-82B6-16DAF94B546A
Device Start End Sectors Size Type
/dev/sda1 40 409639 409600 200M EFI System
/dev/sda2 409640 236978135 236568496 112,8G unknown
Disk /dev/sdc: 298,1 GiB, 320072932352 bytes, 625142446 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 2BA05492-9337-401D-9BB9-33D96A7159A9
Device Start End Sectors Size Type
/dev/sdc1 40 409639 409600 200M EFI System
/dev/sdc2 411648 331016191 330604544 157,7G Microsoft basic data **<- WINDOWS!?**
/dev/sdc3 331016192 338829311 7813120 3,7G Linux swap
/dev/sdc4 338829312 625141759 286312448 136,5G Linux filesystem
Whats ived tried:
sudo update-grub
in ubuntu- Boot repair in ubuntu, he said "Please disable SecureBoot in the BIOS. Then try again.Do you want to continue?"
My Macbook is the Air (13-inch, Early 2014) using macOS Mojave with 1,4 GHz Intel Cor and 4GB of ram.
what should I do to fix it?
Best Answer
So far this is not a answer. To fully answer, I would need more information. Below is an explanation of what went wrong.
Both Ubuntu and Window place boot software in the /EFI/Boot folder in the EFI partition (
sdc1
). Most notably is thebootx64.efi
file.When you installed Ubuntu, the Windows
EFI\Boot\bootx64.efi
file was replace with an Ubuntu version. There is a backup copy of the overwritten file stored under the file nameEFI\Microsoft\Boot\bootmgfw.efi
. So repairing the broken Windows is fairly easy. You could just copy a file. However, this type of the repair would also break Ubuntu.A possible solution would be to clone the EFI partition. You could then make the above repair to the clone. This would allow both Windows and Ubuntu to appear in the Mac Startup Manager. Below is an example of how to do this. Here, both Windows and Ubuntu were installed on a single drive in a VirtualBox virtual machine. This was done to verify the commands are correct.
While booted to Ubuntu, temporarily make Windows bootable. The steps are given below.
Open a Terminal windows. Enter the command below to become the
root
user.Enter the command given below. This changes the folder to the
EFI/Boot
on the partition labeledEFI
.Rename the Ubuntu file
bootx64.efi
to the temporary namebootx64u.efi
.Enter the command given below to copy the Windows file
bootmgfw.efi
tobootx64.efi
.If you do not have a
Microsoft
folder, then you will need to reinstall the Windows boot files. See the Appendix end of this answer.Enter the
exit
command twice to close the window.The output produced when I entered these commands is shown below.
Next, reboot to Windows and clone the EFI partition. Cloning can not be accomplished while booted directly to Windows. Instead, you have to reboot to the Windows Recovery Environment (winRE) or from a Windows USB flash drive installer. The instructions for using the winRE are given at the Microsoft website Start your PC in safe mode in Windows 10.
Execute the
diskpart
command and list the available drives.Select the correct disk. I selected
disk 0
. You will need to select the correct external drive from the drives listed.List the partitions on the selected drive.
Windows should be
partition 2
. Enter the following commands to create a new200 MB
partition labeledEFI2
after the Windows partition.Assign the new partition the letter
T:
and the originalEFI
partition the letterS:
.Enter the
exit
command to exit thediskpart
command.Copy all the files from the old partition to the new partition.
Restore the Ubuntu
bootx64.efi
file.Enter the
exit
command twice to close the window.The output produced when I entered these commands is shown below.
Appendix
How to reinstall the Windows EFI boot files.
When the initial Windows 10 installation windows appears, press then shift+F10 key combination to open a Command Prompt window.
Execute the
diskpart
command and list the available drives.Select the correct disk. I selected
disk 0
. You will need to select the correct external drive from the drives listed.Enter the command below to determine the drive letter assign to the Windows partition. In this example, I will assume the drive letter is
C:
.Assign the
EFI
partition the letterS:
.Enter the
exit
command to exit thediskpart
command.Enter the following command to create the Windows EFI boot files. If you determined a different drive letter than
C:
in step 6, then make the appropriate substitution.Enter the command below to close the Command Prompt Window.
Click on the red
X
button and then selectYes
button to restart the Mac.