PXE boot WinPE 2 (Vista) using Linux as the PXE Server

Matt

Spent a little while trying to get WinPE2 (Vista) to boot via PXE from a linux server and thought it could be useful to someone. We already had our Red Hat stuff booting from there and it seemed like a good idea to keep it in one place!

Some of the stuff could be useful for booting via PXE from a Windows box too

Windows XP was used for WAIK stuff
Fedora Core 6 was used for PXE Server
Both running on VMWare Server along with a blank VMWare machine as the PXE client
* Note – there’s a bug in RHEL5 that’s stop’s the tftpd.remap file working. Not sure how many versions this affects

Install a Linux Server
I’m using a NAT VM to keep the DHCP server off of the LAN
Do a minimum install – we will install the required packages later
I’m using DHCP to give the server an IP address for testing but will need a static IP address assigning

I’m not using a firewall or SELinux – you might need to alter your install to accommodate them

On your linux PXE server

Ensure that the DHCP server is installed

yum install dhcp

Edit /etc/dhcpd.conf for your environment. Here’s mine –

ddns-update-style interim;
ignore client-updates;
allow booting;
allow bootp;
class "pxeclients" {
match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
next-server 172.16.54.128;
filename "Boot/pxelinux.0";
}
subnet 172.16.54.0 netmask 255.255.255.0 {
option routers 172.16.54.2;
range dynamic-bootp 172.16.54.10 172.16.54.15;
default-lease-time 600;
max-lease-time 7200;
}

Install tftp-server

yum install tftp-server

Install syslinux

yum install syslinux

Copy pxelinux.0 from the syslinux install to /tftpboot

cp /usr/lib/syslinux/pxelinux.0 /tftpboot

Create a folder to hold the PXE config file

mkdir pxelinux.cfg

Create a PXE config file – /tftpboot/pxelinux.cfg/default – Here’s mine –

default 1
timeout 100
prompt 1
label 1
kernel Boot/startrom.0
append -

Create a tftp remap file. This is used to translate back slashes to forward slashes. /tftpboot/tftpd.remap. This should just contain a single line

gr \\ /

Enable the tftp server by editing the following file – /etc/xinitd.d/tftp. Also make it use the remap file. The -vvv is optional but it could definitely help later on! Here’s mine –

service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot -m /tftpboot/tftpd.remap -vvv
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}

Start the DHCP server

service dhcpd restart

Start the TFTP server

service xinetd restart

Download the Windows Automated Installation Kit – http://www.microsoft.com/downloads/details.aspx?FamilyID=c7d4bc6d-15f3-4284-9123-679830d629f2&DisplayLang=en

The file is an ISO file so can be renamed to .iso and mounted using either vmware or one of the free tools (magiciso?) so that the install can be run

On to a Windows XP machine now …

From the install CD you just downloaded

Install the .NET Framework Setup

Install the MSXML 6.0 Setup

Install the Windows AIK Personally I did it to c:\waik to save typing too much!

Run the copype command to create your PE folder

cd \waik\tools\petools\
copype.cmd x86 c:\vistape

Mount the .wim image

cd \vistape
imagex /mountrw winpe.wim 1 mount

Create a folder to store the PXE stuff

mkdir c:\pxe

Copy the PXE stuff to the pxe folder

cd \vistape\mount\windows\boot\pxe
copy * \pxe
cd \vistape\mount\windows\boot\fonts
copy wgl4_boot.ttf \pxe
cd \waik\tools\petools\x86\boot
copy boot.sdi \pxe
cd \vistape
copy winpe.wim \pxe

OK – now the fun bit. Create the BCD file. This is a replacement for the boot.ini

cd vistape\mount\windows\system32
bcdedit /createstore \pxe\BCD
bcdedit /store \pxe\bcd /create {ramdiskoptions} /d "Ramdisk options"
bcdedit /store \pxe\bcd /set {ramdiskoptions} ramdisksdidevice boot
bcdedit /store \pxe\BCD /set {ramdiskoptions} ramdisksdipath \Boot\boot.sdi
bcdedit /store \pxe\BCD /create /d "MyWinPE Boot Image" /application osloader

You should get a GUID returned – not sure what you need to do if not I’m afraid! Replace the GUIDs below with the GUID you get back
The entry {ed26a7d4-0ed5-11dc-9d1a-000c29ea1605} was successfully created.

bcdedit /store \pxe\BCD /set {ed26a7d4-0ed5-11dc-9d1a-000c29ea1605} systemroot \Windows
bcdedit /store \pxe\BCD /set {ed26a7d4-0ed5-11dc-9d1a-000c29ea1605} detecthal Yes
bcdedit /store \pxe\BCD /set {ed26a7d4-0ed5-11dc-9d1a-000c29ea1605} winpe Yes
bcdedit /store \pxe\BCD /set {ed26a7d4-0ed5-11dc-9d1a-000c29ea1605} osdevice ramdisk=[boot]\Boot\WinPE.wim,{ramdiskoptions}
bcdedit /store \pxe\BCD /set {ed26a7d4-0ed5-11dc-9d1a-000c29ea1605} device ramdisk=[boot]\Boot\WinPE.wim,{ramdiskoptions}
bcdedit /store \pxe\BCD /create {bootmgr} /d "Windows VISTA BootManager"
bcdedit /store \pxe\BCD /set {bootmgr} timeout 30
bcdedit /store \pxe\BCD /displayorder {ed26a7d4-0ed5-11dc-9d1a-000c29ea1605}

ok – nearly all done now. You need to copy all the files from your \pxe folder to your linux PXE server. I use winscp. Copy the files to a folder call /tftpserver/Boot (case is important!) I had some fun trying to do this with Vmware but that could have been a problem unique to me!

Back on the linux server … Just got to rename a few files

cd /tftpboot/Boot
mv pxeboot.n12 startrom.0
mv bootmgr.exe ..
mv winpe.wim WinPE.wim

Now PXE boot a machine and press 1 (obviously you can make syslinux look much nicer with some menus and things!). Fingers crossed you should get a Windows PE 2 console.

A few extra bits …

If you want to boot a Vmware machine via PXE and connect to the network you’ll need the Vmware network drivers in your .wim file. This is surprisingly easy to do thanks to being able to edit the .wim file easily.

From your Windows XP Vmware client (or you’ll need to find the vm network drivers from somewhere)

cd \vistape
imagex /mountrw winpe.wim 1 mount (you may have this done from above already)
peimg /inf="C:\Program Files\VMware\VMware Tools\Drivers\vmxnet\vmware-nic.inf" \vistape\mount
peimg /inf="C:\Program Files\VMware\VMware Tools\Drivers\vmxnet\vmxnet.inf" \vistape\mount
imagex /unmount /commit \vistape\mount

Now you can copy your winpe.wim file to your PXE server and overwrite the old one. Make sure you change the case of the file again to WinPE.wim

Hopefully this is going to work for all sorts of drivers – raid, network, etc Also, you can obviously put anything else that you need in the .wim file.

Last updated by at .

Related Posts

54 Comments. Leave new

Thanks for your article. Great Job.
One thing to mention:
The filename line in dhcpd.conf should read:

filename “pxelinux.0″;

and not

filename “Boot/pxelinux.0″

This is what I needed for Debian and dhcp3-server.
All worked great after that.

Cheers!

Hi,

Thanks for such a nice article. I am getting 1 error .. can you help.
while doing pxe boot it says

WINDOWS FAILED to start .. this might be due to recent change in hardware or software.
1. insert disk and try.
2. select languare and ..
3. …

File BCD

unable to read Boot configuration file data.

Hi Nick,

Did you make sure that you kept the filename BCD in upper case?

The only other thing I can think is to turn on logging on the TFTP server (I did this when I was testing – it made tracking down problems a lot easier) At least then you’ll be able to see what file the client is asking for and what the error is.

Matt

This left me with a “BlInitializeLibrary failed 0xc0000001″ error after downloading bootmgr.exe. Ever see that?

Hi Bob,

I’ve not seen that before I’m afraid. Is this on hardware that Vista will normally install on?

Matt

Pascal Vandeputte
11 December 2008 3:09 pm

I got exactly the same error messages as Nick, my mistake was that I was deploying WinPE on a tftp/netboot server I’ve been maintaining for a couple of years now and I hadn’t noticed that I had to add the “-m /var/lib/tftpboot/tftpd.remap” part to my inetd.conf file.

For that reason the BCD file was never found because the remapping didn’t work.

Another note: my setup seems to be looking for wgl4_boot.ttf in \Boot\Fonts , not in \Boot (which is where it ends up if you follow your instructions exactly).

Anyway, thanks a LOT for your clear instructions, they were a huge help in getting this right!

Hi Pascal,

Many thanks for the comments – they are very useful. There’s certainly a lot of different bits to get it all working together and any tips are definitely welcomed :-)

I’m glad the post helped some. Matt

very clear instructions

great help

Thanks!

your screen shots are missing for some reason, did you move them?

Thanks Kashif. A wordpress plugin update had messed something up. Hopefully you can see them now. Matt.

nice howto, but after a quick-run im a bit confused on where to actually put the vista-dvd files and the unattended.xml file? Also, the pxe boot seems to hang and eventually reboot when running with 512mb ram. Im testing in ESXi and upgrading the Vista VM to 1GB ram gave a nice vista background with a dosbox stating ‘wpeinit’.

think ive got it, this is only the step BEFORE the actual windows setup… From the given shell i would network mount a share pointing to a Vista-DVD and start setup.exe from there. Only need to figure out howto use autounattended.xml

Hi harm,
That’s correct, the instructions above are really just a complicated network boot disk :-), you still have to run the Vista install once you’ve got WinPE booted. I’m afraid I’m not sure where you need to put the autounattended.xml file. Maybe you can specify where it is on the command line for the install program? Matt.

PXE Booting Vista/PE 2.0 Using PXELINUX.0 | keyongtech
18 January 2009 11:39 am

[…] Server 2003 is already working. I havn’t finished this walk through yet, but it looks promising: http://sysadminman.net/blog/archives/8 — kai4785 ———————————————————————— kai4785’s […]

also note in the /etc/dhcpd.conf file, you need to specify the correct dhcpd server for the ‘next-server’ argument. If you copy and paste (as I did), you will receive an arp timeout.

Hello,

did someone find out how to install Windows Vista and how to use the unattended-xml-file?

Thanks for sharing this, works great (so far… ;) ).

I also had the remapping issue on RHEL5.3 (CentOS 5.3), I downloaded the 0.48 version of the tftp-server RPM for Fedora Core 10 from here:

ftp://ftp.univie.ac.at/systems/linux/fedora/releases/10/Everything/i386/os/Packages/tftp-server-0.48-6.fc10.i386.rpm

The file installs (updates) flawless, after that mapping worked without ANY changes to one of my files!

Now I only have to find out how to kickstart a W2K8 installation from this point on :)

Thanks again,

Molski

Richard Ruddock
26 June 2009 10:52 am

thanks for the setup guide. works a treat. I’ve now got my WinPE image running from PXE. Saves a load of hassle for my ghosting cycles (not using ghostcasting)

thanks a million!!

Richard

Hi Richard. I’m glad it helped and thanks for taking the time to leave a comment. I really appreciate it. Regards, Matt

Thanks Matt

One thing i changed to slightly improve it

I renamed the “Boot” Folder to vistape so i knew what it was later
To enable this to boot i made added to the tftpd.remap file

#——-File Start——-#
gr \\ /
gr Boot vistape
#——-File End——-#

That just makes trying to remember what the folders are in my tftp server Easier

But Thanks alot

Good tip! Thanks Joel.

Matt:
Is there any way to to change or hack the directory name “Boot” where the files are stored? I want to have multiple Boot directories for some reason. I know I can have multiple entries boot entries that I can pick in the BCD menu but I want to create different Boot directories and be able to boot in those. I created Boot2 but when I boot using PXE it still boots from the Boot directory instead, any hints?

Kashif

Hi Kashif, I’m afraid I don’t. It was a while ago that I’ve looked at this now but I’m pretty sure that directory name was hard coded. Matt.

How to configure tftp.remap on ubuntu tftp server?, thank a lot for your help!

i’ve resolved my question… i create a file /etc/tftpd-hpa.rules whith this:
——–
rg \\ /
——–
and declare de option in the file /etc/default/tftp-hpa whit this:
————-
options:”-l -s /var/lib/tftpboot -m /etc/tftpd-hpa.rules -vvv”
———-
and resolve the error “….Boot\BCD…”, when boot winpe
Sorry for my english.
cheers..

Thanks for the update. Hopefully it will help somebody else. Matt.

rama krushna sahu
18 August 2009 2:44 pm

gr \\ /
this should be in RedHat
rg \\ /

rama krushna sahu
20 August 2009 12:12 pm

Can I set the IP using netsh command for winpe.
I tried but I am getting errors like

“The file name, directory name, or volume level syntax is incorrect”

This seems to be a syntax error. I tested with several changes using this command it is showing same above error.

It’s not always the case of /Boot/BCD and I got /boot/bcd in my box.
Nick’s problem can be found out with tftpd server started with -vvv option and
get the real file name that pxeboot.n12(startrom.0) wants
in /var/log/daemon.log or /var/log/syslog

A very big thank you for this awesome tutorial! _/-o_

Great Job, i’ve just a question, With this project could i start windows and linux in the terminals?, i mean the user choose OS (Linux or Windows) work.

Best regards, and thanks for your help.-

Yes, you could boot up either Linux or Windows from PXE with the user choosing at the menu which one to boot (/tftpboot/pxelinux.cfg/default)

Thanks for putting together such a good tutorial – great work!

Just thought i’d add that if you are adding drivers to the winpe.wim file under Server 2008/Windows 7,
“peimg” has been replaced with the slightly more convoluted command “dism”.

So, the process for adding the drivers in your example would be:

C:> dism /Mount-Wim /WimFile:C:\win7pe\winpe.wim /index:1 /MountDir:C:\win7pe\mount

C:> dism /Image:C:\win7pe\mount /Add-Driver /Driver:”C:\Program Files\VMware\VMware Tools\Drivers\vmxnet\vmware-nic.inf”
C:> dism /Image:C:\win7pe\mount /Add-Driver /Driver:”C:\Program Files\VMware\VMware Tools\Drivers\vmxnet\vmxnet.inf”

C:> dism /Unmount-Wim /MountDir:C:\win7pe\mount /commit

Note: you *must* have mounted the image using “dism” and not “imagex” for the “dism /Add-Driver” commands to operate.

hello good article, but can u please help me ? i ve done everything.. i can oxe boot to all the linux dists great but on windows im getting teh error kernel image startrom.0 cannot be found..

how can i fix that?? i checked paths and they are correct..

Excellent instruction. One minor error:
cd vistape\mount\windows\system32 shoud be cd mount\windows\system32

Is there a way to boot more one image. It seems like you can only do one the root folder for “Boot” for one image. Please let me know.

Thanks again instruction.

ada – make sure the files are executable by more then just the owner.

Booting WinPE 3.0 from a linux PXE/tftpd server help required.
15 July 2010 6:24 am

[…] […]

Thomas Christiansen
3 August 2010 9:23 pm

Thank you for this. It worked perfectly. :D

I can now boot my WinPE image from my QNAP TS-409

Can anybody tell me why i have while booting PXE a message :
TFTP download fail
I think that is a problem with remapping, i’ve done every single step from that tutorial, i seems like it couldn’t get files from /Boot folder…
other machines work perfectli, i use my PXE to install linux, rescuecd and install xp.
any help?

Nice tutorial
But how to make it work 64 bit???

It doesn’t matter, you just have to male a PE boot iso for 64-bit machines and put it in your PXE server. It is reccomended that you check if your eth in works correctly, if no put drives for it in your iso. you have to remap by tftp \ to /, and that’s it.

I think I’m getting problems other people have been.

I’ve followed the steps as close as possible, however, when I boot from it, after awhile, an error screen will come up showing:

Windows failed to start.

Yadyadyada… then:

File: \Boot\BCD
Status: 0xc00000034
Info: The Windows Boot Configuration Data file is missing required information.

I’m running the PXE server on Ubuntu 10.04, so I couldn’t quite follow every single step just as you had said them, but I think I came pretty close. The exact pxe server is tftpd-hpa, and the startup options are: “-s -l -m /var/lib/tftpboot/tftpd.remap -vvv”

If anyone can help, that would be great.

First thx for the tutorial :) very very appreciated !

However, i get the same issue as Combat
“TFTP download failed”
I suspect that the process cannot find the TFTP server correctly
I don’t have a clue where to define it.
Or maybe it’s getting the name “on the fly” from PXE … Who knows?

Anyway, i fixed the issue for remapping the path to /Boot with the tftpd.remap file (thx for the post!!)
Let say your real path is /pxeboot/WinPE and you want \Boot
gr \\ /
gr Boot pxeboot/WinPE
I just try to tftp a file using the remapped root path to test

I’m wondering now what to put in the PXE menu
I tried the one in this tutorial without success :(
I found another one with:
LABEL WinPE x86
MENU LABEL WinPE x86
kernel WinPE/startrom.0
append WinPE/bootmgr.exe
No success either …
If someone has an idea …
Thx in advance

I just found the problem :)
startrom.0 is looking for bootmgr.exe at the tftp server root!!
so basically you need to be able to download this file as follow:
tftp GET \bootmgr.exe
which is equivalent to:
tftp GET bootmgr.exe

If you cannot do that, don’t even try to PXE until it’s fixed

Mine was in a subfolder of root
I moved it to / and voila!
That works great now !!!

My PXE menu item is as follow
LABEL WinPE x86
MENU LABEL WinPE x86
kernel ZenPXE/WinPE/startrom.0

Note: append is not needed because startrom.0 doesn’t accept any arguments as far as i know

Again : Great tutorial. GREAAAATLY appreciated!!

Hope my comments will help some folks out there (and maybe me when i’ll forget what i did in few month lol)

Hi,

I am using Ubuntu 10.04 and trying boot Windows PE 3.0 (Win 7 based). Problem is it ends at

Status: 0xc000000f

Info: The boot selection failed because a required device is inaccessible.

I have followed lines at: http://msdn.microsoft.com/en-us/library/cc722358%28v=ws.10%29.aspx
and then tried to make it working on Ubuntu server.

My pxe root directory is /tftpboot.
Files in /tftpboot/Boot :
abortpxe.com de-DE hdlscom1.com ja-JP pt-PT WdsConfig.inf
BCD el-GR hdlscom1.n12 ko-KR pxeboot.com wdsnbp.com
bootmgr.exe en-US hdlscom2.com nb-NO pxeboot.n12 winpe.wim
boot.sdi es-ES hdlscom2.n12 nl-NL ru-RU zh-CN
cs-CZ fi-FI hu-HU pl-PL sv-SE zh-HK
da-DK fr-FR it-IT pt-BR tr-TR zh-TW

dhcpd.conf:
default-lease-time 86400;
max-lease-time 604800;
authoritative;
subnet 192.168.0.0 netmask 255.255.0.0 {
range 192.168.3.1 192.168.3.99;
filename “\\Boot\\pxeboot.n12″;
next-server 192.168.2.50;
option subnet-mask 255.255.0.0;
option broadcast-address 192.168.255.255;
option routers 192.168.1.254;
}

———————————–
# /etc/default/tftpd-hpa

TFTP_USERNAME=”tftp”
TFTP_DIRECTORY=”/tftpboot”
TFTP_ADDRESS=”0.0.0.0:69″
TFTP_OPTIONS=”–secure -m /etc/tftp_remap.conf -vvv”

RUN_DAEMON=”yes”
OPTIONS=”-l -s /tftpboot”
———————————-

/etc/tftp_remap.conf contains:
gr \\ /

———————————–

I’ve been playing with it for a while, getting different errors, I’ve also tried use gPXE but it seems have no difference.

Thank you for help.
TomasK

I’m afraid it’s been a long time since I played with this so I’m not going to be much help. Did you check through the comments to see if anything stood out?

Matt

I’ve searched using google and gone thru some results but nothing helped.

I think there must be something wrong with \ to / conversion but it’s strange-

TomasK: One thong that became indespensible to me was the tftp’s error log. Browser around in the /var/log folder and see if you can find a file that may pertain to tftp. (tail -f filename is helpful for live monitoring, fyi)

I had the same error as ThomasK. I checked /var/log/messages and it turned out you need to have the file wgl4_boot.ttf in a Fonts subdirectory.
Also the file BCD was in lower characters. Moved it to upper characters and I could successfully boot following these instructions.

Thanks Matt.

Thank you, I ‘ve got it working now.
I’ve solved this using wireshark and found the same problem as ChrisH. There was problem with looking for font file and then
/boot/boot.wim, problem was I had it in /Boot/boot.wim. At first I have moved boot.wim and it worked. Then I did some changes in BCD and it caused it work even if boot.wim was in /Boot/ directory.

So now it’s fully working.

I have also found out that wgl4_boot.ttf is not needed, it will boot anyway. I ‘ve also played with booting whole ISO with windows PE (http://www.savelono.com/linux/how-to-install-windows-7-over-a-network-using-linux-pxe-dnsmasq-and-samba.html) and then booting ISO file using http (it’s much faster than TFTP) (http://syslinux.zytor.com/wiki/index.php/MEMDISK).

Thank you all for help.
TomasK

Like TomasK, compiling a wim to a ISO file is not that hard, besides its easier to boot using memdisk and an iso. Rather than mess around with tftp redirections and messing up your root tftpboot share folder just make an iso and pxe boot, easy and not messy

After bashing my head on the wall too many times for not being able to get this to work (having the \Boot\BCD error 0x00000001 while checking on the -vvv log the file was being downloaded) I figured out I would try with Tftp32 by Ph. Jounin and it worked like a charm!

So I was left to hunt what was wrong with tftp-hta and I found “-r blksize” was somehow messing up the transfer (was there by default on my inetd.conf). Now this PXE booting works and it is Awesome!!!

One thing I think would be interesting to point out is that pxeboot.com (or .n12) must be renamed to .0 otherwise it won’t be recognized by syslinux (PXELinux) as a PXE bootstrap program (NBP).

Thanks!!

How to deal with an existing WDS PXE directory ?
29 June 2011 6:03 am

[…] boot Correct so far? These links might help: http://linux-sxs.org/internet_serving/pxeboot.html http://sysadminman.net/blog/2007/pxe…e-pxe-server-8 Please let us know how it […]

hi,guys
can anyone reply at me please ,
I have aproblem on booting pxelinux.cfg/default file
when the dhcp booting and this file ,show the blue screen its not appear and happened loop on time
please i have asolute for this problem now

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>