Guidance needed to repair grub

Hi!

Getting bored today, I’ve got the rich idea of trying out a command from this thread to see if I can get rid of the AUR’s package update-grub, that I would run after each grub update. But I did the bad mistake of rebooting right after this command:
grub-install --no-nvram
(My booting setup is grub + grub-btrfs.)

No panic, I went through the grub disaster and have learned about archroot and taking troubleshooting notes. After a few unsuccessful attempts via rEFInd, I boot from USB in a live EndeavourOS system, do the complete archroot:

sudo mount -o subvol=@ /dev/nvme0n1p2 /mnt
sudo mount -o subvol=@log /dev/nvme0n1p2 /mnt/var/log
sudo mount -o subvol=@cache /dev/nvme0n1p2 /mnt/var/cache
sudo mount -o subvol=@home /dev/nvme0n1p2 /mnt/home
sudo mount /dev/nvme0n1p1 /mnt/boot/efi
sudo arch-chroot /mnt

and try the correct commands (at least what has worked for me in the past):

grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub
grub-mkconfig -o /boot/grub/grub.cfg

Although the installation completes without any error, finds all the btrfs snapshots, etc:

grub-install and grub-mkconfig
Installing for x86_64-efi platform.
Installation finished. No error reported.
Generating grub configuration file ...
Found background: /home/alexandre/Images/Thue-Morse/Motif_full_simple.png
Found linux image: /boot/vmlinuz-linux-zen
Found initrd image: /boot/amd-ucode.img /boot/initramfs-linux-zen.img
Found fallback initrd image(s) in /boot:  amd-ucode.img initramfs-linux-zen-fallback.img
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/amd-ucode.img /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot:  amd-ucode.img initramfs-linux-fallback.img
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
Detecting snapshots ...
Found snapshot: 2025-04-11 13:00:24 | @/.snapshots/2470/snapshot        | single | timeline        |
Found snapshot: 2025-04-11 00:00:07 | @/.snapshots/2469/snapshot        | single | timeline        |
Found snapshot: 2025-04-10 10:00:07 | @/.snapshots/2466/snapshot        | single | timeline        |
Found snapshot: 2025-04-09 09:11:24 | @/.snapshots/2465/snapshot        | single | timeline        |
Found snapshot: 2025-04-08 09:00:01 | @/.snapshots/2463/snapshot        | single | timeline        |
Found snapshot: 2025-04-07 12:00:02 | @/.snapshots/2456/snapshot        | single | timeline        |
Found snapshot: 2025-04-01 00:00:00 | @/.snapshots/2450/snapshot        | single | timeline        |
Found snapshot: 2025-03-31 00:00:02 | @/.snapshots/2426/snapshot        | single | timeline        |
Found snapshot: 2025-03-24 11:00:13 | @/.snapshots/2340/snapshot        | single | timeline        |
Found snapshot: 2025-03-01 00:00:00 | @/.snapshots/2266/snapshot        | single | timeline        |
Found snapshot: 2025-02-10 17:49:00 | @/.snapshots/2192/snapshot        | single | Pre-upgrade     |
Found snapshot: 2025-02-04 13:50:35 | @_backup_2025-02-04T13:23:20.015Z | N/A    | N/A             |
Found snapshot: 2025-02-01 00:53:53 | @/.snapshots/2173/snapshot        | single | timeline        |
Found snapshot: 2025-01-05 15:18:14 | @_backup_2025-02-04T12:50:35.876Z | N/A    | N/A             |
Found snapshot: 2025-01-05 14:46:08 | @_backup_2025-01-05T14:18:14.186Z | N/A    | N/A             |
Found snapshot: 2025-01-01 00:00:18 | @/.snapshots/2048/snapshot        | single | timeline        |
Found snapshot: 2024-12-11 20:09:07 | @_backup_2025-01-05T13:46:08.112Z | N/A    | N/A             |
Found snapshot: 2024-12-11 19:07:46 | @_backup_2024-12-11T19:09:07.048Z | N/A    | N/A             |
Found snapshot: 2024-12-11 18:11:47 | @_backup_2024-12-11T18:07:46.735Z | N/A    | N/A             |
Found snapshot: 2024-12-01 00:00:07 | @/.snapshots/1912/snapshot        | single | timeline        |
Found snapshot: 2024-11-01 00:58:03 | @/.snapshots/1824/snapshot        | single | timeline        |
Found snapshot: 2024-08-21 18:20:46 | @/.snapshots/1531/snapshot        | single | Manual Snapshot |
Found snapshot: 2024-08-21 16:06:29 | @_backup_2024-12-11T17:11:47.131Z | N/A    | N/A             |
Found snapshot: 2024-06-11 13:39:22 | @_backup_2024-08-21T14:06:28.998Z | N/A    | N/A             |
Found snapshot: 2024-04-04 12:11:17 | @_backup_2024-06-11T11:39:22.036Z | N/A    | N/A             |
Found snapshot: 2024-02-28 13:23:42 | @_backup_2024-04-04T10:11:17.744Z | N/A    | N/A             |
Found snapshot: 2024-01-01 00:00:03 | @/.snapshots/688/snapshot         | single | timeline        |
Found snapshot: 2023-07-16 03:00:51 | @/.snapshots/1/snapshot           | single | timeline        |
Found 28 snapshot(s)
Unmount /tmp/grub-btrfs.KnNMX2wr5G .. Success
Found memtest86+ EFI image: /boot/memtest86+/memtest.efi
/usr/bin/grub-probe: warning: unknown device type nvme0n1.
done

Note the warning at the end. Strangely, I get no output from os-probe:

[root@EndeavourOS /]# os-prober
[root@EndeavourOS /]# 
[root@EndeavourOS /]# lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
loop0         7:0    0  2.6G  1 loop 
sda           8:0    1 29.3G  0 disk 
├─sda1        8:1    1 29.3G  0 part 
│ ├─ventoy  254:0    0  2.9G  1 dm   
│ └─sda1    254:1    0 29.3G  0 dm   
└─sda2        8:2    1   32M  0 part 
nvme0n1     259:0    0  1.8T  0 disk 
├─nvme0n1p1 259:1    0 1000M  0 part /boot/efi
└─nvme0n1p2 259:2    0  1.8T  0 part /home
                                     /var/cache
                                     /var/log
                                     /

…I’m still stuck in grub-rescue after a reboot:

error: symbol `grub_cli_set_auth_needed' not found.
Entering rescue mode...
grub rescue> ls
(proc) (hd0) (hd0,gpt2) (hd0,gpt1)
grub rescue>

A clean reinstall of grub with SKIP_AUTOSNAP=1 pacman -S grub efibootmgr os-prober does not change the outcome.

Perhaps I have messed-up something with the directories /boot/efi/ and /boot/? The content looks redundant:

[root@EndeavourOS /]# ls boot
amd-ucode.img  initramfs-linux-fallback.img      initramfs-linux-zen.img  vmlinuz-linux-zen
efi            initramfs-linux.img               memtest86+
grub           initramfs-linux-zen-fallback.img  vmlinuz-linux
[root@EndeavourOS /]# ls boot/grub/
fonts  grub-btrfs.cfg  grub.cfg  grubenv  locale  themes  x86_64-efi
[root@EndeavourOS /]# ls boot/efi
amd-ucode.img  initramfs-linux-fallback.img  initramfs-linux-zen-fallback.img  vmlinuz-linux
EFI            initramfs-linux.img           initramfs-linux-zen.img           vmlinuz-linux-zen
[root@EndeavourOS /]# ls boot/efi/EFI
boot  endeavouros  grub
[root@EndeavourOS /]# ls boot/efi/EFI/grub
grubx64.efi

Any help appreciated :slightly_smiling_face:

efibootmgr What does it show?

Also, there is no need for more that one directory for --bootloaderid under /boot/efi/EFI.
You have 3. The latest grub as per the command you have shared.

[root@EndeavourOS /]# efibootmgr
BootCurrent: 0002
Timeout: 1 seconds
BootOrder: 0000,0002,0001
Boot0000* grub  HD(1,GPT,e13561db-f05f-4fa2-b4db-23921b890ffb,0x1000,0x1f4000)/\EFI\grub\grubx64.efi
Boot0001* UEFI OS       HD(1,GPT,e13561db-f05f-4fa2-b4db-23921b890ffb,0x1000,0x1f4000)/\EFI\BOOT\BOOTX64.EFI0000424f
Boot0002* UEFI: PHILIPS PMAP, Partition 2       PciRoot(0x0)/Pci(0x8,0x1)/Pci(0x0,0x4)/USB(1,0)/HD(2,GPT,eca2aeea-be46-def7-2025-fb97d83680bd,0x3a87fd8,0x10000)0000424f

I may remove Boot0000 or at least change order to try Boot0001? (Although that should have worked via rEFInd.)

EDIT:
I have tried to change the boot order (1 first), but it still boots into grub rescue.
However, I have tried again the different entries from rEFInd, the one in

EFI/endeavouros/grubx64.efi

boots correctly. Why isn’t it visible by efibootmgr and how to clean up / prevent these multiple versions of grub from appearing again (I know, stop doing silly things, but I would like to understand ^^)?

The second one as well:

[root@EndeavourOS /]# ls boot/efi/EFI/boot
bootx64.efi
[root@EndeavourOS /]# ls boot/efi/EFI/endeavouros
grubx64.efi
[root@EndeavourOS /]# ls boot/efi/EFI/grub
grubx64.efi

You need to simplify things for now and building up everything new.

I don’t know why you would need rEFInd on top of Grub.

If I had to solve this on my system. I would disable autosnapping and whatever you have to add snapshots to grub boot menu for now. The simpler, the cleaner, the easier to solve the problem.

I would remove all three directories under /boot/efi/EFI. I would remove rEFInd.

I would rename /boot/grub directory to /boot/grub.old and /etc/grub.d directory to /etc/grub.d.old
And make a backup copy of /etc/default/grub.

Also remove this new Boot0000: sudo efibootmgr -b 0000 -B

When you have cleaned up, renamed, disabled autosnap and what else, you can reinstall grub package.

After you installed grub package, install the bootloader:

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

After that update grub.conf

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

Thanks a lot, everything is back into order.
I guess the different methods to install or repair grub put me in this situation. I will now stick to these commands (delete the AUR pkg and wrap grub-mkconfig -o /boot/grub/grub.cfg into an alias).

Also, the warning message was caused by the package memtest86+-efi.
About rEFInd, I keep an iso file on a Ventoy USB drive for troubleshooting only, together with the live system and textfiles with my notes.

1 Like

I am glad to hear that it is solved! The more you keep it simple the easier everything will be.

That’s Arch’s philosophy: KISS!

Also, you could remove those directories we named .old

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.