[CentOS] UEFI and PXE

Tue Oct 22 12:10:58 UTC 2019
isdtor <isdtor at gmail.com>

isdtor writes:
> Gordon Messmer writes:
> > On 10/21/19 6:38 AM, isdtor wrote:
> > > Booting with CentOS6 /boot/efi/EFI/redhat/grub.efi, and the older style pxe config file as per ... results in a grub (legacy) prompt on the target machine.
> > 
> > 
> > Have you tried using the file from the installation tree?
> > 
> > http://centos.s.uw.edu/centos/6/os/x86_64/EFI/BOOT/
> > 
> > or with files extracted from one of the ISOs?
> > 
> > http://centos.s.uw.edu/centos/6/os/x86_64/images/
> They are all identical to the installed one (distributed with grub).
I'm tantalizingly close. CentOS6 UEFI PXE is working, but the machine won't boot.

It is best to use the CentOS7 BOOTX64.EFI loader. The "kernel too old" message is due to the fact that the PXE config file uses linuxefi and initrdefi directives. They need to be changed to linux/initrd, respectively. linux16/initrd16 may also work. The arguments to those directives need to adhere to CentOS6 legacy grub syntax (ks instead of inst.ks etc.).

This will cause error messages on the client that both linux and initrd are unknown commands. The fix is to add the linux module to the PXE config file,

insmod linux

The client now issues different error messages that flash past pretty quickly. tcpdump to the rescue, it becomes clear that it is seeking to download the grub linux module through tftp, so I added the complete contents of the CentOS7 grub2-efi-x64-modules rpm under /tftpboot/EFI/centos/x86_64-efi.

These changes will lead to a successful PXE boot. If a kickstart installation is used, one also needs to add a /boot/efi partition. Looking at a CentOS7 machine, type vfat and size 200MB should be fine; reqpart is not support under CentOS6. Last, and this untested as of yet, it looks like the bootloader location needs to be partition because the resulting disk is in GPT format.