Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Boot partitions with UEFI?
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
StoneC0ld
n00b
n00b


Joined: 27 Jul 2006
Posts: 45

PostPosted: Sun Nov 20, 2016 9:08 pm    Post subject: Boot partitions with UEFI? Reply with quote

Trying to install gentoo on new hardware that uses UEFI. Second attempt, since the handbook leaves out a bit of critical information that resulted in grub-install detecting that /boot is not an EFI partition...

Per the handbook, I created a 2MB partition on /dev/sda1 for grub, 128MB partition for /boot on /sda2, and the rest of the drive on /sda3 for rootfs. (Swap is on a separate drive)

Handbook instructions:
format /dev/sda2 as ext2, /dev/sda3 as ext4, /dev/sda1 never did get formatted.

What I tried on second attempt:
format /dev/sda1 as ext2, /dev/sda2 as vfat/fat32, and /dev/sda3 as ext4.

But, now I haven't the slightest idea where I'm supposed to mount /dev/sda1 for the installation process. I have /dev/sda3 mounted in /mnt/gentoo, but now I don't know if /dev/sda2 is still supposed to be mounted in /mnt/gentoo/boot or somewhere else, and no clue where /dev/sda1 is supposed to be mounted at all.

Did I format the partitions correctly? Where am I supposed to mount the boot and grub partitions?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43175
Location: 56N 3W

PostPosted: Sun Nov 20, 2016 10:30 pm    Post subject: Reply with quote

StoneC0ld,

Some history, archaeology even . The MSDOS partition table leaves some unallocated space before the first partition.
Grub and other things help themselves to this space.
With a GPT disk label, the primary copy of the partition table is here, so grub can't use it.

However, grub still needs a few MB for itself. With GPT, you make a 2Mb partition for grub.
You don't format it, you don't mount it. Grub uses it for the code that used to go in the 'wasted space'.

You mount sda3 (root) at /mnt/gentoo, you mount sda2 at /mnt/gentoo/boot and you don't mount sda1 at all. Its grubs, not yours.
sda1 will not be listed in /etc/fstab either.

Grub won't care that you have formatted it.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7550
Location: Goose Creek SC

PostPosted: Mon Nov 21, 2016 1:37 am    Post subject: Reply with quote

Adding a trivial point, if grub for uefi is used it does not use the 2mb unformatted bios boot partition as it uses the fat32 (vfat) formatted EFI System Partition.
_________________
Defund the FCC.
Back to top
View user's profile Send private message
StoneC0ld
n00b
n00b


Joined: 27 Jul 2006
Posts: 45

PostPosted: Mon Nov 21, 2016 6:12 am    Post subject: Reply with quote

Thanks for the response.

Followed instructions, completed install process, now the system does not recognize the partition as bootable, and skips through to try to boot from LAN.

Code:
livecd ~ # parted -a optimal /dev/sda
GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: ATA INTEL SSDSC2BB48 (scsi)
Disk /dev/sda: 480GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number   Start      End         Size       File System        Name        Flags
 1       1049kB     3146kB      2097kB     ext2               grub        bios_grub
 2       3146kB     137MB       134MB      fat32              boot        boot, esp
 3       137MB      480GB       480GB      ext4               rootfs


Other than the 2MB first partition being formatted as ext2 (which, as pointed out earlier, should not be a factor), is there anything wrong with this?
Back to top
View user's profile Send private message
sebaro
Veteran
Veteran


Joined: 03 Jul 2006
Posts: 1129
Location: Romania

PostPosted: Mon Nov 21, 2016 7:36 am    Post subject: Reply with quote

With UEFI you have two options:

1. GRUB: https://wiki.gentoo.org/wiki/GRUB2#UEFI_with_GPT
2. EFI stub kernel: https://wiki.gentoo.org/wiki/EFI_stub_kernel
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43175
Location: 56N 3W

PostPosted: Mon Nov 21, 2016 9:57 am    Post subject: Reply with quote

DONAHUE,

That's interesting about grub not using the 2Mb partition.
How does grub start?

Conventionally, the MBR, loads the code embedded in the free space before the first partition, or from the 2Mb partion.
Its this code that reads a filesystem.
Does EFI load grub stage2 directly, without the MBR and embedded code?

I don't have an EFI system to practice on.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43175
Location: 56N 3W

PostPosted: Mon Nov 21, 2016 10:01 am    Post subject: Reply with quote

StoneC0ld,

Wild guesses.

The BIOS is not in EFI mode, so its looking at the 'protective' MSDOS partition table for the bootable flag and not seeing it.
If it is in EFI mode, its looking at your /boot and not finding a file name it wants.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Lokesh
Tux's lil' helper
Tux's lil' helper


Joined: 01 Apr 2012
Posts: 131

PostPosted: Mon Nov 21, 2016 2:19 pm    Post subject: Reply with quote

It is interesting to see that there are still multiple views on the requirements for UEFI booting, after all the years.

I am using Grub2 on an EFI boot and use as a bare minimum only two partitions (1&2 or 1&3, respectively):
Code:
Number  Start  End    Size   Filesystem  Name    Flags
 1      1049kB  250MB   249MB   fat32        boot    boot, esp
 2      250MB   40,2GB  40,0GB  ext4         Debian
 3      40,2GB  61,2GB  21,0GB  ext4         Gentoo

Grub has been installed with the installation of the first Linux. No specific grubs partition at all. As you can see, this setting even works for multiple installation of different Linux.

Weird.

Lokesh
_________________
Sometimes frustrated Linux User
Back to top
View user's profile Send private message
Lokesh
Tux's lil' helper
Tux's lil' helper


Joined: 01 Apr 2012
Posts: 131

PostPosted: Mon Nov 21, 2016 2:57 pm    Post subject: Re: Boot partitions with UEFI? Reply with quote

StoneC0ld wrote:
Trying to install gentoo on new hardware that uses UEFI. Second attempt, since the handbook leaves out a bit of critical information that resulted in grub-install detecting that /boot is not an EFI partition...

When you use a CD/DVD as installation medium, it will most likely boot in UEFI mode. You should check therefore whether your installation medium is booted in UEFI mode. If yes, grub installation will automatically use grub for UEFI, meaning it recognises an existing ESP.

Maybe trivial, but I had spent days to find this out.

Lokesh
_________________
Sometimes frustrated Linux User
Back to top
View user's profile Send private message
StoneC0ld
n00b
n00b


Joined: 27 Jul 2006
Posts: 45

PostPosted: Mon Nov 21, 2016 6:14 pm    Post subject: Reply with quote

NeddySeagoon wrote:
StoneC0ld,

Wild guesses.

The BIOS is not in EFI mode, so its looking at the 'protective' MSDOS partition table for the bootable flag and not seeing it.
If it is in EFI mode, its looking at your /boot and not finding a file name it wants.


UEFI is definitely enabled.
If there's nothing inside /boot that the system likes, then the grub installation method in the Gentoo Handbook is wrong, because I followed it to the letter.
Back to top
View user's profile Send private message
Lokesh
Tux's lil' helper
Tux's lil' helper


Joined: 01 Apr 2012
Posts: 131

PostPosted: Tue Nov 22, 2016 8:37 am    Post subject: Reply with quote

StoneC0ld wrote:
UEFI is definitely enabled.
If there's nothing inside /boot that the system likes, then the grub installation method in the Gentoo Handbook is wrong, because I followed it to the letter
First, I would simply delete the bios_grub partition. As Donahue stated, it is unneccessary and may even be counterproductive. I agree that the handbook is confusing since ALL examples of partitioning layouts are for non-UEFI sytems. For UEFI Systems you need the vfatted ESP, plus root.
Secondly, grub:2 has to be installed with the appropriate prior change to make.conf (GRUB_PLATFORMS="efi-64")
Thirdly, after the installation and before rebooting (alternatively: chroot into the new system): check whether grup-update has done a proper job. Run efibootmgr -v to see, whether your system is listed, including path to the Efi-stub file in the ESP (post the output here).
And last, what exactly is inside the /boot directory?

Lokesh
_________________
Sometimes frustrated Linux User
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7550
Location: Goose Creek SC

PostPosted: Tue Nov 22, 2016 3:43 pm    Post subject: Reply with quote

I think there used to be a tendency to use the empty sectors for other programs than boot loaders, perhaps mainly in the MS world. Having the bios_grub partition is harmless and could accommodate such a program.
@ Neddy:
When I first experimented with UEFI/EFI, I found my motherboard had the traditional rom and cmos plus some flash ram where the base level of efi lived. The UEFI spec is virtually unreadable.
Roderick W. Smith, http://www.rodsbooks.com/linux-uefi/ , my hero in the messy world of UEFI.
AdamW does better for readability than the specification, https://www.happyassassin.net/2014/01/25/uefi-boot-how-does-that-actually-work-then/ though lacking the conciseness of Neddy Seagoon's explanation of mbr booting.
Both authors provide practical advice.
_________________
Defund the FCC.
Back to top
View user's profile Send private message
StoneC0ld
n00b
n00b


Joined: 27 Jul 2006
Posts: 45

PostPosted: Tue Nov 22, 2016 8:59 pm    Post subject: Reply with quote

Code:
(chroot) livecd gentoo # efibootmgr -v
BootCurrent: 0012
Timeout: 1 seconds
BootOrder: 000E,0012,0010,0011,000D,0000
Boot0000* gentoo        VenHw(99e275e7-75a0-4b37-a2e6-c5385e6c00cb)
Boot000D* LAN : IBA GE Slot 00C8 v1403  BBS(Network,,0x0)..BO
Boot000E* SATA : PORT 3 : ASUS    DRW-24F1ST   c : PART 0 : Boot Drive  BBS(CDROM,,0x0)..BO
Boot0010* SATA : PORT 6G 1 : INTEL SSDSC2BB480G4 : PART 0 : Boot Drive  BBS(HD,,0x0)..BO
Boot0011* SATA : PORT 2 : Samsung SSD 840 EVO 120GB : PART 0 : Boot Drive       BBS(HD,,0x0)..BO
Boot0012* UEFI : SATA : PORT 3 : ASUS    DRW-24F1ST   c : PART 1 : OS Bootloader        PciRoot(0x0)/Pci(0x1f,0x2)/Sata(3,65535,0)/CDROM(1,0x7bc6,0x8800)..BO
(chroot) livecd gentoo #


Contents of /boot:
Code:
(chroot) livecd boot # ls -l
total 39420
drwxr-xr-x 3 root root      512 Nov 20 23:48 EFI
-rwxr-xr-x 1 root root  3002838 Nov 20 23:11 System.map-genkernel-x86_64-4.4.26-gentoo
drwxr-xr-x 6 root root      512 Nov 20 23:49 grub
-rwxr-xr-x 1 root root   122880 Nov 21 12:29 grubx64.efi
-rwxr-xr-x 1 root root 32287380 Nov 20 23:24 initramfs-genkernel-x86_64-4.4.26-gentoo
-rwxr-xr-x 1 root root  4951056 Nov 20 23:11 kernel-genkernel-x86_64-4.4.26-gentoo

The grubx64.efi I copied from /boot/EFI/gentoo in hopes that would work....

I did set the GRUB_PLATFORMS="efi-64" in make.conf prior to installing grub:2
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7550
Location: Goose Creek SC

PostPosted: Wed Nov 23, 2016 12:20 am    Post subject: Reply with quote

Did you boot a uefi supporting boot media in uefi mode before entering the chroot and emerging grub and running grub-install and grub-mkconfig? As best I know the gentoo minimal install cd does not support UEFI. System rescue cd does.
_________________
Defund the FCC.
Back to top
View user's profile Send private message
saboya
Guru
Guru


Joined: 28 Nov 2006
Posts: 442
Location: Brazil

PostPosted: Wed Nov 23, 2016 12:27 am    Post subject: Reply with quote

It was fairly straightforward to dualboot with Windows 10 on UEFI using rEFInd for me. I don't know what features you need from Grub2, but maybe you could take a look at it :)
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7550
Location: Goose Creek SC

PostPosted: Wed Nov 23, 2016 1:13 am    Post subject: Reply with quote

Agreed, efi_stub kernel as boot loader with rEFInd as boot manager is the optimum arrangement in my opinion. The lowest maintenance option because you do not need to move or rename kernels or run a grub or an efibootmgr or an elilo to add a new kernel to the menu. Deleting obsolete kernels from /boot is optional.
_________________
Defund the FCC.
Back to top
View user's profile Send private message
StoneC0ld
n00b
n00b


Joined: 27 Jul 2006
Posts: 45

PostPosted: Wed Nov 23, 2016 2:56 am    Post subject: Reply with quote

I'm using the full livedvd, so as far as I know, it should be booting the livedvd with UEFI...

I don't know if I did the grub-mkconfig, just did it now, it completed successfully, but still doesn't boot as if the hard drive wasn't even there.

It would appear that I can't use a stub kernel/rEFInd because I'm using genkernel, which uses initramfs

I suppose I should ask.... Is there really any point in enabling UEFI? Should I just disable UEFI in the CMOS and re-setup GRUB without it?
Back to top
View user's profile Send private message
saboya
Guru
Guru


Joined: 28 Nov 2006
Posts: 442
Location: Brazil

PostPosted: Wed Nov 23, 2016 3:45 am    Post subject: Reply with quote

You can use initramfs with refind.
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7550
Location: Goose Creek SC

PostPosted: Wed Nov 23, 2016 3:46 am    Post subject: Reply with quote

boot the livedvd, mount the gentoo partitions, run ls /sys/firmware/efi , if you do not see efivars in the output you did not boot the live dvd in uefi mode.
for a handbook setup
run fdisk -l , the boot partition should show:
Code:
Type
efi system

run parted -l , the boot partition should show:
Code:
File system  Name                          Flags
fat32           EFI system partition    boot, esp
Type, File Systems, Flags are required to be as shown for success.
_________________
Defund the FCC.
Back to top
View user's profile Send private message
StoneC0ld
n00b
n00b


Joined: 27 Jul 2006
Posts: 45

PostPosted: Wed Nov 23, 2016 3:57 am    Post subject: Reply with quote

Code:
livecd ~ # parted -l
Model: ATA INTEL SSDSC2BB48 (scsi)
Disk /dev/sda: 480GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number  Start   End    Size   File system  Name    Flags
 2      3146kB  137MB  134MB  fat32        boot    boot, esp
 3      137MB   480GB  480GB  ext4         rootfs

Code:
Disk /dev/sda: 447.1 GiB, 480103981056 bytes, 937703088 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 69F3B2F4-9BF2-4F67-A6DE-7EB8425C80AA

Device      Start       End   Sectors  Size Type
/dev/sda2    6144    268287    262144  128M EFI System
/dev/sda3  268288 937701039 937432752  447G Linux filesystem

Code:
(chroot) livecd / # ls /sys/firmware/efi
config_table  efivars  fw_platform_size  fw_vendor  runtime  runtime-map  systab  vars
(chroot) livecd / #
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7550
Location: Goose Creek SC

PostPosted: Wed Nov 23, 2016 4:29 am    Post subject: Reply with quote

so all good, except, looking harder,
Quote:
BootOrder: 000E,0012,0010,0011,000D,0000
Boot0000* gentoo VenHw(99e275e7-75a0-4b37-a2e6-c5385e6c00cb)
Boot000D* LAN : IBA GE Slot 00C8 v1403 BBS(Network,,0x0)..BO
Boot000E* SATA : PORT 3 : ASUS DRW-24F1ST c : PART 0 : Boot Drive BBS(CDROM,,0x0)..BO
Boot0010* SATA : PORT 6G 1 : INTEL SSDSC2BB480G4 : PART 0 : Boot Drive BBS(HD,,0x0)..BO
Boot0011* SATA : PORT 2 : Samsung SSD 840 EVO 120GB : PART 0 : Boot Drive BBS(HD,,0x0)..BO
Boot0012* UEFI : SATA : PORT 3 : ASUS DRW-24F1ST c : PART 1 : OS Bootloader PciRoot(0x0)/Pci(0x1f,0x2)/Sata(3,65535,0)/CDROM(1,0x7bc6,0x8800)..BO
Says that the boot choice is Boot000E* SATA : PORT 3 : ASUS DRW-24F1ST c : PART 0 : Boot Drive BBS(CDROM,,0x0)..BO (a non-uefi choice) instead of the only UEFI choice which looks like grub.
See if running
Code:
efibootmgr -o 0012,0000,000D,000E,0010,0011
efibootmgr
changes the Boot Order: . If 0012 goes to first place, reboot and see if grub appears.


edited to correct late night brain strain
_________________
Defund the FCC.


Last edited by DONAHUE on Wed Nov 23, 2016 12:10 pm; edited 1 time in total
Back to top
View user's profile Send private message
1clue
Advocate
Advocate


Joined: 05 Feb 2006
Posts: 2549

PostPosted: Wed Nov 23, 2016 5:10 am    Post subject: Reply with quote

Frankly this stuff about the tiny EF00 partition makes no sense to me. I have a functional UEFI system and I don't have this mystery partition. I use grub2 because it's comfortable for me.

I have:
Code:

# gdisk -l /dev/sdb
GPT fdisk (gdisk) version 1.0.1

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sdb: 468862128 sectors, 223.6 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 8ADF4872-8B42-4640-A687-F07360183E41
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 468862094
Partitions will be aligned on 2048-sector boundaries
Total free space is 27407469 sectors (13.1 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048         1054719   514.0 MiB   EF00  EFI System
   3         1054720        22026239   10.0 GiB    8300  Linux filesystem
   4        22026240       441456639   200.0 GiB   8E00  Linux LVM


Partition 1 is /boot
Partition 3 is /
Partition 4 is LVM.
Partition 2 was deleted shortly after install. It was a /boot with ext2 formatting, but once I figured out what was needed I removed it, removed partition 1, made a new partition 1 of EF00 partition type and FAT32 formatting which filled the space previously used by 1 and 2, and went on from there.

/boot is formatted FAT32 and is EF00.

Code:

# find /boot -type d
/boot
/boot/grub
/boot/grub/x86_64-efi
/boot/grub/locale
/boot/grub/themes
/boot/grub/themes/starfield
/boot/grub/fonts
/boot/EFI
/boot/EFI/BOOT


/boot/EFI/BOOT contains grubx64.efi.


A UEFI system boots and looks for UEFI boot sources enabled in its BIOS. Presumably one of them points to your boot disk.

Once it finds an EF00 partition it will examine it for a working boot loader. This could be a stub kernel or it could be something like grub. UEFI cares that it be formatted in FAT32 and that it has a correct stub or boot loader, it does not care about what else might be on the partition.

There's no reason to have a 2mb EF00 partition if you boot using UEFI. It needs to be bigger IMO, because you need a FAT32 filesystem on it and that has a minimum size. I typically have a few kernels (sometimes a lot) and so I have 512M partition size.

In my opinion the handbook is both wrong and misleading in recommending the 2mb EF00 partition, or at least it was when I installed my last system. There should be clear instructions indicating that booting in EFI mode needs different settings.
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7550
Location: Goose Creek SC

PostPosted: Wed Nov 23, 2016 5:52 am    Post subject: Reply with quote

It should not be a tiny ef00 partition, ef00 is hexadecimal meaning EFI Systems Partition. If it exists the tiny partition should be ef04 for bios_grub.
_________________
Defund the FCC.
Back to top
View user's profile Send private message
StoneC0ld
n00b
n00b


Joined: 27 Jul 2006
Posts: 45

PostPosted: Wed Nov 23, 2016 6:07 am    Post subject: Reply with quote

DONAHUE wrote:
so all good, except, looking harder,
Quote:
BootOrder: 000E,0012,0010,0011,000D,0000
Boot0000* gentoo VenHw(99e275e7-75a0-4b37-a2e6-c5385e6c00cb)
Boot000D* LAN : IBA GE Slot 00C8 v1403 BBS(Network,,0x0)..BO
Boot000E* SATA : PORT 3 : ASUS DRW-24F1ST c : PART 0 : Boot Drive BBS(CDROM,,0x0)..BO
Boot0010* SATA : PORT 6G 1 : INTEL SSDSC2BB480G4 : PART 0 : Boot Drive BBS(HD,,0x0)..BO
Boot0011* SATA : PORT 2 : Samsung SSD 840 EVO 120GB : PART 0 : Boot Drive BBS(HD,,0x0)..BO
Boot0012* UEFI : SATA : PORT 3 : ASUS DRW-24F1ST c : PART 1 : OS Bootloader PciRoot(0x0)/Pci(0x1f,0x2)/Sata(3,65535,0)/CDROM(1,0x7bc6,0x8800)..BO
Says that the boot choice is gentoo VenHw(99e275e7-75a0-4b37-a2e6-c5385e6c00cb) presumably a stub kernel instead of the only UEFI choice which looks like grub.
See if running
Code:
efibootmgr -o 0012,0000,000D,000E,0010,0011
efibootmgr
changes the Boot Order: . If 0012 goes to first place, reboot and see if grub appears.


Nope, still ignoring the SSDs and trying to boot on the LAN... If I guess that command correctly based off the original post and that it's saying to boot in order from left to right, it's going to try to boot from my DVD drive, then whatever that VenHw is, then the LAN, then the DVD drive again(?), then the SSD that has /boot on it, and lastly the other SSD....
Back to top
View user's profile Send private message
StoneC0ld
n00b
n00b


Joined: 27 Jul 2006
Posts: 45

PostPosted: Thu Nov 24, 2016 8:13 pm    Post subject: Reply with quote

Sorry for bumping the post, but my question still stands... Is there really a huge benefit to getting this UEFI to work? Or should I just switch the CMOS to legacy/BIOS boot and start reinstalling again from scratch?
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
Goto page 1, 2  Next
Page 1 of 2

 
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