You are not logged in.

#1 2025-08-02 06:51:27

GreatHHHammer
Member
Registered: 2025-08-02
Posts: 3

Grub shows no boot entry after reinstalling it. [SOLVED]

I've been trying to reconfiguring my Grub and efi partition because while browsing the Arch wiki I found out my current mount point for the EFI partition was historical, I was currently using /boot/efi which was apparently discouraged. The first step I did was editing my fstab file to mount my efi partition to /boot instead. That worked and so I ran

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

and

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

to update Grub but after rebooting, the Grub menu had no option to boot into Arch and only showed gave me the option to restart into uefi.

So far what I tried was booting into a live usb, reformatting my efi partition with mkfs.fat -F 32 /dev/nvme0n1p1 ,mounting my partitions / and /boot and enabling swap, and reinstalling Grub on my /boot. Grub install runs just fine and the grub-mkconfig generates the relevant files but when after rebooting I get the Grub menu with only the option to enter UEFI settings.

Last edited by GreatHHHammer (2025-08-02 16:16:45)

Offline

#2 2025-08-02 07:19:16

cryptearth
Member
Registered: 2024-02-03
Posts: 2,104

Re: Grub shows no boot entry after reinstalling it. [SOLVED]

ok - let's analyze this:
- boot-directory:
when not given by --boot-directory= option grub-install defaults to /boot
this is important because where /boot lives is hardcoded into the generated efi binary
example:
if /boot is not a mountpoint but a regular folder on ghe root partition the efi binary will get the config path of <root partition>/boot/grub/grub.cfg
if /boot is a mountpoint (an esp, as in your new setup) the efi binary will get <boot partition>/grub/grub.cfg
as you get a menu instead of an error message grub finds the config and can read it

- missing arch entry
for grub-mkconfig to work there needs to be a kernel and an initrd in /boot
this requires at least a kernel to be installed and mkinitcpio run successful
otherwise mkconfig just ignores it
so - do you have any kernel installed? have you ran mkinitcpio after formattin the esp to regenerare the kernel image and initrd?
sounds like your /boot misses them

Offline

#3 2025-08-02 07:39:18

GreatHHHammer
Member
Registered: 2025-08-02
Posts: 3

Re: Grub shows no boot entry after reinstalling it. [SOLVED]

cryptearth wrote:

ok - let's analyze this:
- boot-directory:
when not given by --boot-directory= option grub-install defaults to /boot
this is important because where /boot lives is hardcoded into the generated efi binary
example:
if /boot is not a mountpoint but a regular folder on ghe root partition the efi binary will get the config path of <root partition>/boot/grub/grub.cfg
if /boot is a mountpoint (an esp, as in your new setup) the efi binary will get <boot partition>/grub/grub.cfg
as you get a menu instead of an error message grub finds the config and can read it

- missing arch entry
for grub-mkconfig to work there needs to be a kernel and an initrd in /boot
this requires at least a kernel to be installed and mkinitcpio run successful
otherwise mkconfig just ignores it
so - do you have any kernel installed? have you ran mkinitcpio after formattin the esp to regenerare the kernel image and initrd?
sounds like your /boot misses them

I can reach the Grub menu without errors, yes. When running mkinitcpio to regenerate the kernel image and initrd, I receive the error:" '/lib/modules/6.15.4-arch2-1' is not a valid kernel module directory.". cd-ing into /lib/modules and running ls, I can see I have '6.15.8-arch1-2'. Is this mismatched kernel module directory the reason why mkinitcpio is failing and so not generating a kernel? How can I make mkinitcpio detect the right kernel?

Edit: checking my /boot partition I can see I have initramfs-linux-fallback.img, initramfs-linux.img and vmlinuz-linux; alongside my grub and efi directories. Checking grub directory shows the x86_64-efi and grub.cfg files, while the efi directory has nothing in it.

Edit 2: I tried running pacman -S linux while chrooted and pacstrap -K /mnt linux while in live usb to try and update the linux kernel and force an update but running mkinitcpio still shows a mismatched kernel module directory.

Last edited by GreatHHHammer (2025-08-02 09:18:10)

Offline

#4 2025-08-02 16:14:40

GreatHHHammer
Member
Registered: 2025-08-02
Posts: 3

Re: Grub shows no boot entry after reinstalling it. [SOLVED]

Okay so the solution turned out of be much simpler than I thought. I tried mounting my EFI partition with /efi instead of /boot, ran genfstab to update my fstab file, ran pacstrap -K /mnt linux to regenerate the linux initramfs and then arch-chrooted into my system. With /efi as my efi partition, I ran mkinitcpio first to ensure my linux initramfs were reinstalled properly, then I went through the regular grub install substituting esp with /efi.

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

While running grub-mkconfig , GRUB was able to successfully detect the linux initramfs and create an entry for it. A reboot later, I can now see the entry for Arch.

Offline

Board footer

Powered by FluxBB