Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
UEFI/GPT boot; What is minimally necessary?
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
duderonomy
Guru
Guru


Joined: 20 Mar 2004
Posts: 349
Location: SF Bay Area

PostPosted: Tue Aug 25, 2015 6:01 am    Post subject: UEFI/GPT boot; What is minimally necessary? Reply with quote

Hello,

I'd like to get a kind of sanity check regarding the document Quick Installation Checklist. Can it be relied on for UEFI booting? I would have thought the document would mention 'efibootmgr'. But what do I know. :) I suppose my ultimate question about that guide is, "Does it cover everything necessary for UEFI booting?"

The few times I have successfully made boards boot in UEFI mode with GPT partition is by creating a BIOS partition (type EF02), a little of my persistence and a lot of luck.

Since I have not yet learned to pronounce rEFInd, I will leave learning it for another day.

I'd really like to get to know what are the essential elements involved in a simple UEFI/GPT boot scenario with Gentoo Linux. Can somebody express it in this thread in a few lines?

Alternatively, is there a guide for this?? (which I have clearly overlooked while searching)

I notice from reading one doc that efibootmgr acts on partition 1 of the device by default, which may explain why other guides suggest putting the efi partition on the first partition. And for dual booters I think Windows wants it there, too.

Many thanks!
:D
Back to top
View user's profile Send private message
The Doctor
Moderator
Moderator


Joined: 27 Jul 2010
Posts: 2574

PostPosted: Tue Aug 25, 2015 6:28 am    Post subject: Reply with quote

Looks fine to me, but minimal for UEFI is really simple. Make that boot partition, format it vfat, and name your kernel /boot/efi/BOOT/BOOTX64.EFI (assuming your boot partition is mounted at /boot) Literally, that is all you need to do.

Dual booting is a little more complex since this file is windows, but you can name it anything and put it next to windows and use efibootmgr to add the new name to the list of options. Then you can choose using F12 or whatever your UEFI implantation uses to choose OS.

This will automatically boot your kernel with no questions asked, assuming you configured a bootable kernel.
_________________
First things first, but not necessarily in that order.

Apologies if I take a while to respond. I'm currently working on the dematerialization circuit for my blue box.
Back to top
View user's profile Send private message
duderonomy
Guru
Guru


Joined: 20 Mar 2004
Posts: 349
Location: SF Bay Area

PostPosted: Tue Aug 25, 2015 8:30 am    Post subject: Reply with quote

Thank you, Doctor.

In an attempt to make use of my current state, here is what I did.
While chroot'd,
Code:
sysresccd boot # mount /dev/sda2 efi
sysresccd boot # grub2-install --target=x86_64-efi
Installing for x86_64-efi platform.
Installation finished. No error reported.

where, sda2 is the vfat partition,
and 'efi' is at /boot/efi

Then, copied a kernel to the pathname "EFI/gentoo/grubx64.efi" on sda2

This was clearly progress because upon reset the desired kernel booted.
But it was quickly over as I get a kernel panic -
not sycning: VFS: Unable to mount root fs on known-block(0,0)

Could somebody suggest what may remedy this? What should I investigate? Thx!
Back to top
View user's profile Send private message
duderonomy
Guru
Guru


Joined: 20 Mar 2004
Posts: 349
Location: SF Bay Area

PostPosted: Tue Aug 25, 2015 8:53 am    Post subject: Reply with quote

Is the fstab in the aforementioned Quick Installation Guide workable with the partitions created and subsequent mount points from an earlier section of the document?

Thx!
:D
Back to top
View user's profile Send private message
Troopo
Apprentice
Apprentice


Joined: 14 Jun 2015
Posts: 158

PostPosted: Tue Aug 25, 2015 7:09 pm    Post subject: Reply with quote

Take a look in this thread as well it was just opened not long ago.

https://forums.gentoo.org/viewtopic-t-1026858.html
Back to top
View user's profile Send private message
duderonomy
Guru
Guru


Joined: 20 Mar 2004
Posts: 349
Location: SF Bay Area

PostPosted: Fri Aug 28, 2015 3:23 am    Post subject: Reply with quote

Fantastic!
Thank you so much for the awesome lead with more modern info.
Thanks Troopo! :) :)
Back to top
View user's profile Send private message
duderonomy
Guru
Guru


Joined: 20 Mar 2004
Posts: 349
Location: SF Bay Area

PostPosted: Sat Aug 29, 2015 3:31 am    Post subject: Reply with quote

Well, after I got into reading that wonderful set of documentation,
the added complexity of encrypting the file systems and LVM
was a bit distracting; causing me to lose track of the details that
I am trying to sort out. Haha! :)

So, now I am back to the updated Gentoo Handbook, on this page:
https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Disks

The page says:
Now create a 2 MB partition that will be used by the GRUB2 boot loader later.

I am believe this is one way to do it.
I'd like to understand the objective for doing it this way. Why?

I read that UEFI can load the Linux kernel directly skipping the traditional bootloader,
with this minimal partition table:
Code:
/boot  (EFI boot partition)
swap
/      (root)

What does this 2 MiB partition with the bios_grub attribute do? What's the use case for that? Is it for dual booting with Windows?

EDIT:
It looks like NeddySeagoon has a good explanation in a recent post 7799790
Case closed, I think. :)

Thx!
:D
Back to top
View user's profile Send private message
duderonomy
Guru
Guru


Joined: 20 Mar 2004
Posts: 349
Location: SF Bay Area

PostPosted: Tue Sep 01, 2015 1:10 am    Post subject: Reply with quote

So yes, it works just as easy as the doctor sez it does.
Nice that the Gentoo Handbook is updated for GPT and UEFI.
Thanks to Gentoo volunteers for that.
I presume the bios_grub partition is for Windows dual boot; I do not use one.
genkernel installed files into /boot

IIRC, the one thing slightly different was adding the arg "--efi-directory=/boot" when running grub2-install.
Code:
(chroot) livecd / # grub2-install /dev/sda
Installing for x86_64-efi platform.
grub2-install: error: cannot find EFI directory.

(chroot) livecd / # grub2-install --efi-directory=/boot /dev/sda
Installing for x86_64-efi platform.
Installation finished. No error reported.

## It worked!

## Let's view some of /boot

(chroot) livecd / # ls -FlR /boot
/boot:
total 11704
drwxr-xr-x 4 root root    8192 Aug 29 01:25 efi/
drwxr-xr-x 6 root root    8192 Aug 29 01:27 grub/
-rwxr-xr-x 1 root root 3399072 Aug 29 01:08 initramfs-genkernel-x86_64-4.0.0-gentoo*
-rwxr-xr-x 1 root root 4853504 Aug 29 01:02 kernel-genkernel-x86_64-4.0.0-gentoo*
-rwxr-xr-x 1 root root 3709064 Aug 29 01:02 System.map-genkernel-x86_64-4.0.0-gentoo*

/boot/efi:
total 16
drwxr-xr-x 2 root root 8192 Aug 29 01:11 boot/
drwxr-xr-x 2 root root 8192 Aug 29 01:25 gentoo/

/boot/efi/boot:
total 4744
-rwxr-xr-x 1 root root 4853504 Aug 29 01:02 bootx64.efi*

/boot/efi/gentoo:
total 120
-rwxr-xr-x 1 root root 115712 Aug 29 08:06 grubx64.efi*

/boot/grub:
total 88
drwxr-xr-x 2 root root  8192 Aug 29 01:25 fonts/
-rwxr-xr-x 1 root root 25594 Aug 29 01:27 grub.cfg*
-rwxr-xr-x 1 root root  1024 Aug 29 01:25 grubenv*
drwxr-xr-x 2 root root  8192 Aug 29 01:25 locale/
drwxr-xr-x 3 root root  8192 Aug 29 01:25 themes/
drwxr-xr-x 2 root root 24576 Aug 29 08:06 x86_64-efi/

  8< snip >8

(chroot) livecd / # efibootmgr -v
BootCurrent: 0009
Timeout: 1 seconds
BootOrder: 0000,0007,0002,0009,000A,0008
Boot0000* gentoo   HD(1,GPT,8d86e60f-a447-4239-bec1-574a00d54e00,0x800,0xaf000)/File(\EFI\gentoo\grubx64.efi)
Boot0002* Linux   VenHw(99e275e7-75a0-4b37-a2e6-c5385e6c00cb)
Boot0007* CD/DVD Drive    BBS(CDROM,,0x0)..GO..NO........O.H.L.-.D.T.-.S.T.D.V.D.-.R.A.M. .G.H.6.0.N.................>..Gd-.;.A..MQ..L.0.M.B.0.K.5.5.8.0.2. .1. . . . . . . . ........BO
Boot0008* Hard Drive    BBS(HD,,0x0)..GO..NOy.......O.S.T.3.5.0.0.4.1.8.A.S.................>..Gd-.;.A..MQ..L. . . . . . . . . . . . .2.W.0.A.A.7.2.M........BO..NO........O.H.G.S.T. .H.D.N.7.2.4.0.3.0.A.L.E.6.4.0.................>..Gd-.;.A..MQ..L. . . . . . .K.P.2.2.4.3.9.P.9.H.E.A.Y.A........BO..NO........O.S.T.3.0.0.0.D.M.0.0.1.-.1.E.R.1.6.6.................>..Gd-.;.A..MQ..L. . . . . . . . . . . . .5.Z.0.0.M.9.G.R........BO..NO........O.H.G.S.T. .H.D.N.7.2.4.0.3.0.A.L.E.6.4.0.................>..Gd-.;.A..MQ..L. . . . . . .K.P.2.2.4.3.9.P.9.H.9.B.Y.4........BO..NO........Q.A.D.A.T.A. .U.S.B. .F.l.a.s.h. .D.r.i.v.e.................@..Gd-.;.A..MQ..L.A.D.A.T.A. .U.S.B. .F.l.a.s.h. .D.r.i.v.e........BO
Boot0009* UEFI: ADATA USB Flash Drive   PciRoot(0x0)/Pci(0x14,0x0)/USB(18,0)/USB(2,0)/HD(1,MBR,0x4294967264,0x800,0xeb7800)..BO
Boot000A* UEFI OS   HD(1,GPT,3cc50af7-2598-4854-95fe-9d8a4ffa87b6,0x800,0xaf000)/File(\EFI\BOOT\BOOTX64.EFI)

(chroot) livecd / # grub2-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/kernel-genkernel-x86_64-4.0.0-gentoo
Found initrd image: /boot/initramfs-genkernel-x86_64-4.0.0-gentoo
done

# proceed to unmount everything, exit chroot, and reboot


The disk:
Code:
Found valid GPT with protective MBR; using GPT.

Command (? for help): p
Disk /dev/sda: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 175C8317-EA91-47FF-99B7-5A2354F7622A
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 976773134
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048          718847   350.0 MiB   EF00  EFI System
   2          718848         9107455   4.0 GiB     8200  Linux swap
   3         9107456       976773134   461.4 GiB   8300  Linux filesystem


As I only went through this once, so therefore no experimentation to discover what was not necessary.
For example, is the grub2-mkconfig necessary?
I thought that the UEFI boot process boots the code at this filepath: /boot/efi/boot/bootx64.efi
Also, I could not find 'cp' in my history to copy the kernel created by genkernel.
But clearly the file size is same as the kernel. It is the kernel. :)
I guess I ran that in another terminal session along with running genkernel (which I clearly recall. lol!).

HTH!
:D
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