Add PXE UEFI Support in Linux PXE Server

Share on Social Media

Learn how to add PXE UEFI support to your Linux PXE server with this detailed guide. Follow step-by-step instructions to configure UEFI boot options and ensure seamless network installations. #centlinux #linux #pxe

UEFI vs BIOS

BIOS (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.

Problem Statement

In our previous article Setup a PXE Boot Server in 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 (PAID LINK) 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

Add PXE UEFI support in Linux PXE Server

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

Adjust DHCP server configuration to support UEFI systems.

# 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.

# 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.

# 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:

# 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.

# systemctl restart tftp.service

UEFI configurations has been completed.

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

PXE Boot Menu (UEFI)
PXE Boot Menu (UEFI)

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

Press <ENTER> to start installation.

RHEL 7 Installation - Language Selection
RHEL 7 Installation – Language Selection

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

Recommended Online Training: Learn Bash Shell in Linux for Beginners

745772 0021

Final Thoughts

If you found this guide on adding PXE UEFI support to your Linux PXE server helpful and need more advanced assistance, I’m here to help. I offer professional services to configure UEFI boot options and optimize your PXE server setup. Visit my Fiverr profile for more details and to get started: Linux System Support. Let’s make your PXE server configuration smooth and effective!

21 thoughts on “Add PXE UEFI Support in Linux PXE Server”

  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

  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.

  3. 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.

  4. 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.

  5. 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).

  6. 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?

  7. 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.

  8. Hi, I'm doing exactly the same steps as yours, but when I try to start the installation from UEFI is displayed:

    check media presence
    media present
    start pxe over ipv4

    Then the BIOS setup screen opens.
    Please would you have any idea what might be going on?

  9. Hi,

    I am trying to setup the UEFI PXE for multiple system with each system having it's own grub.cfg file.
    For Legacy PXE, I am using the pxelinux.0 file with grub.cfg files under pxelinux.cfg directory with naming convention of mac address "pxelinux.cfg/01-88-99-aa-bb-cc-dd".

    Can I do something similar for UEFI?

    Thanks

  10. Hi,

    I would like to use configure this menu to use it so I can boot the MDT iso (LiteTouch x64 PE). So the ISO have in the tftpboot directory is LiteTouchPE_x64.iso. What do I need to type in the grub.cfg file in the menuentry section and how do I point it to that ISO file?

Leave a Comment