How to make Mac Partition boot again on Catalina/Ubuntu 20.04 Dual Boot

bootcatalinaefipartition

I am using a 2011 MacBook Pro 15", this is the model with the AMD GPU problems and I have used the NVRAM modification to disable the AMD GPU and then Dosdude's patch to install Catalina.

This is a usable laptop with an i7 and 16GB of RAM so it runs Catalina fine. A month or so ago, I partitioned the drive and Installed Ubuntu 20.04, changing the Grub configuration to disable the faulty GPU and force it to use the integrated Intel GPU. I use Refind as a boot manager and all was well until I tried to boot Mac OS today.

A couple of days ago, I wanted to make more space for Ubuntu as I found I was using it a lot. I repartitioned the Mac APFS partition to give another 50GB of space that I planned to add to the Ubuntu partition. I then continued to use Mac OS for 2 days, sleeping instead of shutting it down. Last night I shut it down and this morning the Mac partition does not appear in Refind or in the ALT boot menu. Ubuntu still boots and I can still "see" the Mac partition from Gparted. It looks like the GPT is corrupt but I am not sure how to use Gdisk to fix it from Ubuntu.

This is my lsblk readout from Ubuntu…

    $ lsblk
    NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
    loop0    7:0    0  49.8M  1 loop /snap/snap-store/433
    loop1    7:1    0 144.4M  1 loop /snap/code/38
    loop2    7:2    0 240.8M  1 loop /snap/gnome-3-34-1804/24
    loop3    7:3    0    55M  1 loop /snap/core18/1754
    loop4    7:4    0    97M  1 loop /snap/core/9665
    loop5    7:5    0  29.9M  1 loop /snap/snapd/8542
    loop6    7:6    0 255.6M  1 loop /snap/gnome-3-34-1804/36
    loop7    7:7    0 800.4M  1 loop /snap/android-studio/90
    loop8    7:8    0   9.1M  1 loop /snap/canonical-livepatch/95
    loop9    7:9    0    55M  1 loop /snap/core18/1880
    loop10   7:10   0  29.8M  1 loop /snap/snapd/8140
    loop11   7:11   0  49.8M  1 loop /snap/snap-store/467
    loop12   7:12   0 800.4M  1 loop /snap/android-studio/91
    loop13   7:13   0 141.6M  1 loop /snap/code/39
    loop14   7:14   0  96.5M  1 loop /snap/core/9436
    loop15   7:15   0  62.1M  1 loop /snap/gtk-common-themes/1506
    sda      8:0    0 698.7G  0 disk 
    ├─sda1   8:1    0   200M  0 part /boot/efi
    ├─sda2   8:2    0 465.7G  0 part 
    └─sda4   8:4    0 187.3G  0 part /
    sr0     11:0    1  1024M  0 rom  

The Mac partition is sda2 and the Ubuntu partition is sda4, the new empty space I created would be sda3 but is currently empty space.

My Gdisk initial readout is:

    sudo gdisk /dev/sda
    GPT fdisk (gdisk) version 1.0.5

    Partition table scan:
    MBR: hybrid
    BSD: not present
    APM: not present
    GPT: present

    Found valid GPT with hybrid MBR; using GPT.

Can anyone guide me in what I need to do to get Mac OS booting again…

Here is the first piece of requested information:

$ sudo gdisk -l /dev/sda
 
GPT fdisk (gdisk) version 1.0.5

Partition table scan:
  MBR: hybrid
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with hybrid MBR; using GPT.
Disk /dev/sda: 1465149168 sectors, 698.6 GiB
Model: TOSHIBA MK7559GS
Sector size (logical/physical): 512/4096 bytes
Disk identifier (GUID): 6C152A2F-A973-45DC-8157-2C45FDEDF3E7
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 1465149134
Partitions will be aligned on 8-sector boundaries
Total free space is 95220781 sectors (45.4 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              40          409639   200.0 MiB   EF00  EFI System Partition
   2          409640       977103527   465.7 GiB   FFFF  
   4      1072322560      1465147391   187.3 GiB   8300

and here is the second bit:

sudo fdisk -l /dev/sda
Disk /dev/sda: 698.65 GiB, 750156374016 bytes, 1465149168 sectors
Disk model: TOSHIBA MK7559GS
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 6C152A2F-A973-45DC-8157-2C45FDEDF3E7

Device          Start        End   Sectors   Size Type
/dev/sda1          40     409639    409600   200M EFI System
/dev/sda2      409640  977103527 976693888 465.7G unknown
/dev/sda4  1072322560 1465147391 392824832 187.3G Linux filesystem

I can't currently get into recovery mode as there is no recovery partition and the wifi is via a usb dongle.

Best Answer

The type GUID for partition 2 of /dev/sda is wrong. The commands below will correct the problem. Enter the commands in an Ubuntu terminal window.

sudo gdisk /dev/sda
t
2
AF0A
w
y