Can't install grub for Manjaro after reinstalling Windows

0

I recently reinstalled Windows and Windows being the great operating system it is deletes the bootloader. I thought this would be pretty easy to fix, to I just flashed my thumbdrive with Manjaro and booted into it. When I tried grub-install /dev/sda4, it errored out and said that it couldn't find the EFI directory. Next, I tried to do grub-install --target=i386-pc /dev/sda4, which said that it failed to get canonical path of overlay. I was a little confused now, so I tried mounting just everything, chrooting into /mnt, and running grub-install /dev/sda4 again. This resulted in grub saying that EFI variables are not supported on this system. I tried exiting chroot, running modprobe efivarfs and then did efivar-tester, which also told me that EFI variables are not supported. I went back into chroot and tried grub-install --target=i386-pc /dev/sda4, which said File system ext2' doesn't support embedding.. Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged. I tried exiting chroot again and mounting /dev/sdsa1 which appeared to be an EFI partition to /mnt/boot/efi`. I went back into chroot and tried both installations of grub again, both giving the same errors. I've tried everything that I've found online and nothing seems to work, can anyone help me out?

fdisk -l:

Disk /dev/sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: TOSHIBA MQ04ABF1
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: 292A7C98-9DF5-4C73-BCDA-0F4F87A64955

Device         Start        End    Sectors   Size Type
/dev/sda1       2048     534527     532480   260M EFI System
/dev/sda2     534528     567295      32768    16M Microsoft reserved
/dev/sda3     567296  207581183  207013888  98.7G Microsoft basic data
/dev/sda4  207581184 1953521663 1745940480 832.5G Linux filesystem


Disk /dev/loop0: 24.4 MiB, 25587712 bytes, 49976 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop1: 539.27 MiB, 565469184 bytes, 1104432 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop2: 1.63 GiB, 1752920064 bytes, 3423672 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop3: 656.32 MiB, 688197632 bytes, 1344136 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdb: 28.64 GiB, 30752636928 bytes, 60063744 sectors
Disk model: Ultra           
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: dos
Disk identifier: 0x00000000

Device     Boot   Start     End Sectors  Size Id Type
/dev/sdb1  *         64 6060299 6060236  2.9G  0 Empty
/dev/sdb2       6060300 6068491    8192    4M ef EFI (FAT-12/16/32)

lsblk:

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0    7:0    0  24.4M  1 loop /run/miso/sfs/livefs
loop1    7:1    0 539.3M  1 loop /run/miso/sfs/mhwdfs
loop2    7:2    0   1.6G  1 loop /run/miso/sfs/desktopfs
loop3    7:3    0 656.3M  1 loop /run/miso/sfs/rootfs
sda      8:0    0 931.5G  0 disk 
├─sda1   8:1    0   260M  0 part /mnt/boot/efi
├─sda2   8:2    0    16M  0 part 
├─sda3   8:3    0  98.7G  0 part 
└─sda4   8:4    0 832.5G  0 part /mnt
sdb      8:16   1  28.6G  0 disk /run/miso/bootmnt
├─sdb1   8:17   1   2.9G  0 part 
└─sdb2   8:18   1     4M  0 part
linux
hard-drive
partitioning
grub
manjaro
asked on Super User Dec 13, 2020 by Tabulate

1 Answer

0

I fixed the issue by rebooting and trying these commands:

sudo mount /dev/sda4 /mnt
sudo mount /dev/sda1 /mnt/boot/efi
manjaro-chroot /mnt /bin/bash
pacman -Syu grub
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=manjaro --recheck
grub-mkconfig -o /boot/grub/grub.cfg
answered on Super User Dec 13, 2020 by Tabulate

User contributions licensed under CC BY-SA 3.0