MacOS – Unable to boot into Mac OSX after updating dual-boot Ubuntu, Partition Type FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF

dual-boothard drivemacosmojavepartition

On my Mac OSX Mojave machine.. I installed Ubuntu 18.04 to attempt to dual boot on the internal Apple SSD. Worked for a while, but after some updates to Ubuntu… hitting the power button boots up to a GRUB terminal, and when hitting the option key there is no 'Macintosh HD' as a startup option.

I have seen 2 similar posts on this topic, but none of them appear to exactly match as far as partitions go here and here and I am hesitant to try something that would wipe out or corrupt my OSX data that I know is still on the SSD/drive.

When booting into recovery media, I executed the following command to list disks:

enter image description here

I notice the partition FFFFF-FFFF…

I then do a disktuil info /dev/disk0s2 to look at the info.
enter image description here

I then use GPT to check…

gpt -r show /dev/disk0

enter image description here

What can I do to make it so that I can fix my OSX boot partition without losing any files. The disk that my OSX files are stored are on disk0s2, which is the FFFFFFF partition… how do I fix up my ability to boot into the OSX Mojave without wiping out my data or is there a way? Does APFS have anything to do with this?

At this point I don't care about the Ubuntu 18.04 partition, but I do not want to lose any data on the 900+GB partition, which is all my the Mac files are.

Best Answer

Usually when the FFFFFFFF-FFFF-FFFF-FFFFFFFFFFFF error occurs, the partition starting and ending values are still correct. I assume this is true in your case. If I am correct, then you need to enter the following commands to change FFFFFFFF-FFFF-FFFF-FFFFFFFFFFFF to 7C3457EF-0000-11AA-AA11-00306543ECAC.

diskutil unmountdisk disk0
gpt remove -i 2 disk0
diskutil unmountdisk disk0
gpt add -i 2 -b 409640 -s 1900925984 -t apfs disk0

The EFI partition (disk0s1) is used occasionally by macOS, so you need to keep this partition. However, Grub files were added to this partition when you installed Ubuntu. The commands below will remove any Grub files that may still exist on the EFI partition . You can enter these commands while booted to macOS.

sudo diskutil mount disk0s1
cd /Volumes/EFI/EFI
rm -rf BOOT
rm -rf ubuntu
cd ~
diskutil unmount disk0s1

To add the free space back to macOS, enter the command given below. You can enter this command while booted to macOS.

sudo diskutil apfs resizeContainer disk0s2 0