2

There are a lot of questions by those who have already bricked their macs trying to remove Linux so their questions usually stem from a position where one of the disk is labelled FFFF-FFFFFFFF-and more F's. They come from the angle of having already done something wrong.

I'm not in that position, and I'd rather not start by bricking my mac.

Does you have any ideas on how to properly remove Linux from my mac (this includes the hidden FFFF partition)?

Any help explained in a very basic manner would be much appreciated.

diskutil list below

<code>diskutil list</code>

It may also be worth mentioning that in both /dev/disk0 and /dev/disk1 there are gpt partitions when looked at via recovery mode.

to address the suspicious MBR sector I've used the command

sudo fdisk/dev/disk0

to give an inside look

enter image description here

  • Since you have the Suspicious MBR at sector 0 message, you should include the output from sudo fdisk /dev/disk0. – David Anderson Jan 26 at 0:07
  • The output from sudo fdisk /dev/disk0 shows that you already have errors in the partition tables. Basically, you have incorrect hybrid partitioning. The answer will have to be modified to reflex this. Which version of macOS are you using? – David Anderson Jan 26 at 0:56
  • @klanomath I didn't delete the partition yet since that's the issue people normally come across, I was trying to avoid the whole FFFF-FFFF-etc and the /dev/disk1 can only be viewed in recovery mode where I cannot screenshot, but I can photograph it if you'd like. – Artorius Castus Jan 26 at 1:13
  • @DavidAnderson Catalina. ver 10.15.2 – Artorius Castus Jan 26 at 1:14
  • Tried and tested, both sudo diskutil eraseVolume free none disk0s(X) commands DO work on Catalina – Artorius Castus Jan 26 at 1:24
3

Evidently, the tricky part is the removal of the Linux partitions (disk0s3 and disk0s4).

The last partition (disk0s4) is the Linux swap partition. The following command can be used to return this partition free space. This should also remove the hybrid partitioning in the Master Boot Record (MBR) Partition Table.

sudo diskutil eraseVolume free none disk0s4

The command below should return the remaining Linux partition (disk0s3) to free space. However, when tested under High Sierra (macOS 10.13.6), this command failed to work properly.

Note: When tested under Catalina (macOS 10.15.2), command below did work properly. However, after participating in discussions posted at this question, I can report the command may still fail under Catalina.

sudo diskutil eraseVolume free none disk0s3

The alternative way to remove this partition is to boot to macOS Recovery and use the command shown below. I would recommend using the command below over the above command. After entering the command below, you can boot back to macOS.

gpt -f remove -i 3 disk0 

The next command returns the free space back to the APFS container (disk0s2).

sudo diskutil apfs resizeContainer disk0s2 0

The next command mounts the EFI volume (disk0s1).

sudo diskutil mount disk0s1

The next command removes the linux boot files from the EFI volume. This will prevent Linux from appearing in the Startup Manager. With some versions of Linux, this folder may not exist.

rm -r /Volumes/EFI/EFI/BOOT

There will be other boot files remaining in the EFI volume. You do not have to remove these files if you do not wish to. The files will be in a folder named after the Linux that was installed. For example, with Ubuntu the command would be as follows.

rm -r /Volumes/EFI/EFI/Ubuntu

The next command unmounts the EFI volume (disk0s1).

sudo diskutil unmount disk0s1
| improve this answer | |
  • @klanomath: If the boot volume is APFS formatted, then High Sierra or newer version of macOS is being used. The diskutil command automatically converts hybrid partitioning back to pure GPT when used. This change in behavior of the diskutil command started with High Sierra. So, when disk0s4 was removed, so was the hybrid partitioning. – David Anderson Jan 26 at 12:15
  • Good to know... ;-) – klanomath Jan 26 at 12:26
  • @klanomath: The original gpt command required exclusive access to disk0 before making a change. At least since High Sierra, the -f option was added which allows shared access. So you no longer need a diskutil unmountDisk disk0 command to precede the use of a gpt command. This brought gpt inline with the abilities that fdisk and gdisk already had. In this case, removal of disk0s3 by gpt should do no harm, since macOS normally does not mount Linux volumes. – David Anderson Jan 26 at 12:33
  • Unmounting volumes and disks before issueing gpt ... commands became part of my flesh and blood so that I never realized/used the -f option... – klanomath Jan 26 at 12:40

You must log in to answer this question.

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