A few days ago, I tweeted that I swapped out the WDS pxe boot program for pxelinux, and in doing so, I managed to create a system that would let me deploy Linux distributions alongside my Windows images without needing a separate PXE server nor losing the capabilities of WDS. I have found imaging machines over the network much more convinient than installation through flash drive / CD / DVD etc – being able to install my Linux distros in the same manner would be a blessing.
The first thing you need is a working, and by that I mean a configured WDS server that has the correct DHCP options applied. If other machines can load a standard boot.wim then this step has been satisfied.
The next step is to download the syslinux package from the Linux Kernel Archives here. Extract the following files:
- core\pxelinux.0
- com32\menu\vesamenu.c32
- com32\modules\chain.c32
Put these three files in your architecture directory (x86 or x86 — both if deploying to both systems) under your WDS root folder, which will most likely be named RemoteInstall.
Next, create a directory in each architecture called pxelinux.cfg, one called linux (to store distros) and create a file called default.cfg
cd \; cd RemoteInstall\x64; mkdir pxelinux.cfg; mkdir linux; cd pxelinux.cfg; echo OFF > default
Leave it blank for now.
Now we change the boot program to pxelinux.0 which is in the architecture directory. This can be only be done by command line in WS2K8R2. Here is an example:
(x86)
- wdsutil /set-server /bootprogram:boot\x86\pxelinux.0 /architecture:x86
- wdsutil /set-server /N12bootprogram:boot\x86\pxelinux.0 /architecture:x86
(x64)
- wdsutil /set-server /bootprogram:boot\x64\pxelinux.0 /architecture:x64
- wdsutil /set-server /N12bootprogram:boot\x64\pxelinux.0 /architecture:x64
Now we have the WDS core configured. What we have done is replaced the default PXE boot program with a Linux one. This gives us more flexibility and if we want to use the WDS boot loader to load a boot.wim file, we can do so by passing it in one of the arguments.
The next step is to download some Linux “netboot” images which we can have as installers. I did this for Ubuntu (grab the files here). All that’s needed is the Linux kernel and ramdisk and then the installer can fetch all the necessary bits. I also chucked in memtest86+ — simply one file which means that deployment is also as simple, and gparted which needs to download a file system over TFTP.
Here was my default file:
DEFAULT vesamenu.c32
PROMPT 0
NOESCAPE 0
ALLOWOPTIONS 0
# Timeout in units of 1/10 s
TIMEOUT 100
MENU MARGIN 10
MENU ROWS 16
MENU TABMSGROW 21
MENU TIMEOUTROW 26
MENU COLOR BORDER 30;44 #20ffffff #00000000 none
MENU COLOR SCROLLBAR 30;44 #20ffffff #00000000 none
MENU COLOR TITLE 0 #ffffffff #00000000 none
MENU COLOR SEL 30;47 #40000000 #20ffffff
MENU TITLE Netboot Menu
LABEL wds
MENU LABEL WDS
KERNEL pxeboot.n12
label ubuntu-1004
menu label Ubuntu 10.04 Installer
kernel /linux/ubuntu1004/linux
append priority=low vga=normal initrd=/linux/ubuntu1004/initrd.gz –
label gparted-live
MENU LABEL Gnome Partition Editor
kernel \linux\gparted\vmlinuz
append initrd=\linux\gparted\initrd.img boot=live union=aufs noswap noprompt vga=788 fetch=tftp://192.168.1.2/linux/gparted/filesystem.squashfs
label memtest
menu label Memtest86+
kernel \linux\memtest\memtest
#—
LABEL Abort
MENU LABEL AbortPXE
Kernel abortpxe.com
What I have done is store each distro’s kernel and ramdisk in a separate directory. This makes maintenance easier. Kernel arguments are passed with the append parameter — look up the kernel arguments of your chosen distro for more. Note that for gparted I added: fetch=tftp://192.168.1.2/linux/gparted/filesystem.squashfs. This allows the distro to acquire the actual file system, and thus launch utilities such as parted. GParted allows fetching of the squashfs (read only) file over TFTP. This will be accessible at the WDS server in the linux directory we created earlier.
This is good, as we have now added the ability to deploy Linux distros alongside Windows distros and still retain WDS functionality. I wanted to take the idea further though, and boot a LiveCD (which can be easily customised) in the pre-execution environment.
This is very simple to do. I did this with Maverick Meerkat (Ubuntu 10.10). I first appended my current configuration for pxelinux (default):
LABEL maverick-live
kernel linux/ubuntu-1010/vmlinuz
append boot=casper netboot=nfs nfsroot=192.168.1.2:/path/to/file/system initrd=linux/ubuntu-1010/initrd.gz
Unfortunately, unlike GParted, the filesystem must be served over NFS, not TFTP. First, we need to install an NFS server. Configuration is beyond the scope of this article: see http://technet.microsoft.com/en-us/library/cc753302%28WS.10%29.aspx for more. After this, we can now serve Linux installations and live distributions to any clients that connnect.
I also wanted to automate the installation of Windows versions that are not compatible with WDS (i.e. < XP). This was easy as putting in a rc.local script which used dd to transfer image data and then running resize2fs -f /dev/sda. It would be nice if I could customise the kernel in such a way that I could pass the Win distro to be installed via kernel flags with the append option.
