Forums

Skip to content

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

[Solved] mounting efi partition on /boot/efi

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
12 posts • Page 1 of 1
Author
Message
juniper
l33t
l33t
User avatar
Posts: 986
Joined: Fri Oct 22, 2004 12:03 am
Location: we the north

[Solved] mounting efi partition on /boot/efi

  • Quote

Post by juniper » Tue Jun 20, 2023 4:59 am

I am installing gentoo right now.

I have a windows partition on the machine. There is already an efi partition so I don't think I should follow the guide and create a new efi partition.

I installed gentoo a few months ago on another machine (the machine I am currently typing from, so it works). and I thought the recommendation was to mount the efi partition on /boot/efi but now the recommendation seems to be to mount the efi partition on /boot.

is this correct? Can I do it the old way that I know works.
Last edited by juniper on Wed Jun 21, 2023 5:03 pm, edited 1 time in total.
Top
Banana
Moderator
Moderator
User avatar
Posts: 2378
Joined: Fri May 21, 2004 12:02 pm
Location: Germany
Contact:
Contact Banana
Website

  • Quote

Post by Banana » Tue Jun 20, 2023 6:58 am

I'm also somtimes confused about the mount paths. So no answer here.

But you should use for each OS its own EFI partition. This way the other OS does not overwrite anything.
Forum Guidelines

PFL - Portage file list - find which package a file or command belongs to.
My delta-labs.org snippets do expire
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56077
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Tue Jun 20, 2023 7:37 am

juniper,

It all depends how you will choose which operating system to boot.

With separate EFI partitions, you will have separate boot loaders for each.
Each will have its own EFI compliant binary to be loaded by the firmware.
To choose operating systems, you would normally enter the firmware and change the boot order or set the boot override.

However some boot loaders can 'chain load' other boot loaders, so you could use one boot loader to load other boot loaders.

Alternately, you choose at the outset to have one boot loader. The firmware always starts this boot loader, so there is no faffing about in the firmware settings.
All the various operating systems appear on the boot loaders menu.

There is no restriction on where kernels and initrd files go, unless your selected boot loader places some restrictions.

All three ways are right, pick one.
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
Goverp
Advocate
Advocate
User avatar
Posts: 2402
Joined: Wed Mar 07, 2007 6:41 pm

  • Quote

Post by Goverp » Tue Jun 20, 2023 7:48 am

Banana wrote:... you should use for each OS its own EFI partition. This way the other OS does not overwrite anything.
I'm not sure I understand this. AFAIK there is only one EFI partition on a disk, and it's the way an UEFI-booting pc finds its boot manager; there's a flag in the GPT partition table to identify it. If you created multiple partitions to do EFI things, you'd have to fiddle around in BIOS to switch from one to another.

OS's in general do not write to the EFI; their installation process might if you let it, or if it's badly written, but you should always take care when installing any OS (for example, when partitioning :-) ). I've had Windows make a mess of the Windows entries, but not my Gentoo ones!

I'd guess the most common area you might expect a conflict is trying to install Windows alongside Linux, but Windows puts its own bootloader into EFI/Windows, whereas say Gentoo uses, not surprisingly, EFI/gentoo, and should not play outside those directories. Some bootloaders can do more complex stuff - rEFInd uses EFI/refind like it should; Gentoo's GRUB puts grub64.efi into EFI/gentoo, but in this case you can legitimately argue GRUB is part of Gentoo. Things will get more complex if you install another Linux alongside - say Ubuntu. I don't know, but perhaps Ubuntu might create another grub64.efi somewhere, but that's irrelevant - you'd still use the same GRUB instance and need to update its /boot/grub/grub.cfg, which of course is not in EFI at all!

I agree this area contains traps ready to catch the unwary, but I don't think separate EFI partitions is a solution.
Greybeard
Top
pietinger
Moderator
Moderator
Posts: 6617
Joined: Tue Oct 17, 2006 5:11 pm
Location: Bavaria

Re: mounting efi partition on /boot/efi

  • Quote

Post by pietinger » Tue Jun 20, 2023 9:58 am

juniper wrote:Can I do it the old way that I know works.
YES ! 8)

You can mount your (existent) ESP (efi system partition) to any directory you like ... just give the installation routine of grub the correct info about this directory. UEFI specification says: This ESP must have a directory named "efi" (or "EFI"). In this directory you can have multiple directories (*) with bootable binaries (must have .efi as suffix). There are more than two possible solutions:

1. Our AMD64 handbook recommends to use the directory /boot as mount point for this ESP. So you will have /boot/efi ... and all grub files will go into your ESP (needs one mount to access \efi).
2a. You can have an extra partition for/as your /boot. Then you must mount this partition to /boot ... and all grub files will go into this extra partition. In there you will need a directory for mounting your ESP. Mostly it is named also "efi" - but you could also name it "esp"; then you will have /boot/efi/efi or /boot/esp/efi (needs two mounts to access \efi)
2b. You can use the existant boot-directory of your root partition without mounting an extra partition to it ... and all grub files will go into your root partition. In there you will need a directory for mounting your ESP. Mostly it is named also "efi" - but you could also name it "esp"; then you will have /boot/efi/efi or /boot/esp/efi (needs one mount to access \efi)


(* here are mine:

Code: Select all

# efibootmgr
BootCurrent: 0002
Timeout: 1 seconds
BootOrder: 0002,0000,0001
Boot0000* Secure        HD(1,GPT,0adcbfee-21aa-42ea-9a9a-2e53bd05e6a2,0x800,0x7f800)/File(\efi\secure\bzImage.efi)
Boot0001* gentoo        HD(1,GPT,0adcbfee-21aa-42ea-9a9a-2e53bd05e6a2,0x800,0x7f800)/File(\EFI\gentoo\grubx64.efi)
Boot0002* Unlocked      HD(1,GPT,0adcbfee-21aa-42ea-9a9a-2e53bd05e6a2,0x800,0x7f800)/File(\efi\unlocked\bzImage.efi)
Top
juniper
l33t
l33t
User avatar
Posts: 986
Joined: Fri Oct 22, 2004 12:03 am
Location: we the north

  • Quote

Post by juniper » Tue Jun 20, 2023 7:16 pm

@Banana: I think you are wrong. But someone here knows better than me and they can set things straight.

@the rest: Thanks for the replies. Neddy, I like my /boot/efi partition used along with GRUB. I think I am going to that route, which I think is endorsed by pietinger.
Top
Banana
Moderator
Moderator
User avatar
Posts: 2378
Joined: Fri May 21, 2004 12:02 pm
Location: Germany
Contact:
Contact Banana
Website

  • Quote

Post by Banana » Wed Jun 21, 2023 11:08 am

The multiple efi or esp partitions topic is not really 100% clear https://news.ycombinator.com/item?id=16261237
But there are cases in which https://devblog.xkern.net/multiple-efi- ... ingle-disk , https://forum.manjaro.org/t/create-a-se ... ot/62066/9 , https://forums.opensuse.org/t/why-multi ... t/143881/6 they do work.
Forum Guidelines

PFL - Portage file list - find which package a file or command belongs to.
My delta-labs.org snippets do expire
Top
juniper
l33t
l33t
User avatar
Posts: 986
Joined: Fri Oct 22, 2004 12:03 am
Location: we the north

  • Quote

Post by juniper » Wed Jun 21, 2023 5:02 pm

@Banana: weird. Never seen multiple esp partitions.

@pietinger: it always seemed weird to me to have the esp partition mounted on boot in a dual boot machine.

In any case, for anyone reading this, my setup is (not quite, I have nvme partitions) but for simplicity

/dev/sda1 esp partition mounted on /boot/efi
/dev/sda2 mounted on /boot
/dev/sda3 mounted on /

Then when you get to the configuring bootloader section of the install manual, install grub as instructed. Now mount all of the partitions above (likely, you already have / and /boot mounted, so you only need to mount /boot/efi). Unless you need to do something funny, this is basically the only time you ever need to mount /boot/efi (in my fstab, I have /boot/efi set to noauto, so it does not mount on boot). After you build your kernel, installing it puts your kernel in /boot. Then execute

Code: Select all

grub-install --target=x86_64-efi --efi-directory=/boot/efi
This is the key line and where you can basically mount your esp partition anywhere (replace the last argument with wherever you mount it). Then

Code: Select all

grub-mkconfig -o /boot/grub/grub.cfg
After this you should be good to go. On my desktop I never mounted the /boot/efi drive after this. All updated kernels just go in /boot and the grub-mkconfig command above updates the grub menu. The esp drive isn't touched.
Top
Banana
Moderator
Moderator
User avatar
Posts: 2378
Joined: Fri May 21, 2004 12:02 pm
Location: Germany
Contact:
Contact Banana
Website

  • Quote

Post by Banana » Wed Jun 21, 2023 6:33 pm

I'm running currently a dual boot with windows. (Multiple PCs and this one I was not sure about. So I needed to check it first)

There are two disks (physical) which do have their own EFI partition.
Forum Guidelines

PFL - Portage file list - find which package a file or command belongs to.
My delta-labs.org snippets do expire
Top
pietinger
Moderator
Moderator
Posts: 6617
Joined: Tue Oct 17, 2006 5:11 pm
Location: Bavaria

  • Quote

Post by pietinger » Wed Jun 21, 2023 6:44 pm

juniper wrote:@pietinger: it always seemed weird to me to have the esp partition mounted on boot in a dual boot machine.
Everything has its advantages and disadvantages ... yes, it depends also what you want to do.

For example: I dont use grub anymore (only as backup); I have my two (stub-) kernels (with different configs) and boot them directly from UEFI; this means I dont do a "make install" because I must copy my kernels into \efi\...\bzImage.efi. So, it is more senseful (for me) to mount my ESP directly to /boot (and of course I am an old man I have a "noauto" in my fstab for this) and DONT need two mounts (and dont need the ugly ".../efi/efi/...")

For dual booting with windows your approach could fit better for you.

(wwe had a time with a lot of confusion because our AMD64 handbook recommends to mount ESP directly to /boot, while in our Wiki article your solution with an extra partition for boot was described)
Top
GDH-gentoo
Advocate
Advocate
User avatar
Posts: 2111
Joined: Sat Jul 20, 2019 7:02 pm
Location: South America

  • Quote

Post by GDH-gentoo » Wed Jun 21, 2023 7:35 pm

Banana wrote:There are two disks (physical) which do have their own EFI partition.
"Multiple ESPs" needs context: multiple disks, each of them with one ESP, is OK. On the other hand, one disk with multiple ESPs (i.e. multiple partitions marked with partition type GUID C12A7328-F81F-11D2-BA4B-00A0C93EC93B) can confuse the UEFI firmware, for the reasons stated by Goverp.

grub-install's --efi-directory option can be omitted if the ESP's mountpoint is /boot/efi. Option --target=x86_64-efi can be omitted if the OS that is being used for running grub-install has booted in UEFI mode.
Ionen wrote:As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
Top
sMueggli
l33t
l33t
Posts: 627
Joined: Sat Sep 03, 2022 9:22 am

  • Quote

Post by sMueggli » Thu Jun 22, 2023 9:52 am

Mounting the ESP at /boot can make sense, if you are directly loading the kernel from the firmware. For all other cases I dare to say that using the ESP as /boot partition is not the best case.

Using a bootloader, it is sufficient, if the EFI binary of the bootloader is present on the ESP (at the correct location). In the case of Grub, there is less than 1 MiB needed.

I can think only of very few and very special cases where separated ESPs can make sense. In 99% of all cases, exactly one ESP is needed. It will probably need another decade until the "you need separate ESP partitons" modern fairy tale will disappear.
Top
Post Reply

12 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