Unable to Boot into Mac OS X after installing Ubuntu

First thing first, my MacBook Air partitioned into Ubuntu (30Gb) and OS X(91.2 Gb) was working fine until it started draining huge battery, lagging intensely and heating up. I figured out that this is probably due to some background process going on so tried restarting it multiple times by closing 'running applications' and finally forced shutdown it and after that it again started working fine.

Though now i can't boot into Ubuntu for some reason. Earlier, to boot into Ubuntu i had to do nothing after pressing power button, but, to boot into OS X needed to press (option key) which would only show Macintosh HD but not Ubuntu at Startup Boot menu where available options are shown.

Since now i cant use Ubuntu and there wasn't any important data in it, I decided to re-install it. Before doing that I tried if I can consume that partition memory back into Mac by clicking on (-) sign in Disk utility but end result was 91Gb in whole partition map instead of 125Gb.

Then i installed Ubuntu using live bootable pen-drive (pressing option key while booting), but saw no Apple logo or Macintosh HD as a startup booting option after pressing Option Key.Installation was done in the same 30Gb partition further divided into 20+5+5 for main storage, swap and root. Then I installed rEFind on Ubuntu, changed the boot order using efibootmgr. While doing this I could see that Mac OS X is there somewhere but laptop is unable to boot into it.

screenshot of original boot order

screenshot of changed boot order

But still its not working. I did this earlier also but after booting into Ubuntu order again changed to original itself.

When I keep pressing option key, blank window asking about available wireless connection comes with no option to boot into. On pressing Cmd+R, Internet recovery opens but it is unable to detect 91Gb separately, and 'First Aid' on whole 125 Gb hard drive gave no issues. Tried to use rEFIT but couldn't implement it properly.

I tried to see available partition and result are as follows:

df lsblk

What should I do now in order to retrieve my OS X back specially the data because its really important. Please help ASAP. Thanks in advance

In response to @Jivan Pal I'm attaching the output as asked

sudo efibootmgr -v
BootCurrent: 0002
Timeout: 5 seconds
BootOrder: 0080,0002,0001,0000
Boot0000* ubuntu    HD(1,GPT,2cf1486a-dfd0-4713-bf7f-c0e3ffbeefe6,0x28,0x64000)/File(\EFI\ubuntu\shimx64.efi)
Boot0001* rEFInd Boot Manager   HD(1,GPT,2cf1486a-dfd0-4713-bf7f-c0e3ffbeefe6,0x28,0x64000)/File(\EFI\refind\refind_x64.efi)
Boot0002* rEFInd Boot Manager   HD(1,GPT,2cf1486a-dfd0-4713-bf7f-c0e3ffbeefe6,0x28,0x64000)/File(\EFI\refind\shimx64.efi)
Boot0080* Mac OS X  PciRoot(0x0)/Pci(0x1c,0x5)/Pci(0x0,0x0)/Sata(0,0,0)/HD(2,GPT,ac52d162-21b9-418e-8f91-5888580a1b5a,0x64028,0xa9badd8)/VenMedia(be74fcf7-0b7c-49f3-9147-01f4042e6842,46cb5ae7b6815843884d5271d9758929)/File(\27B82774-58EC-4B16-9F76-DBC35E0A064E\System\Library\CoreServices\boot.efi)
Boot0082*   PciRoot(0x0)/Pci(0x1c,0x5)/Pci(0x0,0x0)/Sata(0,0,0)/HD(2,GPT,ac52d162-21b9-418e-8f91-5888580a1b5a,0x64028,0xa9badd8)/VenMedia(be74fcf7-0b7c-49f3-9147-01f4042e6842,46cb5ae7b6815843884d5271d9758929)/File(\27B82774-58EC-4B16-9F76-DBC35E0A064E\System\Library\CoreServices\boot.efi)
BootFFFF*   PciRoot(0x0)/Pci(0x1c,0x5)/Pci(0x0,0x0)/Sata(0,0,0)/HD(2,GPT,ac52d162-21b9-418e-8f91-5888580a1b5a,0x64028,0xe19bfb0)/VenMedia(be74fcf7-0b7c-49f3-9147-01f4042e6842,46cb5ae7b6815843884d5271d9758929)/File(\27B82774-58EC-4B16-9F76-DBC35E0A064E\System\Library\CoreServices\boot.efi)

devank@devank-MacBookAir:~$ sudo gdisk -l /dev/sda
GPT fdisk (gdisk) version 1.0.1

Partition table scan:
  MBR: hybrid
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with hybrid MBR; using GPT.
Disk /dev/sda: 236978176 sectors, 113.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 08D76ED0-E626-4C3D-B42A-2F7FD4C76683
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 236978142
Partitions will be aligned on 8-sector boundaries
Total free space is 2533 sectors (1.2 MiB)

Number   Start (sector) End (sector)  Size       Code  Name

   1               40         409639   200.0 MiB   EF00  EFI System Partition
   2           409640      178384383   84.9 GiB    FFFF  
   3        178384896      217446399   18.6 GiB    8300  
   4        217446400      227211263   4.7 GiB     8300  
   5        227211264      236976127   4.7 GiB     8200

Original post on 2019-10-29

Let's troubleshoot further by checking your EFI bootloader entries in detail, as well as how your disk is partitioned. Please boot from Ubuntu live USB and add the output of the following commands to your question:

  • sudo efibootmgr -v
  • sudo gdisk -l /dev/sda

If possible, please copy–paste the output into your question rather than using screenshots.

When you have done this, please add a comment to this answer so that I'm notified, then hopefully I will be able to assist further.

Update on 2019-10-30

Okay, so your boot entry Boot0001 is for rEFInd, which I suggest that you use. Do sudo efibootmgr -o 1, which will set your boot order, and then do sudo efibootmgr -n 1, which will set the desired entry to use on next boot, just in case your boot order gets magically reset to 0080,0002,0001,0000 again. Reboot, and hopefully you should be greeted with rEFInd (as seen in the screenshot here). At that point, you should hopefully be able to boot into whatever OS you want; rEFInd doesn't check your EFI boot entries, but instead scans your disk partitions to find installed OS's, so if there's a working macOS installation, it should display it. If you don't see it at first, press ESC to try re-scanning.


If you don't see the rEFInd screen, I would suggest that you re-install rEFInd, as follows:

  1. Ensure that SIP (System Integrity Protection) is disabled.

    1. Boot into macOS recovery. Hold CMD+ALT+R on boot, and you will be greeted with a spinning globe. Connect to the Internet via a Wi-Fi network from the list you see, or plug in an Ethernet cable before you boot with CMD+ALT+R.

    2. Once Recovery loads, choose your language if prompted, then go to Utilities in the top menu bar, then Terminal.

    3. Enter csrutil disable, then csrutil status to check that SIP is disabled.

  2. Install rEFInd from Ubuntu, since you can't boot into macOS.

    1. Boot from your Ubuntu live USB again.

    2. Mount your ESP (EFI System Partition), which is /dev/sda1, to /mnt/boot, as follows. You must use /mnt/boot as the mountpoint, else the refind-install script will not function as intended.

    sudo mkdir -p /mnt/boot
    sudo mount -t msdos /dev/sda1 /mnt/boot
    
    1. Download the rEFInd binary zip file from this page. You will probably need to do so over Ethernet, since the Ubuntu live OS likely won't have the necessary drivers for Wi-Fi. Alternatively, download this file to another USB beforehand, and insert that USB now.

    2. Unzip the rEFInd file to somewhere of your choosing, and cd there in the terminal. Then run the refind-install script, specifying the parent directory of the boot directory that you mounted your ESP to, which is /mnt. For example, if you downloaded the ZIP file to the ~/Downloads folder:

    cd ~/Downloads
    unzip refind-bin-0.11.4.zip
    cd refind-bin-0.11.4
    sudo ./refind-install --root=/mnt
    

    It may be valuable for you to save or take a photo of the refind-install output in case things don't go according to plan.

    1. Hopefully, the installation went smoothly. Now unmount your ESP and reboot, and rEFInd should be working properly:
    cd /
    sudo umount /dev/sda1
    sudo reboot now
    

If none of this works as expected, you may still be able to boot into macOS by creating a rEFInd bootable USB using the "USB flash drive image file" from this page.

Good luck :-)