1

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.

nafmo
  • 129

1 Answers1

1

Since you upgraded from Windows 7, your Mac should have a BIOS booting Windows 10. Below are some errors I found in your current configuration. Post a comment if you do not understand how to fix any of these errors.

Partitioning Errors

The output from gdisk should appear as shown below.

For the GUID Partition Table (GPT):

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 8300 Customer 3 338300928 490233855 72.4 GiB 0700 BOOTCAMP

I believe the above differs from you output in the following ways.

  • My entries are sorted.
  • The codes for the Linux and Windows partition are different.

For the MBR Partition Table:

Disk size is 490234752 sectors (233.8 GiB)
MBR disk identifier: 0xBC0E843F
MBR partitions:

Number Boot Start Sector End Sector Status Code 1 1 409639 primary 0xEE 2 409640 338300263 primary 0x83 3 * 338300928 490233855 primary 0x07

I believe the above differs from you output in the following ways.

  • The first partition should cover EFI partition given in the GPT.
  • Since the EFI partition should not exist in the MBR, the Linux and Windows partitions are numbered differently.

Linux Boot Files

An Ubuntu installation should be bootable from the Mac Startup Manager. This is where you hold down the option at startup until the icons appear. From Ubuntu, the following files should appear in the EFI partition. The files below are from an installation of Ubuntu 24.04 LTS Desktop.

$ ls -l /boot/efi/EFI/BOOT
total 1868
-rwxr-xr-x 1 root root 966664 Jun  3 10:43 BOOTX64.EFI
-rwxr-xr-x 1 root root  88344 Jun  3 10:43 fbx64.efi
-rwxr-xr-x 1 root root 856280 Jun  3 10:43 mmx64.efi
$ ls -l /boot/efi/EFI/ubuntu/
total 4376
-rwxr-xr-x 1 root root     108 Jun  3 10:43 BOOTX64.CSV
-rwxr-xr-x 1 root root     126 Jun  3 10:43 grub.cfg
-rwxr-xr-x 1 root root 2656136 Jun  3 10:43 grubx64.efi
-rwxr-xr-x 1 root root  856280 Jun  3 10:43 mmx64.efi
-rwxr-xr-x 1 root root  966664 Jun  3 10:43 shimx64.efi

Note: The contents of the BOOTX64.EFI file is the same as the contents of the shimx64.efi file and both mmx64.efi files are the same.

Your installation of the UEFI boot files for Windows should have created and added files to the following folders.

/boot/efi/EFI/Boot
/boot/efi/EFI/Microsoft

A single file named bootx64.efi should have been written to /boot/efi/EFI/Boot folder, which overwrites any existing BOOTX64.EFI file placed there by a previous Ubuntu installation. This file can be replaced by the contents of /boot/efi/EFI/ubuntu/shimx64.efi file. The /boot/efi/EFI/Microsoft folder can be removed.

Windows Booting Errors

You installed the Windows boot files for UEFI booting. This is incorrect. You should have installed for BIOS booting. To install, you will first have to boot from a Windows 10 installation USB drive. Open a Command Prompt window and enter the following commands.

bcdboot c:\windows /s c: /f bios
bootsect /nt60 c: /mbr

You should now be able to BIOS boot Windows from the Mac Startup Manager. This is where you hold down the option at startup until the icons appear.