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 the bootx64.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 name EFI\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.
sudo bash
Enter the command given below. This changes the folder to the EFI/Boot
on the partition labeled EFI
.
cd /boot/efi/EFI/Boot
Rename the Ubuntu file bootx64.efi
to the temporary name bootx64u.efi
.
mv bootx64.efi bootx64u.efi
Enter the command given below to copy the Windows file bootmgfw.efi
to bootx64.efi
.
cp ../Microsoft/Boot/bootmgfw.efi bootx64.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.
exit
exit
The output produced when I entered these commands is shown below.
dma@dma-VirtualBox:~$ sudo bash
[sudo] password for dma:
root@dma-VirtualBox:/boot/efi/EFI# cd /boot/efi/EFI/Boot
root@dma-VirtualBox:/boot/efi/EFI/Boot# mv bootx64.efi bootx64u.efi
root@dma-VirtualBox:/boot/efi/EFI/Boot# cp ../Microsoft/Boot/bootmgfw.efi bootx64.efi
root@dma-VirtualBox:/boot/efi/EFI/Boot# exit
exit
dma@dma-VirtualBox:~$ exit
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.
Note: The website explains how to reach "Startup Settings". You need to select "Command Prompt" instead of "Startup Settings".
Execute the diskpart
command and list the available drives.
diskpart
list disk
Select the correct disk. I selected disk 0
. You will need to select the correct external drive from the drives listed.
select disk 0
List the partitions on the selected drive.
list partition
Windows should be partition 2
. Enter the following commands to create a new 200 MB
partition labeled EFI2
after the Windows partition.
select part 2
shrink desired=200
create partition efi
format fs=fat32 label=EFI2 quick
list partition
Assign the new partition the letter T:
and the original EFI
partition the letter S:
.
assign letter=t
select partition 1
assign letter=s
Enter the exit
command to exit the diskpart
command.
exit
Copy all the files from the old partition to the new partition.
xcopy s:\* t:\ /e /h /q
Restore the Ubuntu bootx64.efi
file.
del s:\EFI\Boot\bootx64.efi
ren s:\EFI\Boot\bootx64u.efi bootx64.efi
Enter the exit
command twice to close the window.
exit
The output produced when I entered these commands is shown below.
Microsoft Windows [Version 10.0.17763.107]
(c) 2018 Microsoft Corporation. All rights reserved.
X:\windows\system32>diskpart
Microsoft DiskPart version 10.0.17763.1
Copyright (C) Microsoft Corporation.
On computer: MININT-PVCCLL9
DISKPART> list disk
Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 300 GB 0 B *
DISKPART> select disk 0
Disk 0 is now the selected disk.
DISKPART> list partition
Partition ### Type Size Offset
------------- ---------------- ------- -------
Partition 1 System 200 MB 1024 KB
Partition 2 Primary 153 GB 201 MB
Partition 3 Unknown 3815 MB 153 GB
Partition 4 Unknown 142 GB 157 GB
DISKPART> select part 2
Partition 2 is now the selected partition.
DISKPART> shrink desired=200
DiskPart successfully shrunk the volume by: 200 MB
DISKPART> create partition efi
DiskPart succeeded in creating the specified partition.
DISKPART> format fs=fat32 label=EFI2 quick
100 percent completed
DiskPart successfully formatted the volume.
DISKPART> list partition
Partition ### Type Size Offset
------------- ---------------- ------- -------
Partition 1 System 200 MB 1024 KB
Partition 2 Primary 153 GB 201 MB
* Partition 3 System 200 MB 153 GB
Partition 4 Unknown 3815 MB 153 GB
Partition 5 Unknown 142 GB 157 GB
DISKPART> assign letter=t
DiskPart successfully assigned the drive letter or mount point.
DISKPART> select partition 1
Partition 1 is now the selected partition.
DISKPART> assign letter=s
DiskPart successfully assigned the drive letter or mount point.
DISKPART> exit
Leaving DiskPart...
X:\Windows\System32>xcopy s:\* t:\ /e /h /q
146 File(s) copied
X:\Windows\System32>del s:\EFI\Boot\bootx64.efi
X:\Windows\System32>ren s:\EFI\Boot\bootx64u.efi bootx64.efi
X:\Windows\System32>exit
Note: When finish, you may find the Startup Manager's selections confusing. If so, consider adding a Windows and/or Ubuntu icon to the Startup Manager menu.
Appendix
How to reinstall the Windows EFI boot files.
- Use the Boot Camp Assistant to create a Windows 10 USB flash drive installer. If you have problems do this, then see the question Boot Camp Assistant fails to create the USB installer from the Windows 10 October 2018 Update.
- With the flash drive inserted in a USB port, start (or restart) the Mac and hold down the option key until the Startup Manager icons appears. Select to boot from the USB drive icon labeled "EFI Boot".
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.
diskpart
list disk
Select the correct disk. I selected disk 0
. You will need to select the correct external drive from the drives listed.
select disk 0
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:
.
list volume
Assign the EFI
partition the letter S:
.
select partition 1
assign letter=s
Enter the exit
command to exit the diskpart
command.
exit
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.
bcdboot C:\Windows /s S: /f UEFI
Enter the command below to close the Command Prompt Window.
exit
Click on the red X
button and then select Yes
button to restart the Mac.