Triple Booting Mac, Windows, and Linux—A boot load nightmare

bootbootcamppartition

A few months ago I installed Ubuntu on my mac; I was dual booting. I did so following this tutorial. In this guide, I was instructed to install rEFInd; I did. Everything was good for those few months until now. The install was successful and my boot loader we rEFInd.

A few days ago, I decided that I needed to install Windows (I was itching to play some good ole' AoE 2!). I did this using boot camp.

After Windows was done doing its thing and the boot camp Windows add-ons were installed, I tried to switch back to the macOS side of the machine. I restarted the machine, held down option (entered in my firmware password), and expected to see the rEFInd boot loader (mistakenly, of course). Instead, I saw the macOS boot loader, only the only bootable device was windows. Yep, macOS and Linux were both unable to be seen from the boot loader after holding down the option key when restarting the machine; the only bootable device was Windows.

I booted up into macOS from a recovery USB that I had handy. When I did so and I opened up disk utility. The disk utility program from the live USB could see the three partition that I had—one for macOS, one for Windows, and one for Linux. The sizes of each of the partitions were correct, however something odd was going on. The Windows partition was recognized as a Bootcamp Windows partition. The Linux partition was only recognized as a Linux filesystem. The macOS partition was not recognized as a valid partition at all. It was blank space, in the eyes of this live USB disk utility program.

Next, I booted into recovery mode on the native machine (letting the machine download the internet recovery mode device). Here, the disk utility program only recognized the Bootcamp partition as the only valid partition. Both the Linux and macOS partitions were unmountable, both from disk utility and from the terminal.

At this point, I called Apple Support and their only advice was to wipe the entire disk and reinstall all three operating systems.

Well, I didn't do that. I reinstalled macOS because I keep a backup copy of all of my data so this wasn't a big deal to me.

Now, on this fresh install of macOS (the most recent version, 10.13.2). Disk utility recognizes Windows and macOS, but it won't recognize the Linux partition, even as a Linux filesystem. I can still see the partition that I made for it a few months ago, but it appears that I would have to delete and reinstall Linux to boot into it again. I don't keep a backup of that, unfortunately, because I only do tiny projects on there. There is currently one tiny project that I actually care about that I would rather not lose.

Further, rEFInd will not boot up when I restart and press the option key. Yes, I have disabled SIP and installed it from macOS. Yes, I have installed it from a USB while in recovery mode.

My two questions:
1. How do I make rEFInd be the default bootloader. When you answer this, please understand that I have already followed the instructions form the rEFInd webiste found here.
2. If number 1 cannot happen, how can I get disk utility to recognize the Linux partition (which it did before I tried to install Windows with boot camp by the way)?

EDIT: Responding to more information

Model/Year: Late 2013 Macbook Pro
Windows Version: Windows 10 Education edition

$ diskutil list 
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.3 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                 Apple_APFS Container disk1         350.0 GB   disk0s2
   3:       Microsoft Basic Data BOOTCAMP                100.1 GB   disk0s3
   4:           Linux Filesystem                         50.0 GB    disk0s4

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +350.0 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume macOS                   85.2 GB    disk1s1
   2:                APFS Volume Preboot                 20.3 MB    disk1s2
   3:                APFS Volume Recovery                506.6 MB   disk1s3
   4:                APFS Volume VM                      1.1 GB     disk1s4

/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     Apple_partition_scheme                        *62.0 GB    disk2
   1:        Apple_partition_map                         32.3 KB    disk2s1
   2:                  Apple_HFS Traveldrive             61.8 GB    disk2s3

$ sudo gpt -r show /dev/disk0
      start       size  index  contents
          0          1         PMBR
          1          1         Pri GPT header
          2         32         Pri GPT table
         34          6         
         40     409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
     409640  683595736      2  GPT part - 7C3457EF-0000-11AA-AA11-00306543ECAC
  684005376  195442688      3  GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
  879448064        704         
  879448768   97656256      4  GPT part - 0FC63DAF-8483-4772-8E79-3D69D8477DE4
  977105024          3         
  977105027         32         Sec GPT table
  977105059          1         Sec GPT header

$ 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 1023 254  63 - 1023 254  63 [         1 -  977105059] <Unknown ID>
 2: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 3: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 4: 00    0   0   0 -    0   0   0 [         0 -          0] unused  

Best Answer

As for your first question:

As you probably have already read from the rEFInd web site, the commands. to make rEFInd appear at startup are given below. You would have to enter these commands after booting to the macOS 10.13.2 recovery partition. You could enter the commands while booted to macOS 10.13.2, but you first would have to disable System Integrity Protection.

diskutil  mount  disk0s1
sudo  bless  --mount  /Volumes/EFI  --setBoot  --file  /Volumes/EFI/EFI/refind/refind_x64.efi  --shortform
diskutil  unmount  disk0s1

If the above does not work, then rEFInd is not installed as you described in your question.

As for your second question:

I an not sure why you are worried if the disk utility can recognize your linux partition. Unless you have installed some third party software, macOS can not read linux formatted partitions. Your question gives no indication that you have install such software. Anyway, the output from the diskutil list command shows that the linux partition is being correctly recognized.

If the files on the linux partition are important, then I would think the first priority would be to remove the files from the internal disk. This could be done by creating a a Ubuntu bootable flash drive and boot to a Live version of Ubuntu. If you can access your files, then I would copy the files to a second backup flash drive or other external drive.

Just to let you know:

If you do decide to start over, I would suggest installing the operating systems in the following order.

  1. Install macOS
  2. Use the Boot Camp Assistant to install Windows.
  3. Install Ubuntu using the instructions given here.
  4. (Optional) Install rEFInd.