Author Photo

Ahmer's SysAdmin Recipes is a blog for Linux System Administrators. This blog provides recipes for Installation & Configuration of Linux, Ubuntu, Oracle Database, MySQL, Apache, Nginx, Oracle Cloud Control, FreeIPA, Kerberos & OpenLDAP, Subversion, PXE, DevOps, etc. over Red Hat Enterprise Linux (RHEL), CentOS, Ubuntu and Windows.

Please give me your feedback and help me improve this blog. Please let me know If you want me to write on a specific topic.

Thursday, 25 October 2018

Add UEFI Support to PXE Boot Server on CentOS 7

Add UEFI Support to PXE Boot Server in CentOS 7BIOS (Basic Input/Output System) and UEFI (Unified Extensible Firmware Interface) are two firmware interfaces for computer systems which work as an interpreter between the operating system and the computer firmware. Both of these are installed at the time of manufacturing and is the first program that runs when a computer is turned on. BIOS uses the Master Boot Record (MBR) to save information about the hard drive data while UEFI uses the GUID partition table (GPT).

MBR uses 32-bit entries in its table which limits the total physical partitions to only 4 with maximum size of 2 TB each. Whereas, GPT uses 64-bit entries in its table which allows it use more than 4 physical partitions with larger sizes.

In our previous article Setup a PXE Boot Server in RHEL/CentOS 7, we have configured a PXE boot server and added the RHEL 7.5 installation option in it. The configuration worked fine with BIOS based computer systems, but didn’t support UEFI based clients.

In this article, we will add UEFI support to our PXE Boot Server on CentOS 7.

Note: In this article, we are performing everything from CLI, therefore, it is highly recommended that, you should have Linux Pocket Guide: Essential Commands for quick reference.

 

System Specification:

We use the same CentOS 7 server that we have configured as PXE Boot Server in our previous article. The specifications have been re-mentioned below for convenience of the readers.

CPU: 2 Core (2.4 Mhz)
Memory: 2 GB
Storage: 50 GB
Operating System: CentOS 7.5
Hostname: pxe-server.itlab.com
IP Address: 192.168.116.41/24

 

Configure PXE Boot Server to support UEFI based systems:

Connect to pxe-server.itlab.com using ssh.

Adjust DHCP server configuration to support UEFI systems.

[root@pxe-server ~]# vi /etc/dhcp/dhcpd.conf

Search for following lines in the above file.

#PXE boot server next-server 192.168.116.41; filename "pxelinux.0";

Replace above lines with following configurations.

class "pxeclients" { match if substring (option vendor-class-identifier, 0, 9) = "PXEClient"; next-server 192.168.116.41; if substring (option vendor-class-identifier, 15, 5) = "00009" { filename "grubx64.efi"; } else { filename "pxelinux.0"; } }

Restart dhcpd.service to apply changes.

[root@pxe-server ~]# systemctl restart dhcpd.service

If dhcpd.service gives error during startup, then look for any possible syntax errors therein and try to restart the service again.

For more details on comparisons in the above configurations, please refer to RFC 4578 - Dynamic Host Configuration Protocol (DHCP) Options for the Intel Preboot eXecution Environment (PXE).

Now, we need a bootloader (such as grubx64.efi) to support UEFI clients. This bootloader is available in CentOS 7.5 ISO.

Copy grubx64.efi to /var/lib/tftpboot directory.

[root@pxe-server ~]# cp /var/ftp/pub/rhel7/EFI/BOOT/grubx64.efi /var/lib/tftpboot/

Our PXELINUX menu does not work for UEFI systems, therefore we have to create another menu for the UEFI clients.

The menu filename is grub.cfg and it is located at /var/lib/tftpboot. Therefore, we will define RHEL 7.5 installation option in this file as follows:

[root@pxe-server ~]# cat >> /var/lib/tftpboot/grub.cfg << EOF > set timeout=60 > > menuentry 'Install RHEL 7.5' { > linuxefi /networkboot/rhel7/vmlinuz inst.repo=ftp://192.168.116.41/pub/rhel7/ > initrdefi /networkboot/rhel7/initrd.img > } > EOF

Restart tftp.service to apply changes.

[root@pxe-server ~]# systemctl restart tftp.service

UEFI configurations has been completed.

To test the configurations, connect a UEFI based system to network, and turn it on.

UEFI-PXE-boot-menu

The UEFI client will fetch the above menu from PXE boot server.

Press <ENTER> to start installation.

rhel-7-Installation-Language

Our PXE boot Server is now supports both BIOS and UEFI based clients.

We have successfully added UEFI support in our PXE boot Server on CentOS 7.

Add UEFI Support to PXE Boot Server on CentOS 7


YOU MIGHT ALSO LIKE:

11 comments:

  1. Hi, I'm doing almost the same steps as yours. But it said '
    NBP filename is grubx64.efi
    NBP size is 0 Byes
    PXE-99 unexpected network error
    '
    Anything suggestion? It's Ok for BIOS targets using pxelinux.0

    ReplyDelete
    Replies
    1. It looks like tftboot is unable to access grubx64.efi.

      Please try this,
      - verify that grubx64.efi copied to the correct directory.
      - verify the file permissions.
      - disable the SElinux and try again.

      Delete
    2. My bad, I was misconfigured my dhcpd.conf with a wrong router ip 172.17.x.y, which shoud be 172.16.x.y.
      But in Legacy mode this isn't the problem. :(

      A weekend was wasted due to this carelessness.

      Thanks anyway.

      Delete
  2. I'm using grubx64.efi from Centos 7.5 ISO:/EFI/BOOT/, but it fails.
    And I spent a day to find out why, turns out this file is only appliable to Hard drive installation, as No tftp client module inclued.
    So do you have any idea about Centos? I'll try to download RHEL7.5 and make a test.
    Thanks.

    ReplyDelete
    Replies
    1. The grubx64.efi should have work, because configurations are same for CentOS and RHEL 7.5.
      Please check file permission, location and SELinux contexts.

      Delete
    2. Yes, it works. I'm wrong. Thanks and have a nice day.

      Delete
  3. Hi, Could you make guide topic about pxe efi with windows OS and series ipxe (bios & uefi). Thanks

    ReplyDelete
    Replies
    1. Hi, We have noted down the request and will work on it a.s.a.p.

      Delete
  4. These instructions are great on the PXE boot server side. I had issues with understanding some of the client server settings. For example, my Supermicro server boot mode was set for "UEFI" mode. When the server initialized it listed a "Device mapping table" and went to a shell prompt.

    The workaround for now it to set the boot mode to "BOTH" which means both "LEGACY" and "UEFI". With the legacy options, the BIOS based PXE boot works (i.e. with pxelinux.0).

    ReplyDelete
  5. Also would be helpful to fine tune the configuration explained here if you have time
    1) grub menu - what is easiest way to add a 'menuentry' that will boot of hard disk once timeout expires?

    2) specific kickstart file - for BIOS based systems we can created menu files specific to the host, ex. 01-, and each file contains a parameter that points to a specific kickstart file, ex. 'inst.ks='. How is this handled with grub2 and UEFI based clients?

    ReplyDelete
    Replies
    1. Hi,
      Thanks for the kind appreciation.

      During configuration of PXE boot server I have also encountered the same problems that you are facing now.

      Unfortunately, the problem related to UEFI is stand still and I am unable to find a solution yet.

      Meanwhile, I suggest to to try AOMEI PXE Boot. May be it will address all your reservations.

      Delete