The macOS installation on my ageing 2013-model MacBook Pro (MacBookPro10,2, "Early 2013") was becoming unusable, so I went on to replace it with Ubuntu. This worked as a charm, but after this I am unable to boot into the Windows installation on the separate partition. It was initially installed using Bootcamp, and was booting fine before I started. It was originally installed as Windows 7, later upgraded to Windows 8, 8.1 and 10.
I started out with a partition table looking like this (as seen from Linux):
- /dev/sda1 - EFI system partition
- /dev/sda2 - APFS macOS
- /dev/sda4 - BOOTCAMP (Windows)
I booted into the Ubuntu installer, and had it reformat /dev/sda2 as ext4 and mount as root. It discovered /dev/sda1, mounting it at /boot/efi. I also mount /dev/sda4 as /mnt/c without any problems (and all files are there).
Grub does not see the Windows partition (os-prober ignores EFI OSes, apparently) and pressing Alt during boot didn't show Windows any longer, so I installed rEFInd. It gave me a "Boot Windows (Legacy) from BOOTCAMP" option that boots into the Windows blue "Recovery" screen:
Your PC/Device needs to be repaired
The application or operating system couldn't be loaded because a required file is missing or contains errors.
File: \Windows\system32\winload.exe
Error code: 0xc000000e
From Ubuntu, I can see the winload.exe (and winload.efi) files there just fine.
Following the procedure set out in this guide, I used gdisk to update the protective MBR, making sure all three GPT partitions are also visible from the MBR.
Booting the Windows 10 USB and trying to run Startup Repair fails (with an empty log). Using the instructions from "How to fix the Windows 10 boot loader from Windows" I was able to create EFI boot files (bcdboot C:\windows /s D: /f UEFI). Booting into rEFInd, I can select the Windows bootloaded that I have now added. This fails with this message:
rEFInd - Booting OS
Starting bootmgfw.efi
Using load options ''
BlInitializeLibrary failed 0xc00000bb
Is the bootcamp installation of Windows special in some way, and have I screwed it up completely by removing the macOS partitions?
EDIT: As requested, here is what gdisk reports for disk partitions:
Disk /dev/sda: 490234752 sectors, 233.8 GiB
Model: APPLE SSD SM256E
Sector size (logical/physical): 512/4096 bytes
Disk identifier (GUID): 00001F0C-758C-0000-B55E-0000EB650000
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 490234718
Partitions will be aligned on 8-sector boundaries
Total free space is 1533 sectors (766.5 KiB)
Number Start (sector) End (sector) Size Code Name
1 40 409639 200.0 MiB EF00 EFI system partition
2 409640 338300263 161.1 GiB AF0A Customer
4 338300928 490233855 72.4 GiB EF00 BOOTCAMP
Here is how the protective MBR is set up:
Disk size is 490234752 sectors (233.8 GiB)
MBR disk identifier: 0xBC0E843F
MBR partitions:
Number Boot Start Sector End Sector Status Code
1 1 39 primary 0xEE
2 40 409639 primary 0xEF
3 409640 338300263 primary 0x83
4 * 338300928 490233855 primary 0x07
This is fairly close to how Apple BootCamp set up the partitions before I started, it also made all partitions visible in the MBR table.
The APFS partition (which now is formatted as ext4) did contain several sub-partitions, but I assumed I did not need any of those, but maybe the Apple bootloader used something in the EFI boot sequence?
EDIT: After messing around with the partitioning and bcdboot, os-prober adds an entry to run bootmgfw.efi. This does not boot (blank screen). Same result when trying to run that entry from rEFInd. I also tried to add a "chainloader +1" entry, but that is not supported from EFI Grub. In rEFInd if I select "Boot legacy whole disk application", or if I select "Windows" from the Apple Alt-bootmenu, I get the winload.exe error mentioned above.