Repairing GRUB

Hi I’m trying to repair my grub bootloader. I have booted into a live USB and chrooted into my system. I installed grub-install because for some reason it wasn’t installed. Now all that’s left to do is to direct grub-install to my EFI partition which for some reason it keeps saying “grub-install: error: cannot find EFI directory.”

I’m going to post my lsblk -f. Note that all these partitions automatically mounted without me doing anything. I’ve tried running the following:
tried “grub-install /run/media/liveuser/endeavouros/efi/”
tried “grub-install /dev/sdc1”
tried “grub-install /dev/sdc2”

[root@EndeavourOS liveuser]# sudo lsblk -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
loop0 squash 4.0 0 100% /run/archiso/airootfs
sda
├─sda1 vfat FAT32 CC13-A7D4
└─sda2 ntfs Games 0A862B9D862B87F1
sdb
├─sdb1
└─sdb2 ntfs Data 2 CEDEA6D4DEA6B3DD 713.7G 62% /run/media/liveuser/Data 2
sdc
├─sdc1 vfat FAT32 AB94-74AF
└─sdc2 ext4 1.0 endeavouros b3bc4c80-a6c6-4854-bbc3-4bb1e80581fc 396.3G 4% /run/media/liveuser/endeavouros
sdd
└─sdd1 ntfs Data 1 84BE4CE2BE4CCE7C
sde
├─sde1
└─sde2 ntfs E2A8A457A8A42C4B
sdf
├─sdf1
└─sdf2 ntfs Data 3 F688ACA188AC623B 1.6T 15% /run/media/liveuser/Data 3
sdg iso966 Jolie EOS_202303 2023-03-26-18-52-09-00
├─sdg1 iso966 Jolie EOS_202303 2023-03-26-18-52-09-00 0 100% /run/archiso/bootmnt
└─sdg2 vfat FAT16 ARCHISO_EFI 52A6-C06C

In chroot, just run grub-install

https://discovery.endeavouros.com/system-rescue/repair-a-non-booting-grub/2021/03/

I tried. It’s giving me errors. “grub-install” says "grub-install: error: cannot find EFI directory.
" and “grub-install --target=x86_64-efi --efi-directory=/sdc1/boot/efi --bootloader-id=GRUB” results in “Installing for x86_64-efi platform.
grub-install: error: failed to get canonical path of `/sdc1/boot/efi’.”

Are you sure that your system uses Grub and not systemd-boot which is the default in EnOS’ installer?

From the live session, please post the output of the following commands:

efibootmgr

And also, assuming that /dev/sdc is where your EnOS is installed, mount the system partition and post the content of the fstab file:

sudo mount /dev/sdc2 /mnt
cat /mnt/etc/fstab

It looks like you are trying to repair their Grub bootloader on EndeavourOS but you are encountering an error related to the EFI directory. To fix this issue, you can follow these steps:

  1. Identify the EFI partition:
    First, you need to identify the EFI partition where your bootloader files should be installed. Based on the output of lsblk -f, it appears that the EFI partition is /dev/sdc1, which is a FAT32 partition.

  2. Mount the EFI partition:
    If the EFI partition is not already mounted, you should mount it to a temporary location. You can do this by running the following command:

    sudo mount /dev/sdc1 /mnt
    
  3. Chroot into your system:
    Since you mentioned that you’ve already chrooted into your system, you can skip this step if you’re already in the chroot environment.

  4. Install Grub to the EFI partition:
    Now, you can install Grub to the EFI partition using the grub-install command. Make sure to specify the target directory as the mounted EFI partition. In this case, it would be:

    grub-install --target=x86_64-efi --efi-directory=/mnt --bootloader-id=endeavouros
    

    Replace /mnt with the actual mount point of your EFI partition if it’s different.

  5. Update the Grub configuration:
    After successfully installing Grub, you should update the Grub configuration by running:

    grub-mkconfig -o /boot/grub/grub.cfg
    

    This command will generate a new Grub configuration file.

  6. Unmount the EFI partition:
    Finally, you can unmount the EFI partition:

    sudo umount /mnt
    
  7. Reboot your system:
    Once you’ve completed these steps, you can reboot your system to see if Grub is working correctly.

These steps should help you repair your Grub bootloader and resolve the “cannot find EFI directory” error. Make sure to double-check the device paths and mount points to match your system’s configuration.

You probably have systemd-boot installed so there should be no need to repair or install grub.

To check try this: (quoted from @dalto)

What does pacman -Q | grep -E "grub|dracut" return?

If you are using grub, you will have both grub and eos-dracut on the list.

If you are using systemd-boot, you will have kernel-install-for-dracut on the list.

Keep in mind, everyone has systemd installed because it is used for more than just booting.


Why do you think grub needs repairing? What did you try to achieve? Add kernel parameter to boot process?

Um I tried to boot my endeavourOS one day I think after someone turned off the power to my pc maybe while it was booting. I discovered that my endeavourOS boot listing was replaced by an Ubuntu one that was broken.

dracut 056-2

[root@EndeavourOS liveuser]# efibootmgr
BootCurrent: 0006
Timeout: 1 seconds
BootOrder: 0003,0005,0006,0002,0004,0000
Boot0000 Windows Boot Manager HD(1,GPT,4107cee6-1153-48aa-91fc-4ea117f188f2,0x800,0x100000)/File(\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI)57494e444f5753000100000088000000780000004200430044004f0042004a004500430054003d007b00390064006500610038003600320063002d0035006300640064002d0034006500370030002d0061006300630031002d006600330032006200330034003400640034003700390035007d00000061000100000010000000040000007fff0400
Boot0002 ubuntu HD(1,GPT,4107cee6-1153-48aa-91fc-4ea117f188f2,0x800,0x100000)/File(\EFI\UBUNTU\GRUBX64.EFI)0000424f
Boot0003* Windows Boot Manager HD(1,GPT,3f59874f-bdef-4542-8661-89c3cf6b6915,0x1000,0x1f4000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)0000424f
Boot0004 Hard Drive BBS(HD,0x0)0000474f00004e4fa1000000010000006f0043005400310030003000300042005800350030003000530053004400310000000501090002000000007fff040002010c00d041030a0000000001010600021f03120a000000ffff00007fff040001043e00ef47642dc93ba041ac194d51d01b4ce63200320032003500360045003600390037004400340042002000200020002000200020002000200000007fff04000000424f00004e4fa7000000010000006f0053005400320030003000300044004d003000300038002d0032005500420031003000320000000501090002000000007fff040002010c00d041030a0000000001010600021f03120a000100ffff00007fff040001043e00ef47642dc93ba041ac194d51d01b4ce62000200020002000200020002000200020002000200020004b005a00300032004e0048004d00530000007fff04000000424f00004e4faf000000010000006f00530061006e004400690073006b00200055006c0074007200610020004900490020003400380030004700420000000501090002000000007fff040002010c00d041030a0000000001010600021f03120a000200ffff00007fff040001043e00ef47642dc93ba041ac194d51d01b4ce63500310034003400300036003100340031003500310037002000200020002000200020002000200000007fff04000000424f00004e4fa7000000010000006f0053005400320030003000300044004d003000300031002d0031004500520031003600340000000501090002000000007fff040002010c00d041030a0000000001010600021f03120a000300ffff00007fff040001043e00ef47642dc93ba041ac194d51d01b4ce620002000200020002000200020002000200020002000200034005a0031005a00330035004400320000007fff04000000424f00004e4faf000000010000006f00530041004d00530055004e00470020005300530044002000380033003000200053006500720069006500730000000501090002000000007fff040002010c00d041030a0000000001010600021f03120a000400ffff00007fff040001043e00ef47642dc93ba041ac194d51d01b4ce63000530034005a0045004e004300410039003800300036003200350020002000200020002000200000007fff04000000424f00004e4fa7000000010000006f0053005400320030003000300044004d003000300038002d0032005500420031003000320000000501090002000000007fff040002010c00d041030a0000000001010600021f03120a000500ffff00007fff040001043e00ef47642dc93ba041ac194d51d01b4ce62000200020002000200020002000200020002000200020004b0057003000330059004a004600420000007fff04000000424f
Boot0005* USB BBS(USB,0x0)0000474f00004e4f4f010000010000003301200055005300420000000501090005000000007fff040002010c00d041030a000000000101060000140305060014007fff040001040601ef47642dc93ba041ac194d51d01b4ce630003100300031006500380036006100350062003500610062003200390032003200620036003000360061003200630064003200350032003800310062003000610038006600310062003900340064003100340038006300330034003800370037003500340035006500650034003000380038003700660037003400620034003200610038003000300030003000300030003000300030003000300030003000300030003000300030003000300030003300640032003100390034006200660066006600310032003500310030003000390035003500350038003100300037003100340061006500640038006300370000007fff04000000424f
Boot0006* UEFI: USB PciRoot(0x0)/Pci(0x14,0x0)/USB(20,0)/HD(1,MBR,0x4d909e77,0x39d480,0x39000)0000424f

/etc/fstab: static file system information.

Use ‘blkid’ to print the universally unique identifier for a device; this may

be used with UUID= as a more robust way to name devices that works even if

disks are added and removed. See fstab(5).

UUID=AB94-74AF /efi vfat defaults,noatime 0 2
UUID=b3bc4c80-a6c6-4854-bbc3-4bb1e80581fc / ext4 defaults,noatime 0 1
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
UUID=“84BE4CE2BE4CCE7C” /mnt/Data1/ ntfs nls-utf8,umask-0222,uid-1000,gid-1000,rw 0 0
UUID=“CEDEA6D4DEA6B3DD” /mnt/Data2/ ntfs nls-utf8,umask-0222,uid-1000,gid-1000,rw 0 0
UUID=“F688ACA188AC623B” /mnt/Data3/ ntfs nls-utf8,umask-0222,uid-1000,gid-1000,rw 0 0
UUID=“0A862B9D862B87F1” /mnt/SanDiskUltraII/ ntfs nls-utf8,umask-0222,uid-1000,gid-1000,rw 0 0

Okay that should be everything you all have asked for. I think one of you were right. I think I might actually be using systemd boot. But it’s still that it’s broken. I don’t know how to fix a systemd boot issue.

Someone in this thread said I can just use bootctl install but it’s not finding my EFI partition. How do I mount it?

In the live session:

1. sudo mount /dev/sdc2 /mnt
2. sudo mount /dev/sdc1 /mnt/efi
3. sudo arch-chroot /mnt

Once in chroot:

1. bootctl install
2. reinstall-kernels

If you get any error messages, post them on the forum.

If not, type exit followed by enter to quit chroot.

Reboot your system.

Ah never mind I just started reinstalling from live usb. It really wasn’t letting me mount anything. Thanks anyway.

It may be a good idea to take note of the choice you made during this install: grub or dracut :wink:

Yeah I just used Dracut I think. Systemd default