2

I installed EndeavourOS (based on arch linux) via live USB following the guide on my /dev/sda partition where I used to have Ubuntu, which worked fine. I also have a separate HDD, my /dev/sdb partition, with Windows 10 installed. Everytime I turn on my PC I get to the grub shell and I can't boot normally into neither of the OS.

This is the output from grub shell:

grub>ls
grub>(hd0) (hd1) ... (hd1,gpt2) (hd2,gpt2) (hd1,msdos1)...

The partition I need is (hd1,gpt2) so I do:

grub>set root (hd1,gpt2)
grub>linux /boot/vmlinuz-linux root=/dev/sda2
grub>initrd /boot/initramfs_linux.image
grub> boot

and it boots normally into EndeavourOS. Then I try to fix my grub installation:

$ sudo grub-mkconfig -o /boot/grub/grub.cfg
$ sudo grub-install /dev/sda

And I then get this error:

Installing for x86_64-efi platform.
grub-install: error: cannot find EFI directory.

I have tried specified the EFI partition following this answer:

$ sudo mount /dev/sda1 /mnt
$ sudo grub-install --efi-directory=/mnt/EFI

but I get:

Installing for x86_64-efi platform.
grub-install: warning: disk does not exist, so falling back to partition device /dev/sda1.
grub-install: warning: disk does not exist, so falling back to partition device /dev/sda1.
grub-install: warning: disk does not exist, so falling back to partition device /dev/sda1.
grub-install: error: disk `hostdisk//dev/sda1' not found.

I checked the /mnt/EFI directory:

$ls /mnt/EFI/
drwxr-xr-x 2 root root 4096 21 apr  2019 BOOT
drwxr-xr-x 3 root root 4096 24 mar 15.22 ubuntu

So I thought maybe the usb live installation didn't format correctly the partions... Is there a way to fix this rather then format everything and start from scratch? Thanks in advance.

EDIT: I tried as suggested to refer to /mnt as the efi directory:

$ sudo grub-install --efi-directory=/mnt

and got this error:

Installing for x86_64-efi platform.
Could not prepare Boot variable: No space left on device
grub-install: error: efibootmgr failed to register the boot entry: Input/output error.

Now my /mnt/EFI folder looks like this:

$ ls /mnt/EFI
BOOT  endeavouros  ubuntu
$ ls /mnt/EFI/endeavouros
grubx64.efi
$ ls /mnt/EFI/ubuntu
BOOTX64.CSV  fw  grub.cfg  grubx64.efi  mmx64.efi  shimx64.efi

should I maybe delete the ubuntu folder?

also I have a ton of results running efibootmgr:

BootCurrent: 0000
Timeout: 1 seconds
BootOrder: 0000,000C,001A,0012,0007,0009,0011,0013,0014,0015,0017,0018,0019,0001,0002,0003
Boot0000* ubuntu
Boot0001* UEFI:CD/DVD Drive
Boot0002* UEFI:Removable Device
Boot0003* UEFI:Network Device
Boot0007  UEFI OS
Boot0009  CD/DVD Drive 
Boot000C* UEFI OS
Boot0011  UEFI OS
Boot0012* Unknown Device
Boot0013  ubuntu
Boot0014  ubuntu
Boot0015  UEFI OS
Boot0017  ubuntu
Boot0018  UEFI OS
Boot0019  ubuntu
Boot001A* UEFI OS

SOLVED: I followed the guide on the wiki, launching the live system in UEFI (otherwise it won't work).

gccallie
  • 61
  • 1
  • 7

1 Answers1

1

The efi directory is wrong and should be set to the path where the partition is mounted. Also use sudo for grub-install:

sudo mount /dev/sda1 /mnt
sudo grub-install --efi-directory=/mnt

Edit:

It looks like your efivars (the EEPROM location, not the partition /dev/sda1) is full and you need to clean up.

Run efibootmgr -v and remove obsolete entries, i.e. if there is an old Ubuntu entry like

Boot0014* ubuntu    HD(1,GPT,...)/File(\EFI\ubuntu\shimx64.efi)

then you may remove it with

sudo efibootmgr -b 0014 -B

Also delete dump-* files in /sys/firmware/efi/efivars, see this answer: Grub installation failed.

Yes, you may also remove the /mnt/EFI/ubuntu directory, but I don't think it's the cause of the error since endeavouros/grubx64.efi was successfully written.

Then try

sudo grub-install --efi-directory=/mnt

again.

Freddy
  • 25,172
  • 1
  • 21
  • 60
  • I have tried that before, unsure of what the answer I linked meant with [efi dir]. I used to have the same error as I mentioned before, but now I get ```Installing for x86_64-efi platform. Could not prepare Boot variable: No space left on device grub-install: error: efibootmgr failed to register the boot entry: Input/output error. ``` – gccallie Jun 25 '20 at 08:16
  • Answer updated. – Freddy Jun 25 '20 at 12:37
  • which one should I delete? It's weird is says current boot is ubuntu. I updated the question with the output of `efibootmgr` – gccallie Jun 25 '20 at 13:00
  • I can't seem to be able to delete the entries ... ```sudo efibootmgr -b 17 -B Could not delete variable: No space left on device``` – gccallie Jun 25 '20 at 13:10
  • The duplicated `ubuntu` and `UEFI OS` entries look terribly wrong and I have no idea what `UEFI OS` or `Unknown Device` means. It _could_ be that your nvram is corrupted and has gone readonly, but I'm not sure. Are there any `/sys/firmware/efi/efivars/dump-*` files you can remove? – Freddy Jun 25 '20 at 13:42
  • I didn't have any dump-* files. I solved by launching live usb (IMPORTANT: selected UEFI mode) then I followed [this guide on the wiki](https://endeavouros.com/docs/system-rescue/repair-grub-efi-uefi-system/) . – gccallie Jun 25 '20 at 16:54