You are not logged in.

#1 2022-10-06 14:11:20

Utini
Member
Registered: 2015-09-28
Posts: 452
Website

[SOLVED] GRUB-Update works on HTPC but fails on laptop

Hi guys,

I guess I am back to the newbie corner because I can't resolve this on my own.

Today, after several weeks, I did a system update on my HTPC and on my laptop.
As noted here ( https://archlinux.org/news/grub-bootloa … ibilities/ ) it was required to install and update GRUB again.
That worked fine on my HTPC but on my laptop I keep getting stuck with the GRUB rescue mode when trying to boot.

This is what I did for my specific setup:

- cryptsetup luksOpen /dev/nvme1n1p3 lvm
- fdisk -l                                #to verify the correct /dev/mapper/path for mounting the correct LVM container
- mount /dev/mapper/MyVolGroup-whatever /mnt
- mount /dev/nvme1n1p2 /mnt/boot                #mounting the boot partition according to "fdisk -l"
- mount /dev/nvme1np1 /mnt/esp                    #mounting EFI to random mnt folder
- arch-chroot /mnt
- ls -al /boot/                           #to verify I mounted correctly
- grub-install --target=x86_64-efi --boot-directory=/boot --efi-directory=/esp --bootloader-id=GRUB --removable
- grub-mkconfig -o /boot/grub/grub.cfg     
- exit
umount -R /mnt
reboot

This all runs without any errors in the output.

Before chrooting, this is the output of fdisk -l:

/dev/nvme0n1p1 499M Windows recovery environment
/dev/nvme0n1p2 100M EFI system
/dev/nvme0n1p3 16M Microsoft reserved
/dev/nvme0n1p4 150G Microsoft basic data (=Windows 11)
/dev/nvme0n1p5 325G Microsoft basic data (storage/file partition)

/dev/nvme1n1p1 100M EFI system
/dev/nvme1n1p2 300M Linux filesystem
/dev/nvme1n1p3 950G Linux LVM

After chroot, the contents of /boot/:

boot
efi
grub
initramfs-linux-hardened-fallback.img
initramfs-linux-hardened.img
intel-ucode.img
lost+found
System Volume informations
vmlinuz-linux-hardened

/boot/boot/ contains folder /grub/
/boot/boot/grub/ contains fonts, grubenv, locale, themes and x86_64-efi
/boot/efi/ is empty
/boot/grub/ contains fonts, grub.cfg, grubenv, locale, themes, x86_64-efi

/esp contains /EFI/
/esp/EFI/ contains arch, BOOT, Microsoft
/esp/EFI/arch/ contains fw, fwupdx64.efi, grubx64.efi
/esp/EFI/BOOT/ contains BOOTX64.efi
/esp/EFI/Microsoft/ contains Boot and Recovery

So first of all it seems like I got unnecessary GRUB/boot structures? But I am unsure which ones I can remove?
And then I still have no idea why I end up in the GRUB rescue mode when booting instead of my themed/customized GRUB loader?

Thanks in advance!

Last edited by Utini (2022-10-06 18:40:46)


Setup 1: Thinkpad T14s G3, 14" FHD - R7 6850U - 32GB RAM - 2TB Solidigm P44 Pro NVME
Setup 2: Thinkpad X1E G1, 15.6" FHD - i7-8850H - 32GB RAM - NVIDIA GTX 1050Ti - 2x 1TB Samsung 970 Pro NVME
Accessories: Filco Majestouch TKL MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD800S + Meier Daccord FF + Meier Classic FF

Offline

#2 2022-10-06 18:31:40

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,728

Re: [SOLVED] GRUB-Update works on HTPC but fails on laptop

Please use code and not quote for pasting outputs, it will make them more readable. Other than that, good job on the outputs should™ show most of what's relevant

The --removable option will only install and update /esp/EFI/BOOT/BOOTX64.efi if you are actually booting  /esp/EFI/arch/grubx64.efi via NVRAM entries (... check efibootmgr -uv ) you'd need to update that with

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

Last edited by V1del (2022-10-06 18:33:12)

Offline

#3 2022-10-06 18:43:41

Utini
Member
Registered: 2015-09-28
Posts: 452
Website

Re: [SOLVED] GRUB-Update works on HTPC but fails on laptop

V1del wrote:

Please use code and not quote for pasting outputs, it will make them more readable. Other than that, good job on the outputs should™ show most of what's relevant

The --removable option will only install and update /esp/EFI/BOOT/BOOTX64.efi if you are actually booting  /esp/EFI/arch/grubx64.efi via NVRAM entries (... check efibootmgr -uv ) you'd need to update that with

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

Woopsie, I always forget to use code instead of quote. Sorry!

Your suggested command fixed my problem. But I would like to understand why.

First of all, here is the output of efibootmgr -uv (as picture): https://i.imgur.com/AMm6QLS.jpg

So my main problem was the usage of "--removable"?
Or was it because I used --bootloader-id=GRUB instead of --bootloader-id=arch?
Also, do I have duplicated/useless efi or grub folder structures?

Thanks!


Setup 1: Thinkpad T14s G3, 14" FHD - R7 6850U - 32GB RAM - 2TB Solidigm P44 Pro NVME
Setup 2: Thinkpad X1E G1, 15.6" FHD - i7-8850H - 32GB RAM - NVIDIA GTX 1050Ti - 2x 1TB Samsung 970 Pro NVME
Accessories: Filco Majestouch TKL MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD800S + Meier Daccord FF + Meier Classic FF

Offline

#4 2022-10-06 19:02:29

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,728

Re: [SOLVED] GRUB-Update works on HTPC but fails on laptop

--removable automatically implies to the grub-install command that you want to install this to a "removable" device. Thus the fallback path that an EFI has to boot if it does not have NVRAM entries will be populated (since a mainboard is free - and many do - to remove NVRAM entries of paths that they do not have access to) you need to have one path that an EFI should look at regardless (by this same mechanism e.g. the Arch ISO works), in this case your bootloader-id is completely irrelevant since it will not store a reference by that name nor create a folder on the ESP by that name. (If you look at the efibootmgr output, all of the ones safe for the top two Windows and GRUB entries are "pseudo" entries that will boot any of the given medias as long as they have a /EFI/BOOT/BOOTx64.efi accessible)

Dropping the --removable makes GRUB try to write to the NVRAM entries and will then use the passed bootloader-id for

  1. As a directory name it creates on the ESP where it puts it's actual loader

  2. the id it uses to write to the NVRAM of your mainboard (overriding any existing key with that id) with the location of the aforementioned EFI GRUB loader

Had you used -id=GRUB without the removable option, you'd have two folders on the ESP, one arch one GRUB and two entries in your NVRAM: GRUB pointing to the new version and arch pointing to the old version.

Since you didn't do that, no you do not have anything superfluous on your ESP and everything is as it should be. oh wait I lied /boot/boot is definitely superfluous you should be able to remove that and /boot/efi will be/have been your original mount point when you first set this up (... or maybe still is in your fstab?)

If you want to know more I always suggest reading https://www.happyassassin.net/posts/201 … work-then/ it should help general understanding. (If you're really bored - and I was at one time - you can also read the relevant part of the UEFI spec to know what actual mainboard implementors should be doing and how this actually work)

Last edited by V1del (2022-10-06 19:15:19)

Offline

Board footer

Powered by FluxBB