Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
UEFI, GPT, won't boot
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
Progman3K
l33t
l33t


Joined: 03 Jan 2004
Posts: 665

PostPosted: Fri Feb 14, 2014 6:19 pm    Post subject: UEFI, GPT, won't boot Reply with quote

Hi!
I'm trying to boot a new system that has a UEFI BIOS.

After installing everything via the Live-CD, when I boot the system, the screen goes black, a text-mode cursor blinks in the upper-lefthand corner of the screen for a few moments but then the computer enters the UEFI BIOS.

Here is the parted information for the HD:
Code:

Model: ATA WDC WD5003AZEX-0 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system     Name    Flags
 1      1049kB  3146kB  2097kB                  grub    bios_grub
 2      3146kB  137MB   134MB   ext2            boot
 3      137MB   674MB   537MB   linux-swap(v1)  swap
 4      674MB   500GB   499GB   ext4            rootfs


Code:
gdisk -l /dev/sda
Code:

GPT fdisk (gdisk) version 0.8.6

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

Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): D5474748-546456-43533-83455-6547347834874
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 4029 sectors (2.0 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048            6143   2.0 MiB     EF02  grub
   2            6144          268287   128.0 MiB   0700  boot
   3          268288         1316863   512.0 MiB   0700  swap
   4         1316864       976771119   465.1 GiB   0700  rootfs




I installed Grub2 as per the handbook.

What should I do?


Last edited by Progman3K on Sat Feb 15, 2014 3:58 am; edited 1 time in total
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


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

PostPosted: Sat Feb 15, 2014 12:33 am    Post subject: Reply with quote

Quote:
After installing everything via the Live-CD
, need to boot live medium in efi mode to install gentoo as efi, gentoo livecd did not support efi on my last trial. recommend http://sysresccd.org/Download

Presuming you wish to use uefi:
Recommend use http://wiki.gentoo.org/wiki/EFI_stub_kernel to create a stub kernel which will act as a bootloader.
Get rid of grub2.
For smoothest operation and minimal maintenance install refind as a bootmanager.
http://www.rodsbooks.com/efi-bootloaders/efistub.html
http://www.rodsbooks.com/refind/installing.html#installsh
http://www.rodsbooks.com/refind/installing.html#linux
Just update a kernel and let rEFInd find it. Add another OS and let rEFInd find it
_________________
Defund the FCC.
Back to top
View user's profile Send private message
Progman3K
l33t
l33t


Joined: 03 Jan 2004
Posts: 665

PostPosted: Sat Feb 15, 2014 3:14 am    Post subject: Reply with quote

I set the variable
GRUB_PLATFORMS="efi-64" in /etc/portage/make.conf and then re-emerged grub, this made grub pull in additional support modules,

Code:
grub2-install --target=x86_64-efi --efi-directory=/boot/grub/x86_64-efi/ --boot-directory=/boot /dev/sda
Quote:

Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables.
Try 'modprobe efivars' as root.


From what I understand, now I need a live-cd that will boot in UEFI mode so that the efivars will be acessible and I'll be able to chroot and perform that last step.

Does SystemRescueCd do that? I can't see that it does
Back to top
View user's profile Send private message
Progman3K
l33t
l33t


Joined: 03 Jan 2004
Posts: 665

PostPosted: Sat Feb 15, 2014 3:21 am    Post subject: Reply with quote

One thing I don't understand; the Handbook suggests creating partition 1 as type EF02 (bios_grub) and making it 2MB but other guides say it should be at least 120MB. Which is correct?
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


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

PostPosted: Sat Feb 15, 2014 3:52 am    Post subject: Reply with quote

at least 100MB fat32
sysresccd does boot in efi mode if so selected in "bios"
_________________
Defund the FCC.
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1369
Location: Montréal

PostPosted: Sat Feb 15, 2014 4:08 am    Post subject: Reply with quote

If you want to boot Gentoo in EFI mode, you need to create or have an EFI System (code EF00) partition. It is most often the first one of a GTP partitions table. The size can vary. The mine is 250 mo. You must format this partition in FAT 16 or 32.

After this, boot the SystemRescueCd in EFI mode that it support, and modprobe the efivars module if needed. Prepare to chroot in your Gentoo installation and pass in chroot.

In chroot, the EFI System partition must be mounted in a point. I use /boot/efi . When you install (not emerge that is already done) Grub2-efi, you must specify this mount point as the writing point for the Grub2 EFI binary. Configure Grub2 to boot your Gentoo Linux kernel.

If you reboot, you should be able to select Grub2 EFI binary via the EFI menu if Grub2 is not the default bootloader of the EFI system and do not apper automatically.

Code:
grub2-install --target=x86_64-efi --efi-directory=/boot/efi --boot-directory=/boot/grub /dev/sda

_________________
Paul
Back to top
View user's profile Send private message
Progman3K
l33t
l33t


Joined: 03 Jan 2004
Posts: 665

PostPosted: Sat Feb 15, 2014 5:02 am    Post subject: Reply with quote

I downloaded and burned SystemRescueCd onto a CD

If I leave the UEFI BIOS set to boot to "UEFI first, legacy second" then SystemRescueCd loads and displays a menu.

With that menu, if I select "Boot linux on hard-disk", it will boot the kernel I compiled and copied into /dev/sda2. It appears to be functional, I can log in and the network card and other devices work, apparently. This is not in UEFI mode, however.

If I choose to boot the standard 64 bit linux from the SystemRescueCd menu, it boots but does not seem to be in UEFI mode either.

If I go in the UEFI BIOS and select "UEFI only" for the boot, then it ignores the SystemRescueCd CD entirely.

What is the proper way to get it running in UEFI mode?

Thanks!
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


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

PostPosted: Sat Feb 15, 2014 7:40 am    Post subject: Reply with quote

I have different uefi/bios, 1 asrock and 2 asus, but all are similar and show two choices for a sysresccd in the cd drive. In the boot order menu something like tsst and tsst(uefi). I select the tsst(uefi) and sysresccd boots to a black and white uefi kernel menu not the colorful bios kernel menu. Who manufactured your motherboard/computer? Have you disabled secure boot?
_________________
Defund the FCC.
Back to top
View user's profile Send private message
spidark
Tux's lil' helper
Tux's lil' helper


Joined: 01 Sep 2011
Posts: 142

PostPosted: Sat Feb 15, 2014 3:34 pm    Post subject: Re: UEFI, GPT, won't boot Reply with quote

Progman3K wrote:
Hi!
I'm trying to boot a new system that has a UEFI BIOS.

After installing everything via the Live-CD, when I boot the system, the screen goes black, a text-mode cursor blinks in the upper-lefthand corner of the screen for a few moments but then the computer enters the UEFI BIOS.

Here is the parted information for the HD:
Code:

Model: ATA WDC WD5003AZEX-0 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system     Name    Flags
 1      1049kB  3146kB  2097kB                  grub    bios_grub
 2      3146kB  137MB   134MB   ext2            boot
 3      137MB   674MB   537MB   linux-swap(v1)  swap
 4      674MB   500GB   499GB   ext4            rootfs


Code:
gdisk -l /dev/sda
Code:

GPT fdisk (gdisk) version 0.8.6

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

Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 976773168 sectors, 465.8 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): D5474748-546456-43533-83455-6547347834874
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 4029 sectors (2.0 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048            6143   2.0 MiB     EF02  grub
   2            6144          268287   128.0 MiB   0700  boot
   3          268288         1316863   512.0 MiB   0700  swap
   4         1316864       976771119   465.1 GiB   0700  rootfs




I installed Grub2 as per the handbook.

What should I do?

Hi Progman3K,

Im no expert on UEFI but i can see that your /boot partition code is wrong
And SystemrescueCD did not worked for me on my UEFI BIOS, (Asrock/DELL ),Got no UEFI entry, so im guessing maybe i have downloaded the wrong CD/DVD/USB version.

This is how things looks on my Desktop.
Code:
GPT fdisk (gdisk) version 0.8.6

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

Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 250069680 sectors, 119.2 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): E064A6C5-C683-4E2A-AB22-1CF6C8223A8C
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 250069646
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            6143   2.0 MiB     EF02  grub
   2            6144          415743   200.0 MiB   EF00  boot
   3          415744         4610047   2.0 GiB     8200  swap
   4         4610048       250069646   117.0 GiB   8300  rootfs
gen2desk14t ~ #


Code:
cgdisk 0.8.6

                                          Disk Drive: /dev/sda
                                       Size: 250069680, 119.2 GiB

Part. #     Size        Partition Type            Partition Name
----------------------------------------------------------------
            1007.0 KiB  free space
   1        2.0 MiB     BIOS boot partition       grub
   2        200.0 MiB   EFI System                boot
   3        2.0 GiB     Linux swap                swap
   4        117.0 GiB   Linux filesystem          rootfs









    [ Align  ]  [ Backup ]  [  Help  ]  [  Load  ]  [  New   ]  [  Quit  ]  [ Verify ]  [ Write  ]


                                  Create new partition from free space

As you can see your /boot partition should be coded as EF00 and yours is 0700
Fix that partition and reformat it with mkfs.vfat -F32 /dev/whatever
Im guessing you have already done that.
I know now that EUFI searches the /boot/efi/EFI for entries.So you need to create the EFI directory yourself.
Also guessing this part already done.

With my setup i can Boot with EUFI straight in and i also can choose Grub to dual boot Windows (EUFI mode). or choose Windows from my EUFI boot menu.
However windows will rearrange your boot order on your next boot, if you can't live with that, take a look at DONAHUE rEFInd thinggie.

I had no luck booting systemrecueCD in EUFI mode, so i used Fedora' live iso and Arch iso which has a nice UEFI shell to work with.

You don't really need Grub to dualboot Gentoo and Windows, if you have EUFI mode BIOS,its a choice.
I personaly use my EUFI boot menu to dualboot, because im to lazy to get into rEFInd ,I installed Windows in UEFI mode which make's things easy going for me.

My kernel settings
Code:
CONFIG_FB_EFI=y
#
# EFI (Extensible Firmware Interface) Support
#
CONFIG_EFI_VARS=y
CONFIG_EFI_VARS_PSTORE=y
# CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE is not set
CONFIG_EFIVAR_FS=y
CONFIG_EFI_PARTITION=y
CONFIG_EFI=y
CONFIG_EFI_STUB=y



Tell kernel where your / (root) partition resides to boot straight in UEFI mode.
Code:

 Processor type and features  --->
 [*] Built-in kernel command line                                           
     (root=/dev/sda2) Built-in kernel command string                           
       [  ]   Built-in command line overrides boot loader arguments           
 

Hope this helps.
Back to top
View user's profile Send private message
Progman3K
l33t
l33t


Joined: 03 Jan 2004
Posts: 665

PostPosted: Sat Feb 15, 2014 5:38 pm    Post subject: Reply with quote

DONAHUE wrote:
I have different uefi/bios, 1 asrock and 2 asus, but all are similar and show two choices for a sysresccd in the cd drive. In the boot order menu something like tsst and tsst(uefi). I select the tsst(uefi) and sysresccd boots to a black and white uefi kernel menu not the colorful bios kernel menu. Who manufactured your motherboard/computer? Have you disabled secure boot?

After playing around with the boot options, I was able to boot sysresccd in UEFI mode, which led to the black and white menu you mentioned. From there I booted the hard-disk disk linux (didn't have to chroot that way) and issued the command
Code:
grub2-install --target=x86_64-efi --efi-directory=/boot/grub/x86_64-efi/ --boot-directory=/boot /dev/sda
Quote:
BootCurrent: 0000,0003
Boot0003* UEFI: ASUS DRW-24F1ST a
Boot0000* gentoo
Installation finished. No error reported.

Now as long as I keep the CD in the drive, I can boot Gentoo in UEFI mode.

If I remove the CD, the UEFI BIOS boot-options list only 'gentoo' as a boot possibility, but if I try to booting without the CD, nothing happens and the computer enters the UEFI BIOS instead.

This probably has something to do with the fact that I followed the wrong procedure setting up the partitions.

The handbook says to create /dev/sda1 as a 2MB unformatted partition and use parted to mark it as being of type bios_grub (EF02)

The logic appears to be that grub is supposed to write something in the 2MB that will allow it to chain to the real boot partition, /dev/sda2, I think.

Many other sources (like spidark) recommend having a FAT32 partition at /dev/sda1 with .efi files on it.

So what is correct?

So what are my options, can I resize /dev/sda1 ?
Will that destroy the data on /dev/sda4 ?

Thank you for your help!
Back to top
View user's profile Send private message
spidark
Tux's lil' helper
Tux's lil' helper


Joined: 01 Sep 2011
Posts: 142

PostPosted: Sat Feb 15, 2014 6:15 pm    Post subject: Reply with quote

Hi Progman3K


The command
Code:
grub2-install --target=x86_64-efi --efi-directory=/boot/grub/x86_64-efi/ --boot-directory=/boot /dev/sda

to my knowlegde installs a file called grubx64.efi in the /boot/grub/x86_64-efi/EFI/gentoo directory
Two options adjust the command or copy the file into e.g /boot/efi/EFI/gentoo directory.
So create the /boot/efi/EFI directory and place your entry in that directory.
So it should look like this
Code:

/boot/efi/EFI/gentoo/grubx86.efi


and use efibootmgr to tell UEFI where the file lives
Code:
efibootmgr -c -d /dev/sda -p 1 -L "MY GENTOO UEFI_BOOT" -l "\EFI\gentoo\grubx64.efi"
-p 1 is Important this should be the Partition where the grubx64.efi lives on
Back to top
View user's profile Send private message
spidark
Tux's lil' helper
Tux's lil' helper


Joined: 01 Sep 2011
Posts: 142

PostPosted: Sat Feb 15, 2014 6:28 pm    Post subject: Reply with quote

Hi Progman3K
A note
Forgot you use Grub
Better is to tell grub where your .efi file lives
I recommend to keep things organized, so do create the dirs above
and adjust grub command
Code:

grub2-install --target=x86_64-efi --efi-directory=/boot/efi/EFI/gentoo --boot-directory=/boot /dev/sda
Back to top
View user's profile Send private message
ivanvcouso
n00b
n00b


Joined: 13 Feb 2012
Posts: 7
Location: Madrid, Spain

PostPosted: Sat Feb 15, 2014 7:53 pm    Post subject: Reply with quote

Adding one tip to everything said before:

If you´re using Grub2 you don't need a second /boot partition, you can use the EF00 partition as /boot too. So, instead of two partitions you get one EF00 used as EFI and /boot.
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


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

PostPosted: Sat Feb 15, 2014 8:00 pm    Post subject: Reply with quote

i'd boot the sysresccd all the way to the xfce GUI and then open gparted
in gparted i would shrink and move /dev/sda3 by about 70 mb with the free space created ending up adjacent to /dev/sda2. in Edit apply the operation(s).
Then I would shrink and move /dev/sda2 to about 100 mb with the free space created ending up adjacent to /dev/sda1. in Edit apply the operation(s).
/dev/sda1 to fill the empty space (about 100 mb) . in Edit apply the operation(s). format /dev/sda1 to fat32. in Edit apply the operation.
Recommend use http://wiki.gentoo.org/wiki/EFI_stub_kernel to create a stub kernel which will act as a bootloader.
Get rid of grub2. Unless you want to play with it. With an efi stub you won't need it.

EDIT: The ESP should have a fat32 filesystem in a partition type EF00. Your sda1 has type EF02. After the above expansion of /dev/sda1 exit gparted, run
Code:
gdisk /dev/sda
. Change the type of partition 1 to EF00.
_________________
Defund the FCC.


Last edited by DONAHUE on Sat Feb 15, 2014 10:41 pm; edited 1 time in total
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1374

PostPosted: Sat Feb 15, 2014 8:49 pm    Post subject: Reply with quote

The refind author in this forum (srs..) stated once EFI vfat32 partitions need to be 500 MByte for some UEFI systems. Mine was 200 MByte on a MacMini. I dare to change it ...
_________________
fun2gen2
Back to top
View user's profile Send private message
Progman3K
l33t
l33t


Joined: 03 Jan 2004
Posts: 665

PostPosted: Sat Feb 15, 2014 9:47 pm    Post subject: Reply with quote

file /boot/grub/x86_64-efi/EFI/gentoo/grubx64.efi
/boot/grub/x86_64-efi/EFI/gentoo/grubx64.efi: PE32+ executable (EFI application) x86-64 (stripped to external PDB), for MS Windows


Code:
efibootmgr -c -d /dev/sda -p 1 -L "UEFI_GENTOO" -l "\EFI\gentoo\grubx64.efi"
Quote:
BootCurrent: 0003
Timeout: 1 seconds
BootOrder: 0001,0000,0003
Boot0000* gentoo
Boot0003* UEFI: ASUS DRW-24F1ST a
Boot0001* UEFI_GENTOO


Entering the UEFI BIOS confirms it is set to boot from UEFI_GENTOO but performing a reset makes the screen go black for a few moments before re-entering the UEFI BIOS.

I thought maybe the path to the .efi file could be wrong, so I tried

Code:
efibootmgr -c -d /dev/sda -p 1 -L "UEFI_AMD64GENTOO" -l "\x86_64-efi\EFI\gentoo\grubx64.efi"
Quote:
BootCurrent: 0002
Timeout: 1 seconds
BootOrder: 0004,0003,0000,0002
Boot0000* gentoo
Boot0001* UEFI_GENTOO
Boot0002* UEFI: ASUS DRW-24F1ST a
Boot0003* UEFI_AMD64GENTOO


Same outcome.

/dev/sda1 is 2MB and gives errors if I try to format it, and grub2-install resets it back to no format when invoked.

So what is the function of /dev/sda1 then?

Is it the /boot partition (/dev/sda2) that I should format to vfat?
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


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

PostPosted: Sat Feb 15, 2014 10:00 pm    Post subject: Reply with quote

@ulenrich:
srs is the fountainhead of all EFI knowledge as far as I'm concerned.
My fullest ESP has 5 linux kernels, 2 windows kernels, and rEFInd in it and weighs in at 35MB. I dual boot with windows 7, 8, home server. Installing windows first (to humor microsoft) partitions the ESP's at 100 mb and has been more than enough room for me. Installing lots of kernels, boot loaders, boot managers, etc, as he probably does could certainly use more than my 100 mb.
_________________
Defund the FCC.
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1374

PostPosted: Sat Feb 15, 2014 10:09 pm    Post subject: Reply with quote

DONAHUE wrote:
@ulenrich:
srs is the fountainhead of all EFI knowledge as far as I'm concerned.
My fullest ESP has 5 linux kernels, 2 windows kernels, and rEFInd in it and weighs in at 35MB. I dual boot with windows 7, 8, home server. Installing windows first (to humor microsoft) partitions the ESP's at 100 mb and has been more than enough room for me. Installing lots of kernels, boot loaders, boot managers, etc, as he probably does could certainly use more than my 100 mb.

It is not about usage. Efi-fat is special standard - slightly different from fat32. Some vendors UEFI doesn't recognize a smaller than 500 MByte gdisk partion as EFI bootable. Maybe that a mkfs.vfat on a very small partition does some optimization with sectors or blocks not recognized :(

Otherwise you can spare an extra boot partition as me: I just copy-move my kernels from /boot to /boot/efi (mounted EFI) and start them using gummiboot or with special internal kernel cmdline (root=xx) directly. Also refind and grub2-efi works for me. But since a few weeks sadly my X with propr.Nvidia is garbled when efi booted.
_________________
fun2gen2
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


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

PostPosted: Sat Feb 15, 2014 10:21 pm    Post subject: Reply with quote

I just noted that you do not have an EFI System Partition. The ESP should have a fat32 filesystem in a partition type EF00.

If you really want to use grub2 you need to pay attention to http://wiki.gentoo.org/wiki/GRUB2#UEFI.2FGPT

my post of Sat Feb 15, 2014 3:00 pm above is the easy way.
_________________
Defund the FCC.
Back to top
View user's profile Send private message
spidark
Tux's lil' helper
Tux's lil' helper


Joined: 01 Sep 2011
Posts: 142

PostPosted: Sat Feb 15, 2014 11:02 pm    Post subject: Reply with quote

Progman3K

I think most UEFI bios are hardcoded to look into the $ESP/EFI directory or /boot/efi/EFI
I use UEFI version v2.31, read somewhere that there are issues with versions lower than v2.31
Grab yourself a Arch Iso disk/USB or any other disk with a shell entry on it.
If using Arch iso
Choose shell v2.0
cancel the startup.nsh script
at the shell promt type ver (gives your UEFI version)
then type bcfg dump boot or help bcfg
I think adding -b option breaks the output so its readable.
check output for your disk
mine is at
Code:

Option 05 Variable Boot0002
Descr -GENTOO
DevPath xxxxxx-xxxxx-xxx-xx-xxxxxx-xxxx-/HD(1,GPT,xxxxxx,xxxx,xx,x)/\EFI\gentoo\kernel_3_10_25.efi

My first partition is only 100mb and i have no issues (YET) with EUFI
And check to see what your UEFI says about the disk type, should be GPT, to avoid issues.
Depends on what machine your Using, i have a DELL 6330 and a Asrock, and no issues YET :wink:
On my DELL i don't need to use efibootmgr, this can be done in the bios, but it looks for the efi binary in the /boot/efi/EFI directory.
try
Code:

efibootmgr -c -d /dev/sda -p 1 -L "UEFI_AMD64GENTOO-TESTME" -l "\EFI\gentoo\grubx64.efi"

This only works if you mounted your /dev/(efi partition) as /boot/efi which is the $ESP.
you can delete these TEST entries later with
efibootmgr -B option
as DONAHUE said kill grub2.
Back to top
View user's profile Send private message
srs5694
Guru
Guru


Joined: 08 Mar 2004
Posts: 434
Location: Woonsocket, RI

PostPosted: Sun Feb 16, 2014 9:57 pm    Post subject: Reply with quote

ulenrich wrote:
The refind author in this forum (srs..) stated once EFI vfat32 partitions need to be 500 MByte for some UEFI systems. Mine was 200 MByte on a MacMini. I dare to change it ...


The issue is that some EFIs (mostly early 2.x-series EFIs, AFAIK) have buggy EFI drivers that don't like FAT32 filesystems that are smaller than 512MiB. That's precisely 512MiB -- and precisely MiB, too, not MB. If you've got such a firmware and have a FAT32 ESP that's smaller than 512MiB, the firmware might not see certain files or otherwise misbehave. If you're stuck with this problem, you have two options:


  • Increase the size of the ESP to be at least 512MiB.
  • Convert the ESP to use FAT16.


The first option isn't always convenient. The second is usually easier, but there are some tools (such as the Windows 7 installer) that will choke on a FAT16 ESP.

For these reasons, I recommend creating a 550MiB ESP. (I specify 550MiB rather than 512MiB because the mkdosfs utility switches from FAT16 to FAT32 as a default at something a bit over 512MiB and because a figure of 550MiB provides sufficient "wiggle room" in case of a MB-vs-MiB confusion.) Note, however, that these problems seem to be restricted to a handful of EFIs, and mostly relatively old ones. In most cases, you'll be fine with an ESP that's smaller than 512MiB, so long as it's not too small. (I wouldn't recommend making it smaller than about 100MiB, even if you know your EFI can handle such a small FAT32 filesystem.)

Progman3K wrote:
Code:
efibootmgr -c -d /dev/sda -p 1 -L "UEFI_GENTOO" -l "\EFI\gentoo\grubx64.efi"   
BootCurrent: 0003
Timeout: 1 seconds
BootOrder: 0001,0000,0003
Boot0000* gentoo
Boot0003* UEFI: ASUS DRW-24F1ST a
Boot0001* UEFI_GENTOO   


Entering the UEFI BIOS confirms it is set to boot from UEFI_GENTOO but performing a reset makes the screen go black for a few moments before re-entering the UEFI BIOS.


When reporting efibootmgr output, please include the "-v" parameter. This will cause the program to display additional details, such as the path to boot loader files. Such details are often critically important in tracking down problems. Getting confused about boot loader paths is quite common, especially since the common Linux mount point of /boot/efi can lead to paths like /boot/efi/efi/boot, and it's easy to get lost on such paths!

Also, a pet peeve: Despite its common use, the phrase "UEFI BIOS" is meaningless. UEFI (or EFI) and BIOS are two different classes of firmware. Thus, "UEFI BIOS" is like "Chevrolet Ford" or "liquid solid"; it can't be both at the same time. You've got UEFI firmware, not a BIOS, just like my car is a Chevrolet, not a Ford. This may seem like a semantic nit-pick, but I've become increasingly convinced that the common practice of referring to EFIs/UEFIs as "BIOSes" is promoting confusion, because people who think of an EFI as a BIOS will misapply BIOS-specific concepts to their EFI-based computers. This would be about as ineffective as somebody chiseling away at a pan of water if it were referred to as a "liquid solid." EFIs are very different from BIOSes in the most important details, and using a new term to refer to your EFI firmware is likely to help you shed some of your BIOS assumptions.

Progman3K wrote:
/dev/sda1 is 2MB and gives errors if I try to format it, and grub2-install resets it back to no format when invoked.


One of the key differences between BIOS and EFI is in what partitions are required to boot them.

Your disk is configured for BIOS-mode booting by GRUB from a GPT disk. Specifically, your /dev/sda1 is marked as a BIOS Boot Partition, which GRUB uses when booting from GPT disks in BIOS mode. If you install BIOS-mode GRUB via grub2-install, it will write data to the BIOS Boot Partition, which will show up in parted as a change in the filesystem type from whatever it had been to nothing. This may be fine, but only if you configure your firmware with its Compatibility Support Module (CSM), which is a sort of BIOS emulator that enables you to boot BIOS-mode boot loaders in EFI, much like WINE lets you run Windows programs in Linux. Also, many EFIs have problems booting from GPT disks in BIOS/CSM/legacy mode; see my page on this subject for details.

If you want to boot in EFI mode, you don't need a BIOS Boot Partition, but you do need an ESP. See my comments earlier about its sizing. In Linux, the ESP is usually mounted at /boot/efi, but there are benefits to mounting it at /boot instead.

ulenrich wrote:
It is not about usage. Efi-fat is special standard - slightly different from fat32.


That's a matter of interpretation. The specification states:

EFI specification, version 2.3.1 wrote:
EFI encompasses the use of FAT32 for a system partition, and FAT12 or FAT16 for removable media. The FAT32 system partition is identified by an OSType value other than that used to identify previous versions of FAT. This unique partition type distinguishes an EFI defined file system from a normal FAT file system. The file system supported by EFI includes support for long file names.

The definition of the EFI file system will be maintained by specification and will not evolve over time to deal with errata or variant interpretations in OS file system drivers or file system utilities. Future enhancements and compatibility enhancements to FAT will not be automatically included in EFI file systems. The EFI file system is a target that is fixed by the EFI specification, and other specifications explicitly referenced by the EFI specification.


In other words, the developers want a fixed version of FAT, not something that might be modified in the future by Microsoft, as for example they modified FAT to support long filenames with the release of Windows 95. As a practical matter, it must be possible for OSes like Windows and Linux to read and write the ESP. This would not be possible if the ESP used a "special" version of FAT -- or at least, you'd need an extra driver to handle such a variant of FAT. That's not really the case; you use standard FAT drivers to access the ESP. That said, some EFIs seem to have buggy FAT drivers, as I've already outlined.

spidark wrote:
I think most UEFI bios are hardcoded to look into the $ESP/EFI directory or /boot/efi/EFI


Not really. The EFI spec says that boot loaders should reside in subdirectories of the "EFI" directory on the ESP. The firmware isn't hard-coded to look into all such directories, though; only the EFI/BOOT/bootx64.efi file is required to be hard-coded in this way. (Or variants of this name on non-x86-64 platforms.) The majority of boot loaders are registered with the firmware, and information on them is stored in NVRAM. That's what the Linux efibootmgr utility does -- it enables you to register your boot loader, obtain information on what's registered, and otherwise manipulate the firmware's built-in boot manager. (Note that's a built-in boot manager, not a built-in boot loader. A boot manager maintains a list of boot loaders, whereas a boot loader loads an OS kernel into memory.)

Some EFIs also hard-code the EFI/Microsoft/Boot/bootmgfw.efi filename and will try to boot it if nothing else is bootable. Apple does something similar with its boot loader, which normally resides on an HFS+ partition, not on an ESP. These are both extensions to the EFI standard, though, not part of it.

As a more general comment, I'll reiterate my opinion that GRUB 2 is a bloated pig of a program that's needlessly complex to configure. It works tolerably well for Fedora, Ubuntu, and similar distributions because their developers have gone to great lengths to create OS-detection and GRUB configuration scripts that work. Under Gentoo, such tasks are at least partially in users' hands, so using GRUB 2 under Gentoo is about as pleasant as performing a root canal job on yourself. Instead of GRUB, I favor use of almost anything else in the EFI world. See my Web page on EFI boot loaders for Linux for details on what's available. My personal preference is to use the EFI stub loader in conjunction with my own rEFInd boot manager, but other options can work as well. In short, using almost anything but GRUB will greatly simplify your boot loader setup task.
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