PXE

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)

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

Press <ENTER> to start installation.

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

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!

Alaric Bird

Alaric Bird is a seasoned Linux System Administrator with over a decade of experience in managing and optimizing Linux-based servers and infrastructure. Known for his expertise in server deployment, security hardening, and performance tuning, Alaric has a deep understanding of various Linux distributions, including Ubuntu, CentOS, and Red Hat Enterprise Linux. His skills extend to cloud platforms like AWS, where he effectively manages virtual private servers and services. Alaric is also proficient in scripting languages such as Bash and Python, which he uses to automate routine tasks, enhancing efficiency and reliability. With a strong commitment to continuous learning, he stays updated with the latest developments in open-source technologies and best practices. His problem-solving abilities, combined with excellent communication skills, make him a valuable asset to any IT team. In addition to his technical expertise, Alaric is passionate about mentoring junior administrators and fostering a collaborative environment.

View Comments

  • 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

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

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

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

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

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

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

  • 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?

Share
Published by
Alaric Bird

Recent Posts

Puppy Linux: Fast and Simple OS

Puppy Linux is a fast, lightweight OS designed for speed and simplicity, perfect for old…

1 day ago

Change Apache Document Root in Linux

Learn how to change Apache document root in Linux by following this step-by-step guide. Adjust…

2 weeks ago

How to Change Apache Port in Linux

Discover how to change Apache port in Linux easily. Follow our simple guide to modify…

2 weeks ago

How to Create Virtual Host in Apache Server

Learn how to create a virtual host in Apache Server with this comprehensive guide. Set…

3 weeks ago

10 Practical Tasks for RHCSA Exam with Solutions

Discover 10 practical tasks for the RHCSA exam with step-by-step solutions. Boost your Linux skills…

3 weeks ago

Ultimate Fail2ban Configuration Guide

Discover the ultimate Fail2ban configuration guide. Learn how to set up, customize, and optimize Fail2ban…

4 weeks ago

This website uses cookies.