Triple Boot: "Missing operating system" on Windows 7 partition after Ubuntu installation

I tried to install Ubuntu (without rEFInd) and followed this article on how to achieve that on a dual boot Mac (macOS and Windows): Installing Ubuntu on Mac with macOS and Windows already installed

After resizing & creating new partitions on the hard drive and installing Ubuntu successfully, when trying to launch Windows 7 again the message "No operating system" is shown now though.

I tried repairing the Windows partition with a Windows recovery USB drive, as mentioned on this website: http://www.crabtree-consulting.com/boot-camp-windows-7-repair-for-missing-operating-system-error/

Unfortunately Windows' "diskpart" doesn't show all the partitions and repairing doesn't seem possible as mentioned.

Now I'm lost finding out how to repair the Windows partition, either in macOS or in the Windows recovery tools.

MacBook Pro late 2013, macOS Sierra, Windows 7, Ubuntu 18.04

Any help is gladly appreciated. Thanks a lot in advance!

diskutil list disk0:

diskutil list disk0

sudo gpt -r show /dev/disk0:

sudo gpt -r show /dev/disk0

sudo fdisk /dev/disk0:

sudo fdisk /dev/disk0


Solution 1:

I was able to fix the issue.

The MBR table was messed up after installing Ubuntu. Windows needs an active partition entry in this table. In my case partition #7 (checking the output of diskutil list disk0) had to be written into the MBR again.

The MBR is visible with: sudo fdisk /dev/disk0

To recreate the MBR I used the gdisk tool which made it easier, available here: https://sourceforge.net/projects/gptfdisk/

To allow editing the MBR the SIP had to be disabled first temporarily as follows:

  1. boot in Recovery OS by holding Command + R
  2. go to Utilities -> Terminal
  3. enter csrutil disable

Then after restarting and back in macOS again I entered following commands:

  1. sudo gdisk /dev/disk0
  2. r (Recovery/Transformation)
  3. h (make hybrid MBR)
  4. 7 (GPT partition # I wanted to add)
  5. y (placing EFI partition first in the MBR)
  6. enter (for default MBR hex code 07)
  7. y (set bootable flag)
  8. n (no more partitions)
  9. o (check new MBR)
  10. w (write new MBR)
  11. y (proceed)

Finally enabling the SIP in recovery mode with csrutil enable again.

The final MBR looks as follows (sudo fdisk /dev/disk0):

Disk: /dev/disk0    geometry: 60821/255/63 [977105060 sectors]
Signature: 0xAA55
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: EE    0   0   2 - 1023 254  63 [         1 -  785698815] <Unknown ID>
*2: 07 1023 254  63 - 1023 254  63 [ 785698816 -  191406080] HPFS/QNX/AUX
 3: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 4: 00    0   0   0 -    0   0   0 [         0 -          0] unused

Helpful was this post to explain the GPT and (hybrid) MBR things: https://superuser.com/questions/1216055/hybrid-mbr-triple-boot-on-a-macbook

as well as this one on how to actually use gdisk: http://nerdr.com/bootcamp-partition-lost-repairing-mac-partitions/