Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Grub2 [not solved, compromised]
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
pdr
l33t
l33t


Joined: 20 Mar 2004
Posts: 613

PostPosted: Sat May 16, 2020 8:51 pm    Post subject: Grub2 [not solved, compromised] Reply with quote

Do I have to use LILO to NOT use UEFI with the bootloader now?

First, I get told how to break it (mkfs.ext2 /dev/sda1 instead of using VFAT (???) for my boot partition).

Second, I get told I can not use EFI and use bios (no; it complains you are trying to do an EFI install)

My last install (not all that long ago) I *did* finally get this to work? How do I do so? I have:

/dev/sda1 not formatted (for grub "mbr"; as recommended is 2MB)

/dev/sda2 formatted for ext2, mounted at /boot

/dev/sda3 swap

/dev/sda4 formatted for ext4, mounted at / (before /boot was mounted)

The install guide pretends I can just run:

grub-install /dev/sda

and it will do so like the legacy grub. Nope. Keeps saying

Code:
Installing for x86_64-efi platform.
grub-install: error: cannot find EFI directory.


And, of course, **I don't want it to**.

I've been installing Gentoo for a *long* time now, and this boot loader install docs are not the best.


Last edited by pdr on Sun May 17, 2020 6:13 pm; edited 1 time in total
Back to top
View user's profile Send private message
CaptainBlood
Veteran
Veteran


Joined: 24 Jan 2010
Posts: 1596

PostPosted: Sat May 16, 2020 9:15 pm    Post subject: Re: Grub2 Reply with quote

pdr wrote:
Do I have to use LILO to NOT use UEFI with the bootloader now?
Code:
eix grub -I
[I] sys-boot/grub
     Installed versions:  2.04-r1(2/2.04-r1)^t(21:04:10 08/05/2020)(nls -device-mapper -doc -efiemu -fonts -libzfs -mount -sdl -test -themes -truetype GRUB_PLATFORMS="pc -coreboot -efi-32 -efi-64 -emu -ieee1275 -loongson -multiboot -qemu -qemu-mips -uboot -xen -xen-32 -xen-pvh")
Code:
grep GRUB /etc/portage/make.conf
GRUB_PLATFORMS="pc"
no uefi here.
Thks 4 ur attention, interest & support.
Back to top
View user's profile Send private message
CaptainBlood
Veteran
Veteran


Joined: 24 Jan 2010
Posts: 1596

PostPosted: Sat May 16, 2020 9:30 pm    Post subject: Re: Grub2 Reply with quote

pdr wrote:
First, I get told how to break it (mkfs.ext2 /dev/sda1 instead of using VFAT (???) for my boot partition).
1) If I understand you correcty, UEFI does requires a M$ specific filesystem for the boot partition, although I have no experience at it.

2) As for the ext2 format, I can't tell, since I'm using a commercial boot manager.
As a result I install grub with an unconventional command:
Code:
grub-install --force /dev/sda1
which you shouldn't use.

Thks 4 ur attention, interest & support.


Last edited by CaptainBlood on Sat May 16, 2020 10:46 pm; edited 1 time in total
Back to top
View user's profile Send private message
pietinger
Apprentice
Apprentice


Joined: 17 Oct 2006
Posts: 175
Location: Bavaria

PostPosted: Sat May 16, 2020 10:35 pm    Post subject: Reply with quote

I know some BIOS will boot your existent mbr-boot-partition even if you have set UEFI-Boot in the BIOS. If so, your Boot with a minimal CD could be an UEFI-boot. You can check after booting with your minimal CD, if /sys/firmware/efi exists. If yes, it was an UEFI Boot; please check your BIOS-Settings. If not, it has to be only a missing setting in make.conf: GRUB_PLATFORMS="pc"
Back to top
View user's profile Send private message
pdr
l33t
l33t


Joined: 20 Mar 2004
Posts: 613

PostPosted: Sun May 17, 2020 9:55 am    Post subject: Reply with quote

I tried using just "pc"; apparently it is 32-bit only, and then grub2 *still* tells you it cannot find the efi directory.

My problem is getting grub2 to do the mbr install. I know that, after running into this problem before (the docs being *very* vague on what partition is what, what to mount where, and "oh yeah - you already formatted that partition? you have to format with a different file system..) I somehow got "grub-install /dev/sda" (or possibly "grub-install /dev/sda1") to work on my current home workstation I did this with recently - I just have no idea how. And the install docs do not tell you; those, the wiki - everything assumes you *want* to use VFAT and UEFI...
Back to top
View user's profile Send private message
pietinger
Apprentice
Apprentice


Joined: 17 Oct 2006
Posts: 175
Location: Bavaria

PostPosted: Sun May 17, 2020 10:58 am    Post subject: Reply with quote

pdr wrote:
I somehow got "grub-install /dev/sda" (or possibly "grub-install /dev/sda1") to work on my current home workstation I did this with recently - I just have no idea how. And the install docs do not tell you; those, the wiki - everything assumes you *want* to use VFAT and UEFI...

Did you really have read the wiki ? Have you checked your BIOS ?
https://wiki.gentoo.org/wiki/GRUB2#BIOS_with_MBR
If you have any problems anymore, please tell us EXACTLY and COMPLETE what you did and what errors you get at which point. Do also a "parted /dev/sdX p" or "parted /dev/hdX p" and show us the output.


Last edited by pietinger on Sun May 17, 2020 11:01 am; edited 1 time in total
Back to top
View user's profile Send private message
superjaded
l33t
l33t


Joined: 05 Jul 2002
Posts: 788

PostPosted: Sun May 17, 2020 11:01 am    Post subject: Reply with quote

It says at the beginning of the Configuring the bootloader article in the Handbook that if you are using MBR/BIOS, that you don't need to make any changes in make.conf to GRUB_PLATFORMS:

Quote:
When using an older BIOS system supporting only MBR partition tables, no additional configuration is needed in order to emerge GRUB:
root #emerge --ask --verbose sys-boot/grub:2


Then it instructs that if you need or want UEFI support, you need to emerge grub with GRUB_PLATFORMS="efi-64" in your make.conf:

Quote:
note for UEFI users: running the above command will output the enabled GRUB_PLATFORMS values before emerging. When using UEFI capable systems, users will need to ensure GRUB_PLATFORMS="efi-64" is enabled (as it is the case by default). If that is not the case for the setup, GRUB_PLATFORMS="efi-64" will need to be added to the /etc/portage/make.conf file before emerging GRUB2 so that the package will be built with EFI functionality:


If you followed that portion of the handbook and installed grub with GRUB_PLATFORMS set to efi-64, it effectively removes "pc" as an available platform. Effectively, this would make efi-64 the only available platform to your installation of grub. So ultimately if you want to use grub without UEFI, you need to make sure you DO NOT have GRUB_PLATFORMS set in make.conf. And if you ever had GRUB_PLATFORMS set (or currently do), you'll want to rebuild grub (or just to be on the safe side, rebuild world with emerge -auDNv @world) to ensure you do not have efi-64.

The fact that it seems to be trying to use the efi-64 platform without you explicitly specifying it on the command line indicates to me that you may not have "pc" support in your current install of grub.

Also, one word of pedantry that I'm not sure is completely relevant or not because it's been a while since I use UEFI myself and not BIOS/MBR, in the handbook it says that you need to reference your drive WITHOUT the partition reference, and there seems to be some confusion with respect to what is supposed to be referenced:

Quote:
Next, install the necessary GRUB2 files to the /boot/grub/ directory via the grub-install command. Presuming the first disk (the one where the system boots from) is /dev/sda, one of the following commands will do:

When using BIOS:

root #grub-install /dev/sda


Also, with respect to your partition table generally, if you set up your partitions similar to the way suggested in Preparing the disks -> Default partitioning scheme, your /boot should be /dev/sda2 and I don't believe you actually do anything with /dev/sda1.
Back to top
View user's profile Send private message
pdr
l33t
l33t


Joined: 20 Mar 2004
Posts: 613

PostPosted: Sun May 17, 2020 6:12 pm    Post subject: Reply with quote

And gems like when running grub-install (with EFI target) using /boot, and in the /etc/fstab saying that should be ext2, and..
Back to top
View user's profile Send private message
pdr
l33t
l33t


Joined: 20 Mar 2004
Posts: 613

PostPosted: Sun May 17, 2020 6:15 pm    Post subject: Reply with quote

The instructions are just too broken, and this is my replacement for my work workstation (ie do not want to tinker with it as much as I would my home workstation).

Started all over (yay!), formatted /dev/sda2 == /boot == vfat, and basically let it force me into UEFI and VFAT.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 15334

PostPosted: Sun May 17, 2020 6:34 pm    Post subject: Reply with quote

Instead of wiping the installation, you could have used a more forgiving bootloader. :) I have been quite happy using syslinux in place of grub2.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 7686
Location: Saint Amant, Acadiana

PostPosted: Sun May 17, 2020 7:05 pm    Post subject: Reply with quote

+1 for syslinux. Actually, has become my favorite for non-EFI boot (EFI stub for EFI boot). Grub2 is overkill for Gentoo, leave it to distros where automatic kernel updates take place.
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
pietinger
Apprentice
Apprentice


Joined: 17 Oct 2006
Posts: 175
Location: Bavaria

PostPosted: Sun May 17, 2020 7:56 pm    Post subject: Reply with quote

pdr wrote:
[...] let it force me into UEFI and VFAT.

So, now you know which settings you have in your BIOS ... maybe it would have been faster to change this instead of a new installation, but of course it was your choice.
Back to top
View user's profile Send private message
GDH-gentoo
Apprentice
Apprentice


Joined: 20 Jul 2019
Posts: 278
Location: South America

PostPosted: Sun May 17, 2020 8:51 pm    Post subject: Reply with quote

I fail to see the problem here. The command to perform a BIOS install is:
Code:
grub-install --target=i386-pc /dev/sda
(Or the right device)

Yes, it is "i386" even for a 64-bit CPU. And yes, the --target option is needed if BIOS install is not the default, which might be the case if grub-install detects that /sys/firmware/efi is present and not empty. To know that, look at the output of grub-install --help, skip to the description of the --target option, and it will tell you what the default is ("[default=i386-pc]" or "[default=x86_64-efi]"). BIOS install is possible if sys-boot/grub was installed with USE=grub_platforms_pc, which is a profile default for amd64.

UEFI install (--target=x86_64-efi) requires GPT partitioning and an EFI Sytem Partition (ESP) with FAT formatting, which may or may not be /boot.

BIOS install (--target=i386-pc) with MS-DOS partitioning requires enough space for the bootloader before the first partition.

BIOS install with GPT partitioning, which may or may not work depending on the case, requires that a "BIOS boot partition" be created for the bootloader, which is 'marked' using parted's set bios_grub on command, and is never mounted, so it certainly won't be /boot.

That's all.
Back to top
View user's profile Send private message
Goverp
l33t
l33t


Joined: 07 Mar 2007
Posts: 842

PostPosted: Mon May 18, 2020 7:44 am    Post subject: Reply with quote

Jaglover wrote:
... Grub2 is overkill for Gentoo, leave it to distros where automatic kernel updates take place.

It's not grub2 that's overkill, it's the stupid and complex auto-configuration tool. I wrote a manual configuration along the lines of a Grub Legacy .conf, with appropriate syntax changes and taking the opportunity to exploit the shell script in Grub 2, in an afternoon. No need to update it when I install a new kernel, as I use the "old fashioned" vmlinux symlink.
_________________
Greybeard
Back to top
View user's profile Send private message
Maf
Apprentice
Apprentice


Joined: 15 May 2005
Posts: 299

PostPosted: Tue May 19, 2020 8:14 am    Post subject: Reply with quote

Goverp wrote:
Jaglover wrote:
... Grub2 is overkill for Gentoo, leave it to distros where automatic kernel updates take place.

It's not grub2 that's overkill, it's the stupid and complex auto-configuration tool. I wrote a manual configuration along the lines of a Grub Legacy .conf, with appropriate syntax changes and taking the opportunity to exploit the shell script in Grub 2, in an afternoon. No need to update it when I install a new kernel, as I use the "old fashioned" vmlinux symlink.


Same feelings here, whole grub2 feels overengineered, just like grub1 felt overengineered when I was moving from LILO years ago. I use hand-written grub.cfg and it does the job.

@pdr: Could you solve your problem? I use grub2 + MBR boot, so maybe I could help.
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