Question

Please excuse my english, I have a macbook air 2013 which dual-boots Kali and Mojave. The macbook when powered on boots into Kali and if i wish to use Mojave, i boot holding the option key.

Recently, wishing to remove Kali and turn my mac back into a single boot, I have deleted the Kali partition from Mojave using DiskUtility by simply selecting the 64GB Kali partition and clicking the minus "-" sign, then being unable to resize my 64 GB Mojave partition, i tried rebooting hoping that the system would auto-reclaim the space. But instead, the mac can no longer be booted into MacOS, the only option showing is Internet Recovery.

What I've tried

I've gone into internet recovery mode.The "Reinstall OS X" option does not show any disks at the "Select disk to install to" screen though the 64 GB Mojave partition can be found in disk utility and terminal using the diskutil list command.
Note: The 64 GB Kali partition is not found in DiskUtility and diskutil list.

Problems

  • Cannot boot into Mojave anymore.
  • Cannot see the 64 GB Kali partition.

Desired results

  • Boot into Mojave with disk size to full 128 GB as single boot, removing GRUB.

Could you please help provide a step by step solution to solve this problem ? Any help is much appreciated, thank you !

Images

Please find images below to help troubleshoot, please do feel free to request for additional captures.

Terminal with command gpt -r show /dev/disk0:https://imgur.com/s3ZTx3e

Terminal with command diskutil list: https://imgur.com/nFUeAxg

DiskUtility Apple SSD: https://imgur.com/KbtAR4a

DiskUtility_disk0s2: https://imgur.com/lSoROpT

DiskUtility_disk03: https://imgur.com/JxTJaeZ

DiskUtility_MacOSBaseSystem: https://imgur.com/q9iHA0R

Boot

Booting without pressing any key: https://imgur.com/2xtZIye

Booting with Alt/Option key pressed: https://imgur.com/iSZsaJa

Was it helpful?

Solution

Most people install Linux by first using macOS to create free space, then use a Linux installer to create the Linux partition(s). The Linux installer usually exists on a bootable flash drive. The installer also puts Linux boot files in the hidden EFI partition. Here, I assume this is how you installed Kali.

The proper method to uninstall Linux is to do the reverse. Use the Linux installer to remove the Linux partitions, then use macOS to reclaim the drive space created when the the Linux partitions were removed. You can use macOS or the Linux installer to remove the Linux boot files from the hidden EFI partition.

However, when you use macOS Disk Utility application or diskutil command to remove a Linux partition, Apple punishes you by changing the GUID Partition Table (GPT) type to FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF for the partition where macOS is stored. You can see this in image you posted, which is shown below after cropping. This change prevents macOS from booting. Also, macOS will not appear in the Mac Startup Manager.

diskutil

The steps given below first removes the Linux swap partition (disk0s3) from the GPT. Next, the partition containing macOS is removed from the GPT. This does not alter the contents of the of the APFS container where macOS is stored. Finally, the partition containing macOS is added back to the GPT with the correct type of 7C3457EF-0000-11AA-AA11-00306543ECAC. (If interested, a list of common partition types is given here.) The values of 409640 and 125000000, used in step 2, where taken from an image you posted, which is shown below after cropping.

gpt

Once the partition containing macOS has the correct type, macOS should appear in the Mac Startup Manager. (The Mac Startup Manager icons appear when you hold down the option at startup.)

Follow the steps given below to fix the GPT.

  1. Use the key combination Option-⌘-R to boot to macOS Recovery over the Internet.

  2. Enter the commands below in a Terminal application window.

    diskutil unmountdisk disk0
    gpt remove -i 3 disk0
    diskutil unmountdisk disk0
    gpt remove -i 2 disk0
    diskutil unmountdisk disk0
    gpt add -i 2 -b 409640 -s 125000000 -t 7C3457EF-0000-11AA-AA11-00306543ECAC disk0
    
  3. Boot back to macOS.

  4. Enter the command given below to recover the free space.

    sudo diskutil apfs resizeContainer disk0s2 0
    

Note: Your Mac may still have the Linux boot files stored in the hidden EFI partition. This may cause an extra icon to appear in the Mac Startup Manager.

OTHER TIPS

Since you can boot to internet recovery - what happens when you select Utilities and erase the entire disk?

If you don’t see the disk - there is a side article from this link to follow:

Or you could run diskutil list from the terminal utility from Internet Recovery and post that so we could understand the exact state of your disk. I think this should get sorted somewhat quickly since you just want to wipe and reinstall the easy OS as a next step.

Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange
scroll top