Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved]Grub boot failure - looking for EFI on grub-install
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
lyallp
Veteran
Veteran


Joined: 15 Jul 2004
Posts: 1574
Location: Adelaide/Australia

PostPosted: Fri Apr 26, 2024 2:19 am    Post subject: [Solved]Grub boot failure - looking for EFI on grub-install Reply with quote

EDIT:
    It's strange, using lsblk -O -P /dev/sdb, none of the partitions are showing UUIDs or PARTUUIDs, yet the partitions still mount when I chroot to my system mount --all, yet my /etc/fstab uses UUIDs as identifiers, not /dev/sdb? so another confusing point.
    I should mention, my partition scheme is 4 partitions, 1=4mb, 2=256mb (boot), 3=32mb (swap) 4=500G+ (/ root) - I forget what the 4mb partition is for, I thought it was for GRUB [EDIT: Its a Windows boot partition], my /boot partition is 256MB because I wanted to make sure I had plenty of room for multiple versions of the kernel (old, previous, etc).
    Also, I replaced my kernel .config with /proc/config.gz from the bootable USB and re-built and re-installed that kernel, I figure if the USB can boot with that setting and mount up my system, it will do for me.


I just had my Gentoo system decide not to boot for some reason, no idea why.

I got dumped at the Grub prompt.

Attempts to manually boot my system result in a Kernel dump, for which I cannot read cos the root cause scrolls off the top of the screen before I can read it.

So, I went and downloaded the latest Gentoo Minimal install ISO, created a USB and booted it.

I mounted up and chrooted to my system, all good so far.

I run 'grub-install /dev/sdb', as usual (I have a script which builds my kernel, and re-installs grub, so my script has not changed) and grub complains about not being able to find the EFI directory!

I have my system setup as a MBR system, primarily because if it works, why change?

I have rebuilt the kernel, re-installed all the binary modules like virutalbox modules but cannot do a 'grub-install'.

So, now I have a system which is unbootable and I cannot re-install GRUB

It appears I am missing /etc/portage/make.conf -> GRUB_PLATFORMS="pc"

So, I added this line and re-built grub after finding out that "pc" is case sensitive.

Now, my grub install only has a platform of 'pc' but it still looks for /usr/lib/grub/x86_64_efi/modinfo.sh, despite me explicitly removing EFI from the supported platforms.

So, I guess my question is, what should I set my --target parameter to?

It's a 64 bit system, so "i386-pc" seems wrong.

I have an Intel I7 7700 with an Asustek strix z270F gaming motherboard.

I think I will remove the GRUB_PLATFORMS from the make.conf and rebuild GRUB, pending finding out what --target to use....

Do I need to re-configure my system to EFI booting? If so, is there an article I should follow? The problem possibly will be my partition layout.

Any assistance would be appreciated.
_________________
...Lyall


Last edited by lyallp on Sat Apr 27, 2024 7:11 am; edited 2 times in total
Back to top
View user's profile Send private message
Goverp
Advocate
Advocate


Joined: 07 Mar 2007
Posts: 2012

PostPosted: Fri Apr 26, 2024 10:25 am    Post subject: Reply with quote

I think you might need to tweak your grub partition type, that's assuming you're using GPT partitioning. According to "info grub", following a chain through "grub-install" and "BIOS installation" section "GPT":
Quote:
You must also make sure that it has the proper partition type. Using GNU Parted, you can set this using a command such as the following:
# parted /dev/DISK set PARTITION-NUMBER bios_grub on


If you are using gdisk, set the partition type to ‘0xEF02’. With partitioning programs that require setting the GUID directly, it should be ‘21686148-6449-6e6f-744e656564454649’.
*Caution:* Be very careful which partition you select! When GRUB finds a BIOS Boot Partition during installation, it will automatically overwrite part of it. Make sure that the partition does not contain any other data.

_________________
Greybeard
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4215
Location: Bavaria

PostPosted: Fri Apr 26, 2024 12:19 pm    Post subject: Reply with quote

i386-pc is correct: https://wiki.gentoo.org/wiki/GRUB#BIOS_with_MBR

The same is true if you are using a GPT disk with CSM booting: https://wiki.gentoo.org/wiki/GRUB#Partitioning_for_BIOS_with_GPT (here you will need your small first partition).
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
lyallp
Veteran
Veteran


Joined: 15 Jul 2004
Posts: 1574
Location: Adelaide/Australia

PostPosted: Sat Apr 27, 2024 6:50 am    Post subject: Reply with quote

TLDR; It was a combination of MY kernel build and install script, attempting to 'patch' Grub.cfg that was the problem. Read the rest at your peril.

My partition type was the correct type.

Using grub-install --target i386_pc worked, it installed grub, however, it does not need the --target any longer, why? I don't know.

However, MY kernel re-build and install script, which I have been using for years didn't.

Grub, apparently, decided to change some key words in the grub.cfg, which my script was looking for, specifically the 'root=' parameter of the kernel, which I was substituting with the PARTUUID, rather than leaving as /dev/sda4

So, my kernel root parameter was wrong after a grub install which broke the /boot/grub/grub.cfg. which broke my boot.

Once I realised this (after dozens of building new kernels, creating initramfs's and dozens of reboot attempts, I found the 'make install' part of the kernel sources, was using 'installkernel', which I did not have installed.

So, once I installed 'installkernel' with use flags 'grub' and 'dracut', things seemed to work better, after I removed the installation of Grub from MY script.

Technically, I don't need dracut, cos my build does not require an initramfs, but I did use an initramfs for at least one boot and have not taken it out again.

Also, technically, I don't need 'installkernel' either, because my script did what it does, just with a little narrower focus (I didn't need initramfs, so didn't bother building or installing one), so, technically, I could uninstall 'installkernel' and revert MY script to installing Grub, just not attempting to patch the grub.cfg

sigh....
_________________
...Lyall
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum