MacOS – Multiple GUID_partition_scheme, cant boot MacOS High Sierra, and gpt command resource busy
disk-utilityhigh sierramacospartition
I have a problem after deleting Kali OS from my dual-boot Macbook (with High-Sierra MacOS). The problem is:
I can only boot into internet-recovery-mode
I can not use gpt command, as it results: 'resource busy'
Best Answer
The partition types got hosed by removing Kali Linux. Disk0s2 and disk0s3 got the wrong types. I would expect some Apple partition type for disk0s2 (HFS+/CoreStorage/APFS) and a Linux partition type for disk0s3. Disk0s4 is probably some dispensable Linux boot/swap partition.
To regain access to macOS you have to modify the partition type of disk0s2.
Boot to Internet Recovery Mode
In the menubar open Terminal.app and enter:
diskutil list
gpt -r show disk0
to get all partition and volume details of the internal SSD
Unmount all disk0 related volumes and disks (in your example that's disk2 (based on disk0s3), disk0s4 and finally disk0). Examples: diskutil unmountVolume disk0s4 or diskutil unmountDisk disk0.
Remove the APFS container disk2: diskutil ap deleteContainer disk2
Remove disk0s3 and disk0s4 (either with diskutil or gpt).
Example: diskutil eraseVolume "Free Space" Nil disk0s4
Determine the partition type of disk0s2 (How can I make my Mac partition bootable again?) and remove and re-add disk0s2 using gpt with the same size but the proper type. Considering the macOS version (10.13) and the hardware (SSD) the proper partition type is probably 7C3457EF-0000-11AA-AA11-00306543ECAC (APFS) instead of FFFFFFFF-FFFF….
Expand disk0s2 with diskutil ap resizeContainer disk0s2 0.
Under certain circumstances you have to disable SIP to edit the partition table with gpt!
I have managed to get Kali Linux running from USB with persistence, on a Macbook Pro (Retina, 15-inch, Mid 2015) with macOS Sierra.
Here's my guide explaining the process I used. I've tried to make it easy to follow, whilst still being as detailed as possible.
Part 1: Preparing the USB
Note: if you don't want persistence, just create 1 partition and finish the guide at part 3.
Open disk utility (Finder > Applications > Utilities > Disk Utility).
Select your USB device.
Choose erase.
Name: Untitled | Format: Mac OS Extended (Journaled) | Scheme: GUID Partition Map.
Click done.
Select your newly formatted USB device.
Choose partition.
Click the "+" symbol at the bottom of the window.
Name (left partition): Persistence | Name (right partition): Kali Linux.
Format (both partitions): MS-DOS (FAT).
Click apply.
Click partition.
After this process, your partitions (Kali Linux and Persistence) may have renamed themselves to "K L" and "P" respectively. If this does happen, simply rename them, and follow the rest of this guide.
Part 2: Installation
Download your ISO of choice (I have tested this with Kali Linux full).
Best Answer
The partition types got hosed by removing Kali Linux. Disk0s2 and disk0s3 got the wrong types. I would expect some Apple partition type for disk0s2 (HFS+/CoreStorage/APFS) and a Linux partition type for disk0s3. Disk0s4 is probably some dispensable Linux boot/swap partition.
To regain access to macOS you have to modify the partition type of disk0s2.
In the menubar open Terminal.app and enter:
to get all partition and volume details of the internal SSD
diskutil unmountVolume disk0s4
ordiskutil unmountDisk disk0
.diskutil ap deleteContainer disk2
diskutil eraseVolume "Free Space" Nil disk0s4
diskutil ap resizeContainer disk0s2 0
.Under certain circumstances you have to disable SIP to edit the partition table with gpt!