In a previous article, Installing Linux via PXE using Windows Deployment Services (WDS), I talked about using PXELinux to enable deployment of WDS images, Linux distros and a multitude of tools. It got a bit heavy when trying to make this all work but the system is now up & running and we have already benefitted from it on many occasions. So here is my guide for Microsoft admins wanting to enhance their existing Windows Deployment Services server.
Step One – Install WDS
This should be obvious and if you are reading this I imagine you’ve done it already. Ours is running on a Windows Server 2003 box but it should work fine with the latest, more secure, stuff.
- We will be adding bits to the folders within the \\WDS\REMINST share
Step Two – Install PXELinux
PXELinux is part of the SysLinux package
- Download SysLinux from here
- There’s quite a bit in SysLinux but you only need to extract the following files
- ZIP\core\pxelinux.0
- ZIP\com32\menu\vesamenu.c32
- ZIP\com32\modules\chain.c32
- Copy the files into \\WDS\REMINST\Boot\x86
- Rename pxelinux.0 to pxelinux.com
- You also need to make copies of two original WDS files in this folder
- Copy pxeboot.n12 and rename it to pxeboot.0
- Copy abortpxe.com and rename it to abortpxe.0
- Create to new subfolders
- \\WDS\REMINST\Boot\x86\Linux
- \\WDS\REMINST\Boot\x86\pxelinux.cfg
- The pxelinux.cfgfolder is where you store the files that make up the PXE boot (F12) menu.
- All the files we will put in there are text files, even though they don’t use a .txt extension
- First create a new text file called default. This is the first menu that loads.
- Paste the following text into it
DEFAULT vesamenu.c32 PROMPT 0 MENU TITLE PXE Boot Menu (x86) MENU INCLUDE pxelinux.cfg/graphics.conf MENU AUTOBOOT Starting Local System in 8 seconds # Option 1 - Exit PXE Linux & boot normally LABEL bootlocal menu label ^Boot Normally menu default localboot 0 timeout 80 TOTALTIMEOUT 9000 # Option 2 - Run WDS LABEL wds MENU LABEL ^Windows Deployment Services KERNEL pxeboot.0 # Option 3 - Exit PXE Linux LABEL Abort MENU LABEL E^xit KERNEL abortpxe.0 - Now create a text file called graphics.conf
- This file controls how the menu is displayed. It’s very versatile so have a play around until it looks as basic or as flashy as you like
- Paste the following text into it
MENU MARGIN 10 MENU ROWS 16 MENU TABMSGROW 21 MENU TIMEOUTROW 26 MENU COLOR BORDER 30;44 #00000000 #00000000 none MENU COLOR SCROLLBAR 30;44 #00000000 #00000000 none MENU COLOR TITLE 0 #00269B #00000000 none MENU COLOR SEL 30;47 #40000000 #20ffffff MENU BACKGROUND background.jpg NOESCAPE 0 ALLOWOPTIONS 0
- If you want to use a custom background, place it in the \\WDS\REMINST\Boot\x86folder.
- The image should be a 640×480 jpeg file.
- Make sure it has the same name as specified in the MENU BACKGROUND line in graphics.conf
- Now we need to change the default boot program in WDS
- Open the Windows Deployment Services Console
- Right Click on your Server and select Properties
- From the Boot tab change the default boot program for x86 architecture to \Boot\x86\pxelinux.com
- In Server 2008 R2 you have to use the wdsutil command line to set the the default boot program with these commands
wdsutil /set-server /bootprogram:boot\x86\pxelinux.com /architecture:x86 wdsutil /set-server /N12bootprogram:boot\x86\pxelinux.com /architecture:x86
Step Three – Test it out
Before you go any further, do a test PXE boot to check everything is OK.
I use a Hyper-V VM to make this testing process quicker. Just make sure it’s set to boot to a legacy network adapter in the settings
If it doesn’t load make sure you have the following files and folders in the right place within the \\WDS\REMINST share
- \Boot\x86\pxelinux.com
- \Boot\x86\vesamenu.c32
- \Boot\x86\chain.c32
- \Boot\x86\pxeboot.0
- \Boot\x86\abortpxe.0
- \Boot\x86\background.jpg
- \Boot\x86\Linux\
- \Boot\x86\pxelinux.cfg\
- \Boot\x86\pxelinux.cfg\default
- \Boot\x86\pxelinux.cfg\graphics.conf
Step Four– Add new boot options
If you can boot into the new menu and still load WDS then we are ready to add our Linux distros and other tools. If not, go back to step one and check everything.
This stage is relatively easy. It is just a case of putting the relevant netboot files for your preferred distribution in to the \Boot\x86\Linux folder and then adding a menu option for them. You can find more info on where to get these from on the official WDSLinux wiki. I’ll show you a more generic way of doing things using Debian as an example
- Create a new subfolder
- \Boot\x86\Linux\Debian\
- Download the netboot files (initrd.gz and linux) from a Debian mirror
- Copy them into the Debian subfolder
- Create a menu entry for them in \Boot\x86\pxelinux.cfg\default
LABEL debian6Netinstall menu label ^Debian 6-0 Net-install # Load the correct kernel kernel /Linux/Debian/Linux # Boot options append priority=low vga=normal initrd=/Linux/Debian/initrd.gz
That’s all there is to it. As long as you download the correct files and boot the correct boot options on the append line of the menu, you should be OK.
What if I need 64-bit options
This is easy too just replicate everything we did in \Boot\x86 into \Boot\x64. Don’t forget to change the WDS Server boot program for the x64 architecture (as shown in step 2) to \Boot\x64\pxelinux.com
Taking it further
Hopefully you are reading this because you have numerous ideas of what you could boot to. To help you along I’ve included my current default menu as well as adding sub-menus for Linux and Tools. Most of them were fairly straightforward as they had special PXE version with instructions on their website, e.g. GParted & Clonezilla
default
DEFAULT vesamenu.c32
PROMPT 0
MENU TITLE PXE Boot Menu (x86)
MENU INCLUDE pxelinux.cfg/graphics.conf
MENU AUTOBOOT Starting Local System in 8 seconds
# Option 1 - Exit PXE Linux & boot normally
LABEL bootlocal
menu label ^Boot Normally
menu default
localboot 0
timeout 80
TOTALTIMEOUT 9000
# Option 2 - Run WDS
LABEL wds
MENU LABEL ^Windows Deployment Services
KERNEL pxeboot.0
# Go to Linux sub-menu
LABEL linux
MENU LABEL ^Linux Distros
KERNEL vesamenu.c32
APPEND pxelinux.cfg/graphics.conf pxelinux.cfg/linux.menu
# Go to Tools sub-menu
LABEL tools
MENU LABEL ^Tools
KERNEL vesamenu.c32
APPEND pxelinux.cfg/graphics.conf pxelinux.cfg/tools.menu
# Exit PXE Linux
LABEL Abort
MENU LABEL E^xit
KERNEL abortpxe.0
linux.menu (save in same place default)
MENU TITLE Install a Linux Distro
LABEL debian6.0-amd64-Netinstall
menu label ^Debian 6-0 amd64-Net-install:
kernel /Linux/Debian-Net-Install-amd64/Linux
append priority=low vga=normal initrd=/Linux/Debian-Net-Install-amd64/initrd.gz
LABEL Centos5.0-Install
menu label ^Centos 5-0 32bit install:
kernel /Linux/Centos-5.0-32-bit/vmlinuz
APPEND ks initrd=Linux/Centos-5.0-32-bit/initrd.img ramdisk_size=100000
LABEL Debian-5.08-Installer
menu label ^Install 5.08 (Lenny)
kernel /Linux/debian-installer/i386/linux
append vga=normal debian-installer/allow_unauthenticated=true initrd=/Linux/debian-installer/i386/initrd.gz
LABEL Main Menu
MENU LABEL ^Back to Main Menu
KERNEL vesamenu.c32
APPEND pxelinux.cfg/default
tools.menu (save in same place default)
MENU TITLE Tools
LABEL memtest
menu label ^Memory Test: Memtest86+ v4.20
kernel \Linux\memtest\memtestp
LABEL Clonezilla Live
MENU LABEL ^Clonezilla Live
kernel \Linux\Clonezilla\vmlinuz
append initrd=\Linux\Clonezilla\initrd.img boot=live live-config noswap nolocales edd=on nomodeset ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_keymap="" ocs_live_batch="no" ocs_lang="" vga=788 nosplash fetch=http://192.0.0.24:81/RemoteInstall/Boot/x86/Linux/Clonezilla/filesystem.squashfs
LABEL gparted
MENU LABEL ^GParted Live
kernel \Linux\gparted\vmlinuz
append initrd=\Linux\gparted\initrd.img boot=live config noswap noprompt nosplash fetch=http://192.0.0.24:81/RemoteInstall/Boot/x86/Linux/GParted/filesystem.squashfs
TEXT HELP
GParted live version: 0.8.1-3. Live version maintainer: Steven Shiau
Disclaimer: GParted live comes with ABSOLUTELY NO WARRANTY
ENDTEXT
LABEL Main Menu
MENU LABEL ^Back to Main Menu
KERNEL vesamenu.c32
APPEND pxelinux.cfg/default
Conclusion
This is a really useful tool to have in our SysAdmin arsenal. I encourage you to give it a go. Let me know if your successful, or if you are having any problems getting it working, in the comments section. I’d also love to hear of any other tools you’ve added to the PXE menu.
Pingback: Installing Linux via PXE using Windows Deployment Services (WDS) | Thom's HeadSpace
Nice work Thom.
I’ve had something very similar up and running for a little while which might add an idea or two to the mix.
My pxelinux files:
\\{server}\REMINST\Boot\pxelinux\pxelinux.0 – The boot loader
\\{server}\REMINST\Boot\pxelinux\menu.c32 – The basic menu system suits me
\\{server}\REMINST\Boot\pxelinux\chain.32 – A hard disk boot loader
\\{server}\REMINST\Boot\pxelinux\memdisk – A floppy image boot loader
\\{server}\REMINST\Boot\pxelinux\pxelinux.cfg\default – pxelinux’s default configuration file.
I then manually configured my DHCP to point the PXE Client to the PXELinux bootloader. i.e.
DHCP Option 66 (Boot Server Host Name): “ct-deploy.act.rpl.local”
DHCP Option 67 (Boofile Name): “boot\pxelinux\pxelinux.0″ *
* WDS/RIS enables MS’s own Trivial FTP Daemon, a network service which responds to PXE Clients. The daemon is configured in the registry to set a root folder, (HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TFTPD\Parameters\ Directory = “D:\RemoteInstall”) hence the path to the bootloader in DHCP Option 67
My pxelinux is currently configured with three boot options:
>>
DEFAULT menu.c32
PROMPT 0
MENU TITLE CT-DEPLOY PXE Boot Options
TIMEOUT 30 – Time in tenths of a second before default option is selected. Overridden by cursor up/down.
LABEL Boot Local
MENU LABEL ^Boot from the hard-disk
MENU default
KERNEL chain.c32
APPEND hd0 0
LABEL Windows Deployment Services – Boot the original 32bit WDS bootloader
MENU LABEL ^Windows Deployment Services
KERNEL ../x86/wdsnbp.0
APPEND keeppxe
LABEL Ghost Client
MENU LABEL ^Ghost Client
KERNEL memdisk
APPEND initrd=GhostBoot.img
>>
The Ghost Client is a mountable MS-DOS floppy image (*.img created with WinImage or similar) which allows me to quickly multicast a Ghost image to many PCs at once from a Ghost Server.
Cheers
(Please excuse the typos chain.32 should be chain.c32. Also Timeout explanation was for benefit of my team – forgot to redact.)
Very useful, thank you
Would it be possible to use this setup to perform bare-metal restores?
I’m referring to using images (including system state) taken from fully configured servers, running specific applications or databases?
-Eugene
You can use WDS to capture an image of a computer to be restored at a later date by using the Capture image as mentioned in the comment above. To fully automate it you would need to use the paid-for Microsoft System Center software but if you are able to be physically at the machine then you only need WDS
Do you happen to know whether “Capture image as” could work with a backup image produced by Volume Shadow Service?
-Eugene
I have no idea I’m afraid, sorry.
My Ghost deployment using pxelinux is essentially a bare metal restore. There’s no reason why you couldn’t put together a network boot disk (DOS or Linux) that could perform the kind of restore you’re trying for (*.bkp ?).
Since you’ve already set up WDS you could just boot WinPE and use ImageX (no need for a Ghost license). I use ImageX for full machine backup and bare metal restore.
That’s true (and I have used this in the past) but I prefer the GUI management tools that WDS provides that achieves the same goals. Same underlying tech anyway
Completely agree with you both. Guess i’ve been spoilt by Ghost for too many years to want to give it up.
I’m going to try to follow this tomorrow. I will post if I have any problems. Although I must say, it does look very well written and thought-out compared to some of the others I’ve looked at. One problem to get started with may be this: I have just clicked the link [Download SysLinux from here] in Step Two and received a page stating, “The Syslinux website is currently out of order.”
I’m hoping to be able to boot BackTrack x64 and Ubuntu x64 via WDS. I have just tested Windows 7 x64. It booted fine. But I cancelled it after getting to the Language Selection screen (I just wanted to make sure it was working).
Good luck, do let me know how you get on.
It seems like the Syslinux page has been down for a while, hopefully they aren’t going to disappear completely!
You can do a search on google for “syslinux mirrors” to find a different place to download them, like this UK based one http://www.mirrorservice.org/sites/ftp.kernel.org/pub/linux/boot/syslinux/
Hi the bootloader works fine.
I have one problem how i add images to the bootloader?
I have a Projekt on our vocational school in styria austria i must deploy ubuntu withe pxe boot .
i hope you can help me thank you for your answer
I’ve just set this up myself and it seems to be working fine. Follow the instructions below and let me know how you get on.
MENU TITLE Ubuntu 1.10 x86 (Oneiric Ocelot) Netboot Installlabel install
menu label ^Install
menu default
kernel /Linux/Ubuntu/linux
append vga=788 initrd=/Linux/Ubuntu/initrd.gz -- quiet
label cli
menu label ^Command-line install
kernel /Linux/Ubuntu/linux
append tasks=standard pkgsel/language-pack-patterns= pkgsel/install-language-support=false vga=788 initrd=/Linux/Ubuntu/initrd.gz -- quiet
LABEL Linux
MENU LABEL ^Back to Linux Menu
KERNEL vesamenu.c32
APPEND pxelinux.cfg/linux.menu pxelinux.cfg/graphics.conf
This worked for me. After the setup runs it will look for an ubunto mirror to download the rest of the setup files over the internet.
BTW, I got the code from point 10 from the netboot download in the file \ubuntu-installer\i386\boot-screens\txt.cfg
You might find more help here » help.ubuntu.com
Hi i have an other problem how can i add my own mirror server in the neetboot installer of ubuntu i must everytime download from the internet the installations files.
Thanks
You can do this by having a copy of the full install version of Ubuntu hosted by IIS on the same server as WDS. Then, when the setup asks for a mirror to choose just point the installer to http://WDSServer/VirtualDirectory. You should find more info on this in the Ubuntu help site. They will probably recommend apache as a webserver but IIS is fine for this purpose
How does the bootloader gets the mirror of our own website?Or Virtual directory
Thanks
After the netboot starts it will get to the stage where it asks if you want to auto-select a mirror or specify your own. Just type the URL there.
I haven’t done this for ubuntu but have for Debian so I guess it’s similar.
how i create a Virtual Directory,what files come in this directory?
Thanks Markus
I think you’ve misunderstood the process. A virtual directory is just a term used by Microsoft’s IIS web server for a local folder that can be accessed by HTTP or FTP (read more: http://bit.ly/ncj65l).
If you want to install an ubuntu image you could use clonezilla or point to a CD copy on your network as described in the Official ubuntu help linked to in previous comments
My situation is slightly different in that I’ve had my IT dept follow this:
http://www.vcritical.com/2011/06/peaceful-coexistence-wds-and-linux-pxe-servers/#more-3715
So that I can have control over the Linux end of it, but I’m stuck as to my next step, since I know I can’t have control over the DHCP server either.
So, I’m basically wanting to do what you did, but don’t have control of either the WDS server or the DHCP server, nor can I use my Linux PXE server as a DHCP server in the traditional sense. Help!
You don’t need to modify DHCP but you do need to change the WDS settings. That’s the only way you’ll be able to serve both from the same server
Modify the WDS settings how? Serve both of what? DHCP and PXE? I’m in an enormous corporate environment, and another DHCP server is the last thing they want, and in any case that’s completely out of my purview or interest. I just need control over the PXE booting of the Linux portion only. They’ve got the WDS server PXEChaining out to my test server now and I hope to pick up the ball from there. I just don’t know how to do that.
OK, I just properly read the article you linked to and know understand what you are trying to do. I’m afraid I only have experience hosting it all on one box (i.e. the WDS server).
From my limited knowledge, when using PXE-chaining you don’t need to involve DHCP. Just set up your linux PXE server as normal but skip the DHCP bit. It’s not needed as your client already has an IP address passed over from the initial menu provided by the WDS server.
Arriving at work, I read your comment another way. Are you saying that it’s best to configure WDS ONLY? Then I have to go through a whole different, totally ignorant about Linux group in order to make any changes, and I had hoped to avoid that.
No I’m not saying that. You have two options,
1) Have WDS host everything. You can then add images/new menus by just adding them to a folder share on the WDS server (as I have done in this article)
2) You have a WDS server that chains to another PXE server hosting all your Linux images and menus. The network won’t mind having 2 PXE servers because DHCP will only point to the WDS one
Thanks for your reply. I am not able to do the first, as I have no control over that machine, only IT does, and even getting this test environment took a month of delay. The second is what I am setting up, but the question is how, specifically, to do that. I’m in a huge learning curve here and am looking for some help as to why I get the error message I’m getting, etc.
i am not success to install Linux through via pxe Linux getting error after boot menu unable to download the kickstart file modify the kickstart parameters below or press cancel to interactive installation
ftp:\\172.4.10.98\linux\ks.cfg
I haven’t used kickstart files before.
Have you tried installing it without calling the ks.cfg file?
dear i also use it but i think main problem is that they could not load
lan drivers
when i boot they getting error unable to find any drivers
i do not thik about it how to add lan drives this image …………….
i originally used the set up guide found on the SYSLINUX website (down at time of this post–go figure) and i decided to make a couple of changes which seem to be easier to deal with.
to possibly add to a previous question — in order for your client to be able to PXE boot you need to specify two DHCP options (66 and 67) which specify boot server and boot file; respectively. if you are not able to set those options your client will never know how to PXE boot.
as in this article (extremely helpful) i set the bootprogram to pxelinux.com for both architectures (i386 & x64) but i do not call it from option 67. i instead call “\boot\x64\wdsnbp.com” as a server option. the cool part is this file will auto detect hardware capabilities and give you an i386 or x64 boot menu. this is very handy indeed.
my deployment at a glance:
DHCP server is a separate box
PXE server is Windows 2008R2 as a VM (2 CPUs and 2048RAM)
Thank you!
Glad this was helpful. BTW, DHCP options are only necessary if your PXE server is on the sane box as you DHCP server
Pingback: How do i set up Pxe boot
Tried this and my menu is failing to load.Config file does not contain a valid entry?
Doe sit work if you use the standard menu that comes with syslinux?
Hi, just wanted to say nice document. I’ve been playing around on the linux side, (ideally I’d love to build a super PXElinux boot server system..) and its an expansive subject. I’ve chosen a simpler route on the GFX. The pxelinux (syslinux as well) has support for two commands –
MENU RESOLUTION SIZE SIZE (EXAMPLE MENU RESOLUTION 1024 768)
and
MENU BACKGROUND name of pic (example MENU BACKGROUND linux.png)
This sets the size of menu screen and places a picture there.
One of the observations I have is reading through the docs and deployments just how wide an array of ‘how to’ has been reached, often by different ways and methods.
Thanks for your article!
DS
Awesome article dude!
This got me some good street cred at work
Can anyone help me with a Zorin install. I have everything working up to my boot menu. I have Zorin ISO images. 5.1, 5.2, and 6 lite. I can not find the linux kernel.
I am having trouble getting the pxelinux.com to launch when booting from PXE. When I boot, I get
TFTP Download boot\x64\pxelinux.com.
over and over and then eventually the download fails. I am missing something here but am not quite sure what it is. I am running WDS on 2008R2. Is there a separate pxelinux.0 for x64 architecture?
Pingback: Blog do Nerd » Combinando Windows Deployment Services (WDS) e PXELinux
have you guys seen Serva?
http://www.vercot.com/~serva/howto/WindowsPXE1.html
I stumbled upon this article today after doing some research on PXE, WDS, Linux etc. and I have to say your solution is great. For me certain things are working and others aren’t and being a Linux newbie, i’ll probably have to work at it longer to get things fully functional.
I’m running WIndows Server 2008 R2 x64 with WDS which enables me to deploy all versions of Windows, but I was looking for something to enable me to run utilities such as memtest, acronis recovery, ghost, burnin software etc.thru PXE instead of having to create CDs, DVDs and USB keys. So far I have the basics setup and functional. With the default menu I can launch WDS, install UBUNTU (from a repository) and launch memtest86 4.0a.
I could not get your memtest86+ 4.20 to work, so I searched for something else and found memtest86 4.0a worked. I’m still trying to figure out how to get Clonezilla to work as everything boots fine but near the end it is unable to load a file system. So I imagine that the “filesystem.squashfs” is not configured properly in my append section.
Thanks for posting this as it has been a real help for something that I have wanted to do for a long time.
Also having issues with the squashfs and fetching http requests. I setup iis and set a meme type for the squashfs so that I can download the squashfs file from a web browser but that didn’t seem help.
Great Tutorial! Thanks
after doing the all steps when i click on WDS menu on clinet pc then error shows up “file \boot\bcd an error occurred while attempting to read boot configuration data”
even my linux distributions is booting sucessfully
any need full idea
Did you get this fixed Jaf?
hi, nice guide
it’s too bad that is not work on isolinux 5 there is error
if you know how to fix the error i be heppy..
I have a question:
It is possible to look option in the menu or the menu is self with password?
thank you
Clonezilla isn’t working, but everything else is great. Thanks so much for the tutorial.
I’ve had a PXELINUX/WDS setup running for some time now, and looking at add Clonezilla to it. I noticed that the way thommck has it set up is to load Clonezilla via HTTP. Rather than have to step up HTTP services on the WDS box, I’d like to use TFTP as Clonezilla’s own documentation uses. That’s where things get a bit hairy. Still working on it, but it’s not as straightforward as I’d like it to be.
I just used a pre-documented solution for Clonezilla from the PXELinux wiki.
Let us know if you manage to get it sorted
First of all Thanks for the wonderful article, it helps me lot.
i want to fully automate the Linux installation process like i have used kickstart file for the redhat6 installation but currently i have to select the redhat6 OS from the PXE menu at boot time. i want to automate this step also, is there any way to achieve this?
I am using WDS with Windows server 2008 R2. for windows OS there is a way like we can set the default client unattended file for the prestaged machine using below command:
WDSUTIL /Set-Device /Device:Computer1 /WDSClientUnattend:WDSClientUnattend\Unattend.xml
You should be able to select an item on the PXE menu as the default timeout option. Normally it is set to boot to the hard drive but you should be able to set it to any menu item.
Would that help?
Thanks for your quick reply, but in case of multiple linux os like redhat 5, 6 and some others, can i select required OS at runtime through any external command?
I don’t think it would be impossible but it’s beyond my knowledge I’m afraid
Nice Walk through..
I’ve been trying to set this up with syslinux-4.06 (5.0) doesn’t work. I had to repeat the default commands for server 2012 for the x64 arch also. Hopefully this will safe someone the couple hours it took me to figure it out. so ……..repeat..rinse…
wdsutil /set-server /bootprogram:boot\x86\pxelinux.com /architecture:x64
wdsutil /set-server /N12bootprogram:boot\x86\pxelinux.com /architecture:x64
Thanks for the post made this a relative breeze
Cool blog! Is your theme custom made or did you download it from somewhere?
A theme like yours with a few simple adjustements would
really make my blog stand out. Please let me know where you got your design.
Bless you
OK, so I’m thinking you are just a spammer but just in case…
I use the free Skylark theme with a custom background and web fonts. You can read about them on my about page
My submenus are not working. When i select them in the PXE boot screen it loads to a screen with a boot: prompt
I had a similar problem at first.
I think it is caused by the pxelinux.cfg files in the menu’s not linking correctly after you change them from the defaults. Have a look through them and make sure they actually contain usable commands
Thanks for the assistance. I double checked my default file and noticed that I left something out.