WDS for Windows and Linux

Where I work is very much a Windows shop. Well, there’s also almost 2000 OS X laptops to worry about. However, most of the infrastructure we operate is built around Windows.
Active Directory provides centralised authentication (even for Linux and OS X), Group Policy configures the systems and WDS with MDT is used to handle imaging.
With my push to get Linux systems managed to the same extent, we’ve been keen not to duplicate infrastructure where possible. Turns out we can configure WDS to support both Windows and Linux, meeting that goal.
The process for getting this going is actually fairly simple. You’ll need to start by grabbing a reasonably recent copy of syslinux. That’s what we’ll be using to replace the initial WDS boot menu.
I should probably point out here that we’ll only be configuring this for 64 bit systems. You can make the same changes to the 32 bit elements in WDS. However, the lack of 32 bit systems in existence nowadays tends to make the work of limited benefit.
Anyway, from the archive you downloaded, you’ll want to find the following files and put them in your RemoteInstall\Boot\x64\ folder on the Windows server:

  • chain.c32
  • ldlinux.c32
  • libcom32.c32
  • libutil.c32
  • pxelinux.com
  • vesamenu.c32

It’s also suggested that you make a copy of abortpxe.com and pxeboot.com called abortpxe.0 and pxeboot.0.
You’ll also want to create two new folders in your RemoteInstall\Boot\x64 folder. One of them should be called Linux and the other pxelinux.cfg. The former will be used to store the actual boot images for your Linux system. The latter, for configuring the boot menu.
Within the pxelinux.cfg folder, you’ll need to create three files. The first of these is called default and holds the configuration for the first menu we’ll display after F12 is pressed.
As an example, the contents should look something like this:

DEFAULT vesamenu.c32
PROMPT 0
MENU TITLE PXE Boot Menu (x64)
MENU INCLUDE pxelinux.cfg/graphics.conf
# WDS (Windows Installation)
LABEL wds
menu label Install Windows
KERNEL pxeboot.0
# Linux (Ubuntu and CentOS)
LABEL linux
menu label Install Linux
KERNEL vesamenu.c32
APPEND pxelinux.cfg/graphics.conf pxelinux.cfg/linux.menu

As you can see, we configure the menu to display two options – Install Windows and Install Linux. The Install Windows option simply calls the pxeboot.com (now called pxeboot.0) that is called by default.
The Install Linux option is a little more complicated and loads a second menu.
To test what we’ve done so far, you’ll need to reconfigure WDS. Run the following commands (as administrator) to set our menu as the default PXE boot option:

wdsutil /set-server /bootprogram:boot\x86\pxelinux.com /architecture:x86
wdsutil /set-server /N12bootprogram:boot\x86\pxelinux.com /architecture:x86
wdsutil /set-server /bootprogram:boot\x64\pxelinux.com /architecture:x64
wdsutil /set-server /N12bootprogram:boot\x64\pxelinux.com /architecture:x64

Booting from the WDS server should now present a rather plain looking menu that allows you to select between Windows and Linux installations.
To help style out the menu, you’ll need to create a file called graphics in the pxelinux.cfg folder with the following contents:

MENU MARGIN 2
MENU ROWS 2
MENU TABMSGROW 21
MENU TIMEOUTROW 26
MENU COLOR BORDER 30;47
MENU COLOR SCROLLBAR 30;47
MENU COLOR TITLE 1;36;44 #c00090f0 #00000000 std
MENU COLOR SEL 30;47 #ffffffff #ffc0c0c0 std
MENU COLOR UNSEL 30;47 #ffc0c0c0 #00ffffff std
MENU COLOR TIMEOUT_MSG 30;47 #ffc0c0c0 #00ffffff std
MENU COLOR TIMEOUT 30;47 #ffc0c0c0 #00ffffff std
MENU BACKGROUND background.png
NOEXCAPE 0
ALLOWOPTIONS 0

This should create you a menu with a white background and grey text. It’ll also display a 640×480 image file called background.png behind the menu.
It’s likely you’ll want to change this colour scheme to match your corporate standard or artistic choices. The best place to help you with this is the MENU COLOR section of this page.
Bear in mind that any colours you select are listed #foreground #background in AARRGGBB format. That means you can get quite creative with your selections and transparencies.
While our menu might be looking the part, it’s only operational for Windows so far. We still need to configure the sub-menu for Linux. To do this, create a file called linux.menu in the pxelinux.cfg folder with the following contents:

MENU TITLE Install Linux
MENU ROWS 2
LABEL ubuntu-14.04-netinstall
menu label Install Ubuntu 14.04 (LTS)
kernel /Linux/ubuntu-14.04-amd64/linux
append initrd=/Linux/ubuntu-14.04-amd64/initrd.gz keyboard-configuration/layoutcode=gb console-setup/ask_detect=false locale=en_GB url=http://preseed_server/ubuntu14
LABEL centos-7-netinstall
menu label Install Centos 7
kernel /Linux/centos-7-amd64/vmlinuz
APPEND initrd=Linux/centos-7-amd64/initrd.img ks=http://kickstart_server/centos7

While the Kickstart and Preseed parts are optional, this will setup a menu allowing you to install both Ubuntu 14.04 and CentOS 7.
If you were to PXE boot now, you’ll be presented with the first menu we got working earlier. Selecting Install Linux will now display a menu with two items in it.
However, selecting any of them will throw an error. The reason is that we haven’t actually  got any of the OS files in place yet.
We’ll start with getting the Ubuntu netinstall option working. First step is to create a folder inside you Linux folder called ubuntu-14.04-amd64.
You’ll also need to grab a couple of files to go into this folder. Start by downloading this archive and extracting it on your local machine. Find both the initrd.gz and linux files and copy them to the newly created ubuntu-14.04-amd64 folder.
Assuming we’ve done this correctly, you should now be able to install Ubuntu from your new PXE boot menus. While that’s pretty impressive, we’ve still got more to come.
Inside the Linux folder, create a folder called centos-7-amd64. Download a copy of the netinstall CD from here. Copy the vmlinuz and initrd.img files from the CD image to the centos-7-amd64 folder.
You should now be able to install both Ubuntu and CentOS from your swanky new WDS boot menu. Even better, if you’ve got the contents of Boot folder replicated across your servers, making this live on multiple sites should be as simple as running a couple of wdsutil commands.

You may also like...

3 Responses

  1. bryanb229 says:

    config file folder needs to be named pxelinux.cfg not pxeboot.cfg for this to work right. Otherwise you get a message that says something like:
    tftp download: boot\x64\pxelinux.com
    unable to locate configuration file
    boot failed: press a key to retry or wait for reset

    • marc says:

      Thanks for your correction. It is indeed pxelinux.cfg and not pxeboot.cfg. I’ve updated the article and will read my own notes better next time!

  2. Tobias42 says:

    any idea to cover this with UEFI?

Leave a Reply

Your email address will not be published. Required fields are marked *