3

I installed Ubuntu in dual boot on my Mac without using rEFInd. Initially everything worked fine, I could access both systems. Later, in an attempt to remove Ubuntu, I deleted a partition I had created for swap and since then GRUB has replaced the Mac's boot loader. So now I can only access Ubuntu. I would like to be able to access macOS again without losing any data. How can I do that?

The GParted image shown below was taken while booted to Ubuntu.

Current situation

Update

Thanks to internet recovery, I was able to open the Terminal. Below is the result.

enter image description here

4
  • When you boot pushing the alt key have you the Mac os X choice?
    – user415185
    Nov 10, 2021 at 19:07
  • No, this is the problem
    – pino
    Nov 10, 2021 at 22:55
  • Can you create a install USB KEY of your Mac os x version, then boot with it an from the terminal (on top menu/Utility give the results of command diskutil list internal ?
    – user415185
    Nov 11, 2021 at 8:50
  • @Jean_JD has the right idea. However, posting the output from sudo gdisk -l /dev/sda from an Ubuntu Terminal application window would be quicker and simpler to implement. In either case, the commands will not change your Mac. The idea is just to see what is in the GUID partition table (GPT). Nov 11, 2021 at 11:36

1 Answer 1

2

When the diskutil command or the Disk Utility application is applied to a drive which has Linux type partitions, the partition type GUID stored in the GUID Partition Table (GPT) for a macOS partition is often changed to FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF. The GParted image you posted in your question will not show this change. In other words, if the partition type GUID for /dev/sda2 had been changed from 7C3457EF-0000-11AA-AA11-00306543ECAC to FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF, then the file system shown in GParted will still remain apfs. This is because GParted looks at the content of the partition to determine the filesystem and not at the partition type GUID. However, the Mac firmware (Mac Startup Manager) does look at the partition type GUID when displaying possible operating systems to boot from.

One possible way to determine, if the partition type GUID for /dev/sda2 is 7C3457EF-0000-11AA-AA11-00306543ECAC, is to view the output from the command shown below. This command needs to be entered in an Ubuntu Terminal application window. (From the Ubuntu desktop, press the key combination option+control+T to open a Terminal application window.)

sudo gdisk -l /dev/sda

You should see the code AF0A. If you see code FFFF then partition type GUID is probably FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF. If necessary, you can change the partition type GUID back to 7C3457EF-0000-11AA-AA11-00306543ECAC by entering the command and interactive input shown below. Here I assume number for this partition is 2. If not, then make the appropriate substitution below.

sudo gdisk /dev/sda
t
2
AF0A
w
y

Note: The gdisk command uses 4 character codes to represent the much longer partition type GUIDs.

A Clarification Regarding the Question

In your question you state "GRUB has replaced the Mac's boot loader". Actually, this is impossible. The Mac boot loader is implemented in firmware. In your case, the Macs boot loader is boot loading GRUB and then GRUB is boot loading Ubuntu.

 

2
  • 1
    thank you ! I was able to fix it. You saved me :)
    – pino
    Nov 11, 2021 at 14:51
  • 1
    If you accept my answer, then a green check mark will appear next to my answer. This will show others a solution was found to your question. Nov 11, 2021 at 15:55

You must log in to answer this question.

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