WinPE PXE boot failures with Grub2 typically stem from using legacy linux16 and initrd16 directives instead of their EFI equivalents, or incorrect memory loading parameters. The error loading bootmgfw.efi indicates the bootloader cannot find or execute the Windows PE image correctly over TFTP.
Understanding the UEFI vs Legacy Boot Conflict
The primary cause of this specific failure is a mismatch between the Grub2 configuration commands and the UEFI firmware environment. When you attempt to boot a 64-bit Windows PE image via PXE, your system operates in UEFI mode, which requires specific Grub2 modules and syntax. Using legacy BIOS commands likelinux16 and initrd16 forces Grub2 to operate in compatibility mode, which often fails to properly hand off control to the Windows bootloader (bootmgfw.efi). This results in the system hanging or reporting that it cannot load the EFI file.
To resolve this, you must ensure that your Grub2 configuration uses the EFI-specific commands: linuxefi and initrdefi. These commands are designed to handle the memory layout and execution requirements of UEFI systems. If your current configuration script contains linux16, replace it immediately with linuxefi. Similarly, any initrd16 calls should be changed to initrdefi. This shift ensures that the kernel and initial ramdisk are loaded into the correct memory regions accessible by the UEFI firmware.
It is also crucial to verify that the necessary Grub2 modules are loaded before attempting to boot. You need tftp, http (if using HTTP fallback), chain, and specifically wimboot. The wimboot module is essential because it understands how to parse Windows Imaging Format files and extract the necessary components for the Windows bootloader. Without these modules, Grub2 cannot interpret the WinPE structure correctly, leading to the bootmgfw.efi error.
Correcting Memory Loading Parameters
Beyond just changing the command names, the parameters passed tolinuxefi and initrdefi must be precise. In many standard tutorials, users might omit critical flags required by WIMBoot. The correct sequence involves loading the WIMBoot helper first, then the NTLDR or bootmgr, and finally the WinPE image itself.
A typical correct block for a UEFI PXE boot looks like this:
set wimboot_path=/tftpboot/wimboot
linuxefi ${wimboot_path}
initrdefi /tftpboot/bootmgfw.efi
initrdefi /tftpboot/bootx64.wim
Notice that bootmgfw.efi is loaded as an initrd in this context when using wimboot. This is a common point of confusion. The wimboot tool expects the Windows bootloader EFI file to be provided as part of the initial ramdisk chain so it can inject it into the memory space appropriately. If you try to load bootmgfw.efi directly with chainloader, it may fail if the preceding steps haven't set up the memory map correctly. Ensure that the path to bootmgfw.efi is accessible via TFTP and that the file permissions allow read access.
TFTP Server Configuration and File Structure
Even with the correct Grub2 syntax, the underlying TFTP server must serve files correctly. Many TFTP implementations have quirks regarding case sensitivity and file extensions. Ensure that yourbootmgfw.efi file is named exactly as referenced in the config, paying close attention to capitalization. On some servers, BOOTMGFW.EFI will not match bootmgfw.efi.
Additionally, verify the integrity of the WinPE WIM file. Corruption during download or transfer can cause the bootloader to fail when trying to parse the image. It is advisable to checksum the WIM file on both the server and the client side if possible. Also, check the size of the WIM file; extremely large images may exceed default TFTP packet sizes or timeout limits. Adjusting the TFTP server's block size or timeout settings might be necessary for larger WinPE deployments.
For those dealing with related network boot issues, such as blank screens during loading, reviewing specific troubleshooting guides can provide additional context on network stack behavior. See Stuck on Blank Screen During WinPE Loading using bootmgfw.efi from Downloaded Network PXE for deeper insights into network-related hang-ups.
Verifying the Boot Environment
Before deploying the fix, test the configuration in a controlled environment. Use Grub2's debug mode to step through the boot process. Enable verbose logging in your Grub2 config by addingset debug=all at the beginning of the menu entry. This will output detailed information about what modules are being loaded and where errors occur.
If the error persists after switching to linuxefi and initrdefi, consider the architecture of your WinPE image. Ensure that you are using a 64-bit WinPE image for a 64-bit UEFI system. Mixing 32-bit WinPE with 64-bit UEFI firmware will inevitably fail, regardless of the Grub2 syntax. Similarly, ensure that your bootmgfw.efi matches the architecture of the WIM file. A mismatch here is a silent killer of PXE boots.
For administrators managing multiple bootable media, understanding how to integrate these network boots with local USB solutions can streamline deployment strategies. Learn more about combining different boot methods in Combine Multiple WinPE Pre-OS Bootable USBs with EaseUS Partition Manager.
Frequently Asked Questions
Why does my PXE boot work on BIOS but fail on UEFI?
BIOS uses legacy real-mode loading which tolerates more variation in command syntax, whereas UEFI strictly enforces 64-bit memory layouts and EFI-specific protocols. You must uselinuxefi and initrdefi for UEFI to ensure the bootloader is placed in executable memory correctly.
Can I use HTTP instead of TFTP for WinPE PXE boot?
Yes, Grub2 supports HTTP booting, which is often faster and more reliable than TFTP for large files like WIM images. You would replacetftp commands with http commands in your Grub2 config, ensuring the server serves the files over port 80 or 443.
What causes the "File Not Found" error for bootmgfw.efi?
This usually means the TFTP server cannot locate the file at the specified path, or there is a case-sensitivity mismatch. Verify the exact filename and path on the server, and ensure the TFTP service has read permissions for that directory.Do I need to convert my WIM file to ISO for PXE boot?
No, WinPE PXE boot works directly with .wim files. Thewimboot utility handles the extraction of the necessary components from the WIM file into memory. Converting to ISO adds unnecessary complexity and storage overhead for network boot scenarios.
How do I debug Grub2 PXE boot issues effectively?
Enable verbose debugging by addingset debug=all in your menuentry. This provides detailed logs of module loading and memory allocation, helping pinpoint whether the issue lies with missing modules, incorrect paths, or memory conflicts.