2

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.

  • Is the recovery media on the flash drive? If so, what version of macOS? – David Anderson Jan 23 at 4:08
  • The recovery media I am using is Mojave (latest OSX version), it is just the OS installer on a usb stick. That is what I used to access the terminal as shown in the screen captures. Am hoping using it, I can somehow put in the right commands to fix my OSX boot partition. When I attempt to go to the "Select Startup Disk" GUI window, nothing shows up there. – Rolando Jan 23 at 4:11
  • So was Ubuntu only given 27 GB of space? – David Anderson Jan 23 at 4:21
  • Yes, Ubuntu 18.04 was only given 27 GB. That partition does not have any of my files on it (except for ubuntu related stuff that I am okay with getting rid of that partition if necessary). – Rolando Jan 23 at 4:23
1

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
  • Does this answer hold true given my response to your question: " So was Ubuntu only given 27 GB of space?" – Rolando Jan 23 at 4:26
  • The Ubuntu partition is gone. I assume Ubuntu was located in the 52874463 blocks of free space. (52874463 blocks * 512 bytes/block = 27,071,725,056 bytes = 27 GB) I assume the APFS container is in the 1900925984 blocks above the free space. If correct, my answer should work, although you might need a sudo. I also assume you do not need to disable SIP when booted from the flash drive. If you do, then I expect an error message. I suppose a hex dump would confirm my answer, but I do think the hexdump command is available. Another solution would involve booting to a live version of Ubuntu. – David Anderson Jan 23 at 4:54
  • I case you were wondering. Grub probably still exists in your EFI partition (disk0s1). This is why you are still able to boot to Grub. Ubuntu may still exist on the drive, but the Ubuntu partition is no longer listed in the GUID Partition Table (GPT). – David Anderson Jan 23 at 4:54
  • Upvoted. Thank you so much. You sir are a hero! If I don't want the Grub anymore (or anything Ubuntu decided to put on, are there other commands I can run to get rid of the Grub partition so it's as if I just had Mac on this machine?) – Rolando Jan 23 at 5:15

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.