How to make macOS APFS Container show up in the boot menu again

bootbootcamphigh sierrapartition

I used to have a triple-boot setup with macOS, Bootcamp and Debian on a Macbook Pro 2015 w/ High Sierria. I do not use alternative boot menus (i.e. rEFInd etc). macOS and Bootcamp would show up in the "ALT-menu", a normal boot would go to grub and Debian. I removed my linux swap and root partitions (from macOS using DiskUtility) to open up some space on the drive and now macOS drive doesn't show up in the "ALT-menu".

My problem is a little similar to this one except APFS container shows up in Internet Recovery but is listed as an "Image". (at the moment I can't provide a screenshot for this. Basically, they were listed separately under the Windows drives with much smaller capacity listing (~2-3 GB))

Using a live linux stick, APFS drive is named sda2. here are some read outs:

  • fdisk -l for the hard disk

    Disk /dev/sda: 465.9 GiB, 500277790720 bytes, 977105060 sectors
    Disk model: APPLE SSD SM0512
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytes
    Disklabel type: gpt
    Disk identifier: D0E4615B-509C-4516-9787-A0C116837A4E
    
    Device         Start       End   Sectors   Size Type
    /dev/sda1         40    409639    409600   200M EFI System
    /dev/sda2     409640 756269007 755859368 360.4G EFI System
    /dev/sda4  829251584 879316991  50065408  23.9G Microsoft basic data
    /dev/sda5  879316992 977104895  97787904  46.6G Microsoft basic data
    
  • apfsutil /dev/sda2

    Volume 0 D5E22857-2B7D-3590-BF9E-87F9FBD6398C
    ---------------------------------------------
    Role:               No specific role
    Name:               Macintosh HD (Case-insensitive)
    Capacity Consumed:  372848881664 Bytes
    FileVault:          Yes
    
    Volume 1 8055269A-5FAC-40A6-ABE1-879B688E5755
    ---------------------------------------------
    Role:               Preboot
    Name:               Preboot (Case-insensitive)
    Capacity Consumed:  22323200 Bytes
    FileVault:          No
    
    Volume 2 856749D1-B62E-4B9B-AE80-E120E9F47C07
    ---------------------------------------------
    Role:               Recovery
    Name:               Recovery (Case-insensitive)
    Capacity Consumed:  514936832 Bytes
    FileVault:          No
    
    Volume 3 92FC4412-ABD5-4836-89BE-9301F19E5CEC
    ---------------------------------------------
    Role:               VM
    Name:               VM (Case-insensitive)
    Capacity Consumed:  2147594240 Bytes
    FileVault:          No
    
  • gparted screenshot (shows the empty space as well)

gparted screenshot showing bootflags and the empty space as well

I tried adding the boot flag to sda2 to see if it would boot, but it didn't. (in other words, partition didn't have that flag at first. This screenshot was taken later) also, the Fat32 drive is only for shared files and nothing else. Also, I still have grub installed.

Best Answer

You could try using gdisk to change the second partition to type AF0A. Note: klanomath's answer lacks the gpt remove ... command due to the nature of the question you have referenced. The type AF0A exists in versions 1.0.4 and 1.0.5 of gdisk. If you have an older version, then you have to enter the type given below.

7C3457EF-0000-11AA-AA11-00306543ECAC