Linux – PXE boot windows PE from Linux

linuxpxe-bootwaikwindows-pe

I'm attempting to get a Windows Preinstallation Environment to boot over PXE from a Linux server. The end goal will be to install Windows but that's pretty easy once I can get WinPE to start up (I've got the samba share with the windows OS disk etc.). I'm using ESXi and attempting to get a VM to PXE boot the winPE but also have access to a physical machine for testing. I followed the steps on a few tutorials (http://www.tecmint.com/configure-pxe-server-to-install-windows-on-centos/ mainly) and I've reached an interesting place:

If I attempt to PXE boot the winPE on either the VM or a physical machine I get the error:

CDBOOT: Cannot boot from CD - Code 5

However, if I mount the winpe iso on the VM's disk drive it works fine (I reach the winpe and can install windows). From what I've read of the "Cannot boot from CD – Code 5" error it is most commonly associated with BIOS firmware/hardware incompatibilities, but were that true the iso shouldn't work when mounted either.

In my ./pxelinux.cfg/default I have:

MENU LABEL Windows 7
 LINUX memdisk
 INITRD windows/winpe_amd64.iso
 APPEND iso raw

I've tried both with and without appending raw with the same result. I have already copied the memdisk binary to the tftproot. The iso seems to be found when PXE booting because the iso is being read in some capacity, the ISO is placed inside the tftproot at windows/winpe_amd64.iso.

Anyone have any insight on why the PXE boot would behave differently from mounting the ISO on the drive, and any ideas on how to resolve the problem with booting the iso?

Best Answer

When you "mount" winpe_amd64.iso on a VM and boot from it the ISO sees itself booting from a CD/DVD drive (either real or virtual). When you boot winpe_amd64.iso from memdisk the ISO sees an "emulated" (created by memdisk) disk environment.

APPEND iso raw

Some Windows ISO's need the 'raw' option on some PCs.

It is possible to map and boot from some CD/DVD images using MEMDISK. No-emulation, floppy emulation and hard disk emulation ISO's are supported.

The "map" process is implemented using INT 13h - any disk emulation will remain accessible from an OS that uses compatible mode disk access, e.g. DOS and Windows 9x. The emulation via INT 13h can't however, be accessed from an OS which uses protected mode drivers (Windows NT/2000/XP/2003/Vista/2008/7, Linux, FreeBSD) once the protected mode kernel drivers take control. If the OS contains drivers for accessing this mapped ISO, or knows how to find the ISO on the disk, there is no booting problem of course.

INT 13h access: Not all images will complete the boot process!

Windows NT/2000/XP/2003/Vista/2008/7 (NT based)

These Windows versions use INT 13h access only in the start of the booting process (loading only the necessary drivers). Once the protected mode drivers are functional to access the disks, Windows can't see the memory mapped drives created by MEMDISK (CD/DVD, hard disk and floppy disk images) and it will fail to complete the boot process.

Source: http://www.syslinux.org/wiki/index.php/MEMDISK

Bottom line: memdisk is a last resource alternative. pretty unreliable. avoid it.

In your case I'd try PXE booting into pxeboot.n12 (NBP) wich later calls bootmgr.exe, bcd, boot.sdi, and finally your Boot.wim file. This is pretty much the WDS way to PXE a Windows PE envirnment.

Edit:

pxeboot.n12 can be found within Boot.wim on any Windows DVD/ISO.

Specifically from the error you get you can also be facing this kind problem. https://superuser.com/questions/28123/when-installing-windows-7-cdboot-error-5-appears-cannot-boot-from-cd-why