Reinstalling bootloader without destroying system?

I am having a serious issue with Grub. I am getting a is_shim_lock_enabled symbol not found error, as discussed here: Latest grub bricked my system (grub_is_shim_lock_enabled not found). I have tried every solution in that thread (i.e. reinstalling grub with efi directory specified, manually modifying efibootmgr, using the --disable-shim-lock flag, etc.). I am at the point where I think my only option is to completely remake the ESP, as I would in a clean install from scratch. Is there a way to do this without disrupting my intact main partition?

If you are not dual-booting and are using grub with the ESP mounted at /boot/efi, there is nothing of significance in your ESP other than grub.

You can format or erase the ESP and then run grub-install to repopulate it.

The system also doesn’t need the ESP to run, only to boot. So you can do all that from your running system as long as you don’t reboot in the middle of it.

If you don’t have access to your running system, you will need to chroot into it before running grub-install

yes, I recently have wrecked bootloader for endeavour. I nuked it. then made a brand new 1GB fat32 esp/boot partition. then chrooted into it and let the update (not grub install) fix the packages and repopulate.
I do not know the name for my method (thought it up and did it) and I was surprised it worked.

I’m superstitious so if there are other drives on the mobo I unplug them before 1) going into live to use gparted and nuke faulty boot partition, then rebuild a new boot partition 2) chrooting for boot rescue

Thank you both for the advice. Unfortunately, that somehow made it worse, and now I’m truly lost.

Currently, I get no grub menu - the system seems to just go through the boot order and bottom out at the live USB I’m using (if I unplug that it just goes to a rescue page in the BIOS setup).

Here’s what efibootmgr gets me:

BootCurrent: 0002
Timeout: 0 seconds
BootOrder: 0000,0001,0002
Boot0000* arch  HD(1,GPT,40b16657-43df-49f2-a625-d6d3bf0a9568,0x1000,0x96000)/\EFI\arch\grubx64.efi
Boot0001* UEFI: BC711 NVMe SK hynix 512GB, Partition 1  PciRoot(0x0)/Pci(0x1d,0x0)/Pci(0x0,0x0)/NVMe(0x1,FF-FF-FF-FF-FF-FF-FF-FF)/HD(1,GPT,dfdec5e8-3218-0848-9c36-03ba9bd0c7f4,0x1000,0x96000)0000424f
Boot0002* UEFI: Memorex USB Flash Drive PMAP, Partition 1       PciRoot(0x0)/Pci(0x14,0x0)/USB(16,0)/HD(1,GPT,40b16657-43df-49f2-a625-d6d3bf0a9568,0x800,0x73877c0)0000424f

The /boot/efi folder only contains the directory path included in the first boot path above (i.e. /EFI/arch/grubx64.efi).

Any idea what could cause the complete lack of grub menu?

What is your disk layout?

sudo parted -l

If having more than one disk, indicate which one harbors your EnOS.

I have a SSD with 2 partitions. A luks encrypted root partition, and a non encrypted boot partition. Here’s sudo parted -l output:

Disk /dev/nvme0n1: 512GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End    Size   File system  Name  Flags
 1      2097kB  317MB  315MB  fat32              boot, esp
 2      317MB   512GB  512GB               root
1 Like

In a live session, I would unlock the luks partition first.

In order to chroot, depending on your filesystem, you may need a bit different approach to mount your root partition. Specially if you use Btrfs with subvolumes.

Here is a guide which may serve as example:

https://discovery.endeavouros.com/system-rescue/arch-chroot/2022/12/

Then, once in chroot, I would run a system update, reinstall the package Grub and also reinstall Grub’s bootloader:

grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch

Also make sure that in /etc/default/grub you have GRUB_TIMEOUT_STYLE="menu" and GRUB_TIMEOUT=“n” where n is your preferred number of seconds for the Grub’s boot menu to time out.

Now, regenerate grub.cfg:

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

Also, since you seem to have redone your ESP, I would make sure that the UUID of it in /etc/fstab corresponds to the actual one on the disk.

If everything is fine so far, type exit followed by enter to quit chroot.

Reboot and see if you get to the Grub’s boot menu.

2 Likes

These are, roughly, the steps I’ve been following up to this point. Chroot is totally successful, grub reinstall and grub-install run uneventfully. Grub defaults include 5 second timeout and menu.

I hadn’t checked the UUID up to this point. That’s a really good idea. However, output looks normal to me. Here’s fstab:

# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=5580-CC2E                            /boot/efi/      vfat    umask=0077 0 2

and here’s blkid for the boot partition.

/dev/nvme0n1p1: LABEL_FATBOOT="NO_LABEL" LABEL="NO_LABEL" UUID="5580-CC2E" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="dfdec5e8-3218-0848-9c36-03ba9bd0c7f4"

All this, and still no grub menu.

Is there a way to see grub logs, if it just skips over the menu?

You didn’t mention regeneration of grub.cfg in your post but I suppose you have done it already.

I’m afraid I am not aware if Grub has any log or it gets logged somewhere.

Could you try pressing left Shift key (or in some cases Esc) right after you power up your system and see if the Grub boot menu will show?

For some systems you may need to press and hold the key down, while others may need repeated presses