My bootloader is corrupted beyond repair. Need help to built bootloader from scratch.

Months of tinkering and trying to fix bootloader have took it’s toll. I am not sure I can fix bootloader alone. Please help!

Requirement:

To be able to get two bootloader options: 1). Manjaro 2). Windows

Currently have Manjaro and Windows installed in two different partitions on my SSD.

Disks are in uefi + gpt.

Manjaro is installed in sda5 and Windows is installed in sda4.

Tried following this wiki, but somehow made it worse (previously I was able to boot in Manjaro, but not even that is gone, and it reaches grub emergency mode).

lsblk output:

$ lsblk -o PATH,PTTYPE,PARTTYPE,FSTYPE,PARTTYPENAME
PATH       PTTYPE PARTTYPE                             FSTYPE   PARTTYPENAME
/dev/loop0                                             squashfs
/dev/loop1                                             squashfs
/dev/loop2                                             squashfs
/dev/loop3                                             squashfs
/dev/sda   gpt
/dev/sda1  gpt    de94bba4-06d1-4d40-a16a-bfd50179d6ac ntfs     Windows recovery environment
/dev/sda2  gpt    21686148-6449-6e6f-744e-656564454649 vfat     BIOS boot
/dev/sda3  gpt    e3c9e316-0b5c-4db8-817d-f92df00215ae          Microsoft reserved
/dev/sda4  gpt    ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 ntfs     Microsoft basic data
/dev/sda5  gpt    0fc63daf-8483-4772-8e79-3d69d8477de4 ext4     Linux filesystem
/dev/sdb   dos
/dev/sdb1  dos    0x7                                  exfat    HPFS/NTFS/exFAT
/dev/sdb2  dos                                         iso9660
/dev/sr0

fdisk output:

$ sudo fdisk -l /dev/sda
Disk /dev/sda: 232.89 GiB, 250059350016 bytes, 488397168 sectors
Disk model: Samsung SSD 850 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: A2987B43-DFE4-4FC7-BBEA-376E14C5015E

Device         Start       End   Sectors   Size Type
/dev/sda1       2048    923647    921600   450M Windows recovery environment
/dev/sda2     923648   1128447    204800   100M BIOS boot
/dev/sda3    1128448   1161215     32768    16M Microsoft reserved
/dev/sda4    1900544 288894975 286994432 136.8G Microsoft basic data
/dev/sda5  288894976 488396799 199501824  95.1G Linux filesystem

Currently in live usb mode from latest Manjaro ISO.

I guess this should be your ESP. Why is the type BIOS boot? In the following wiki entry you can get some background information incl. what type an ESP should have. Change that. Flags should be ESP and BOOT.

Thanks for replying. Changed the flag. Now following is the output of fdisk:

Disk /dev/sda: 232.89 GiB, 250059350016 bytes, 488397168 sectors
Disk model: Samsung SSD 850 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: A2987B43-DFE4-4FC7-BBEA-376E14C5015E

Device         Start       End   Sectors   Size Type
/dev/sda1       2048    923647    921600   450M Windows recovery environment
/dev/sda2     923648   1128447    204800   100M EFI System
/dev/sda3    1128448   1161215     32768    16M Microsoft reserved
/dev/sda4    1900544 288894975 286994432 136.8G Microsoft basic data
/dev/sda5  288894976 488396799 199501824  95.1G Linux filesystem

How can I proceed further? Follow the wiki steps again?

Also make sure the boot flag is set for /dev/sda2.

Then I would try to restore the grub bootloader again.

That’s not correct, OP has UEFI system with gpt parted disk. :face_with_raised_eyebrow:

@Vyom, follow the guide you have already linked in your post.

Oh, I’m really sorry! I didn’t see that! :hot_face:

can you boot on USB iso manjaro
check before with terminal for UEFI only

inxi -Mxa
test -d /sys/firmware/efi && echo efi || echo bios
sudo efibootmgr -v
sudo manjaro-chroot -a
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=manjaro --recheck --verbose 
efibootmgr -v
exit ( quit chroot )

launch Gparted and add flag boot & esp if missing on /boot/efi