1

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

18
  • I apologize for the initial confusion - I missed your clear question initially. Let me know if the articles are too basic or don’t work / need an explainer for one step…
    – bmike
    May 29, 2021 at 13:16
  • Can you add at your question the result of terminal command diskutil list from recovery mode?
    – user415185
    May 29, 2021 at 13:21
  • Hi Jean_JD, certainly ! I have edited the question and added images, do let me know for any further info needed.
    – Chris
    May 29, 2021 at 14:25
  • Have you try boot pushing the alt key only? You have boot on an old recovery version that don't recognize apfs format. Can you try the internet recovery (cmd alt shift keys at boot)?
    – user415185
    May 29, 2021 at 14:34
  • I'm afraid that is the internet recovery which is the only option when booting with the "alt/option" key pressed.
    – Chris
    May 29, 2021 at 14:49

2 Answers 2

1

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.

5
  • HI David Anderson, would just like to confirm, will I be able to boot back into my macOS after performing step 2 ? Because currently there's no option to do that.
    – Chris
    May 30, 2021 at 4:54
  • Yes, you should be able to use the Mac Startup Manager to boot to macOS. May 30, 2021 at 7:08
  • Followed the steps, worked like a charm, Thank you so much for the help ! Btw, there were no extra icons in the Mac Startup Manager, but instead it boots to GRUB with no key pressed, and when booting with "Alt/Option" key pressed it boots to the Mac Startup Manager with just one option: Macintosh HD.
    – Chris
    May 30, 2021 at 8:57
  • To make macOS the default when no key is pressed, you can either hold down the control key while selecting macOS from the Startup Manager or select macOS from the Startup pane of System Preferences. Removing the boot (Grub) files used by Kali is optional. These files are small in size and harmless. May 30, 2021 at 9:14
  • Very well noted , once again, thank you so much !
    – Chris
    May 30, 2021 at 9:17
0

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.

1
  • Hi bmike, thank you for the help, I have edited the question with images. Hope they help to better portray my situation.
    – Chris
    May 29, 2021 at 14:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .