Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Installing Gentoo
  • Search

Grub2 [not solved, compromised]

Having problems with the Gentoo Handbook? If you're still working your way through it, or just need some info before you start your install, this is the place. All other questions go elsewhere.
Post Reply
Advanced search
15 posts • Page 1 of 1
Author
Message
pdr
l33t
l33t
User avatar
Posts: 618
Joined: Sat Mar 20, 2004 10:28 pm

Grub2 [not solved, compromised]

  • Quote

Post by pdr » Sat May 16, 2020 8:51 pm

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: Select all

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.
Top
CaptainBlood
Advocate
Advocate
User avatar
Posts: 4237
Joined: Sun Jan 24, 2010 9:38 am

Re: Grub2

  • Quote

Post by CaptainBlood » Sat May 16, 2020 9:15 pm

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

Code: Select all

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: Select all

grep GRUB /etc/portage/make.conf 
GRUB_PLATFORMS="pc"
no uefi here.
Thks 4 ur attention, interest & support.
Top
CaptainBlood
Advocate
Advocate
User avatar
Posts: 4237
Joined: Sun Jan 24, 2010 9:38 am

Re: Grub2

  • Quote

Post by CaptainBlood » Sat May 16, 2020 9:30 pm

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: Select all

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.
Top
pietinger
Administrator
Administrator
Posts: 6630
Joined: Tue Oct 17, 2006 5:11 pm
Location: Bavaria

  • Quote

Post by pietinger » Sat May 16, 2020 10:35 pm

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"
Top
pdr
l33t
l33t
User avatar
Posts: 618
Joined: Sat Mar 20, 2004 10:28 pm

  • Quote

Post by pdr » Sun May 17, 2020 9:55 am

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...
Top
pietinger
Administrator
Administrator
Posts: 6630
Joined: Tue Oct 17, 2006 5:11 pm
Location: Bavaria

  • Quote

Post by pietinger » Sun May 17, 2020 10:58 am

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.
Top
superjaded
l33t
l33t
User avatar
Posts: 802
Joined: Fri Jul 05, 2002 9:07 am

  • Quote

Post by superjaded » Sun May 17, 2020 11:01 am

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:
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:
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:
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.
Top
pdr
l33t
l33t
User avatar
Posts: 618
Joined: Sat Mar 20, 2004 10:28 pm

  • Quote

Post by pdr » Sun May 17, 2020 6:12 pm

And gems like when running grub-install (with EFI target) using /boot, and in the /etc/fstab saying that should be ext2, and..
Top
pdr
l33t
l33t
User avatar
Posts: 618
Joined: Sat Mar 20, 2004 10:28 pm

  • Quote

Post by pdr » Sun May 17, 2020 6:15 pm

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.
Top
Hu
Administrator
Administrator
Posts: 24398
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Sun May 17, 2020 6:34 pm

Instead of wiping the installation, you could have used a more forgiving bootloader. :) I have been quite happy using syslinux in place of grub2.
Top
Jaglover
Watchman
Watchman
User avatar
Posts: 8291
Joined: Sun May 29, 2005 1:57 am
Location: Saint Amant, Acadiana

  • Quote

Post by Jaglover » Sun May 17, 2020 7:05 pm

+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.
My Gentoo installation notes.
Please learn how to denote units correctly!
Top
pietinger
Administrator
Administrator
Posts: 6630
Joined: Tue Oct 17, 2006 5:11 pm
Location: Bavaria

  • Quote

Post by pietinger » Sun May 17, 2020 7:56 pm

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.
Top
GDH-gentoo
Advocate
Advocate
User avatar
Posts: 2113
Joined: Sat Jul 20, 2019 7:02 pm
Location: South America

  • Quote

Post by GDH-gentoo » Sun May 17, 2020 8:51 pm

I fail to see the problem here. The command to perform a BIOS install is:

Code: Select all

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 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.
Last edited by GDH-gentoo on Mon Jun 08, 2020 12:54 am, edited 1 time in total.
Top
Goverp
Advocate
Advocate
User avatar
Posts: 2402
Joined: Wed Mar 07, 2007 6:41 pm

  • Quote

Post by Goverp » Mon May 18, 2020 7:44 am

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
Top
Maf
Guru
Guru
User avatar
Posts: 310
Joined: Sun May 15, 2005 2:51 pm

  • Quote

Post by Maf » Tue May 19, 2020 8:14 am

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.
Top
Post Reply

15 posts • Page 1 of 1

Return to “Installing Gentoo”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic