It should not come as a surprise to anyone if I say that many companies have their IT infrastructure based on Windows. But even when this is the case for the vast majority, there seems to be a will to dip a toe into Linux. With this post I want to help anyone trying to deploy Linux from a Windows server they already got in place and, without interrupting their current workflow, add some options and value.
Following thins post we’ll have the option to offer different boot options at the PXE boot screen, so that your technicians or yourself can choose what OS you want to deploy. A screenshot might make it easier to understand
This is possible thanks to the PXELinux component which is part of the bigger project Syslinux. If you ever booted from a linux CD/DVD, then those options where you select to install, liveCD, Memtest and so on are made with this.
There is an official document explaining how to do this, but I found that the article is missing some information and the menu options they provide were not fitting my purpose. Therefore this post.
Things you need to have set up prior to this guide:
- Windows 2012 R2. Windows 2008 would work too
- WDS service installed or SCCM with the PXE boot role works too.
- A valid x86 boot.wim file. I recommend the one from a Windows 8 install DVD. The reason why in a future post
- Having a x64 boot.wim is not needed. The reason why in a future post
- Set up WDS to allow PXE booting without the need for F12 and to any known or unknown client
Once you have all those set, which you might already have if you deploy Windows, you’ll need to:
- Download the latest Syslinux. To build it for this guide I used syslinux-6.02.zip
- Make a new folder in your desktop and copy these six files to it.
syslinux-6.02/bios/core/pxelinux.0 syslinux-6.02/bios/com32/menu/vesamenu.c32 syslinux-6.02/bios/com32/chain/chain.c32 syslinux-6.02/bios/com32/elflink/ldlinux/ldlinux.c32 syslinux-6.02/bios/com32/lib/libcom32.c32 syslinux-6.02/bios/com32/libutil/libutil.c32
- In your new desktop folder rename the
pxelinux.0you just copied to
- Navigate to your WDS or SCCM x86 boot directory and
- Make a copy of
pxeboot.n12and rename it
- Make a copy of
abortpxe.comand rename it to
- Make a copy of
- Copy the six component from step 2 to the x86 boot directory to have them along with the files you renamed in step 4
- Create a folder in the x86 boot directory called
- Download this, uncompress it and put the four files inside your
- To follow my example create two folders inside your x86 folder, one called
Linuxwhere you’ll copy your linux boot files and another folder called
Toolswhere you put the boot files for your tools.
- Open a terminal on your Windows server and execute this
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\x86\pxelinux.com /architecture:x64 wdsutil /set-server /N12bootprogram:boot\x86\pxelinux.com /architecture:x64
- You are all set!
Next I am going to post the three menu files I have in the
pxelinux.cfg folder, that you could edit to customise your deployments. The files are:
Probably you won’t want to edit
graphics.conf but if you do for, lets say having a corporate background, check out this.
default file is the main menu. Here you will edit the boot options, wether editing the boot switches it is allowed, timeout, text and password requirements. The file I have looks like this:
DEFAULT vesamenu.c32 PROMPT 0 #Disabled TAB option ALLOWOPTIONS 0 # Timeout in units of 1/10 s. The following is 20 seconds TIMEOUT 200 MENU TITLE From a Windows 2012 R2 MENU INCLUDE pxelinux.cfg/graphics.conf MENU AUTOBOOT Booting from the internal hard drive in # seconds #--- # Option 1 - Exit PXE Linux & boot normally LABEL bootlocal menu label Boot from the internal hard drive menu default KERNEL chain.c32 APPEND hd0 0 # TEXT HELP # Continue normal boot # ENDTEXT #--- #menu separator # Option 2 - Run WDS LABEL wds MENU PASSWD $1$5HM9kbo3$t./GFyPNjMjTjqVronP4z/$ MENU LABEL Windows Deployment Services x86 KERNEL pxeboot.0 TEXT HELP This option is password protected ENDTEXT #--- # Go to Linux sub-menu LABEL linux MENU PASSWD $1$5HM9kbo3$t./GFyPNjMjTjqVronP4z/$ MENU LABEL Linux Distros KERNEL vesamenu.c32 APPEND pxelinux.cfg/graphics.conf pxelinux.cfg/linux.menu TEXT HELP This option is password protected ENDTEXT #--- # Go to tools sub-menu LABEL tools MENU PASSWD $1$5HM9kbo3$t./GFyPNjMjTjqVronP4z/$ MENU LABEL Tools KERNEL vesamenu.c32 APPEND pxelinux.cfg/graphics.conf pxelinux.cfg/tools.menu TEXT HELP This option is password protected ENDTEXT
To add your own password visit this link and copy the MD5. If you do not want a password just remove the entire line. The password used for this example is nbalonso
Next is the
linux.menu. Here you provide the Linux sub-menu options, point to the kernel and init files you copied to x86/Linux/distroname folder and provide the path or URL to the preseed or kickstart file.
MENU TITLE Linux Distros #TAB option is allowed because the following line is commented out ##ALLOWOPTIONS 0 ##--- ## Option 1 - Install Ubuntu from Research team LABEL Ubuntu-Precise-x86_64 MENU LABEL Install Ubuntu-Precise-x86_64 kernel /Linux/Ubuntux64/linux append initrd=/Linux/Ubuntux64/initrd.gz locale=en_US text priority=critical netcfg/choose_interface=auto preseed/url=http://192.168.1.99/preseed.seed TEXT HELP Our Linux! ENDTEXT #--- LABEL Main Menu MENU Label Back KERNEL vesamenu.c32 APPEND pxelinux.cfg/default TEXT HELP Go back to the main menu ENDTEXT
And lastly an example of my
tools.menu options where you can see some helpful tools for memory testing, partitioning and scanning for virus. You can use these as an example or visit the WDSLinux web I linked before for more information
MENU TITLE Tools MENU TABMSGROW 20 #Disable TAB option ALLOWOPTIONS 0 #--- LABEL memtest MENU LABEL Memory Test: Memtest86+ v4.20 kernel /Tools/memtest86+/memtest TEXT HELP Memtest86+ is a utility designed to test whether your memory is in working order. It repeatedly writes an enormous amount of different patterns to all memory locations and reads them back again and verifies whether the result of the read is the same as what was written to memory. ENDTEXT #--- LABEL GParted-Live MENU LABEL Launch GParted Live kernel /Tools/gparted-live-0.13.0-3/vmlinuz append initrd=/Tools/gparted-live-0.13.0-3/initrd.img boot=live config union=aufs noswap vga=788 fetch=http://192.168.1.1/filesystem.squashfs TEXT HELP GParted Live is a small bootable GNU/Linux distribution for x86 based computers. It enables you to use all the features of the latest versions of the GParted application. ENDTEXT #--- #LABEL DaRT for Windows 7 32bit # MENU LABEL DaRT for Windows 7 32bit # wimboot # append initrdfile=/Tools/DaRT7-x86/bootmgr,/Tools/DaRT7-x86/bcd,/Tools/DaRT7-x86/boot.sdi,/Tools/DaRT7-x86/Dart7x86.wim # TEXT HELP # Useful tools to troubleshoot Windows 7 machines # ENDTEXT #--- LABEL fsecurerescuecd MENU LABEL F-Secure AV Rescue CD KERNEL /Tools/fsecure/linux APPEND ramdisk_size=100000 lang=en vt.default_utf8=0 apm=power-off vga=0x311 initrd=/Tools/fsecure/minirt.gz nomce quiet loglevel=1 nolapic_timer console=tty10 video=noblank TEXT HELP F-Secure Rescue CD is a handy utility that will help you securely boot up the computer and check the programs installed when your computer doesn't start due to malware corrupting or you suspect that the security software is compromised. ENDTEXT #--- LABEL Main Menu MENU Label Back KERNEL vesamenu.c32 APPEND pxelinux.cfg/default TEXT HELP Go back to the main menu ENDTEXT
Sorry for the long post but this is a somehow complicated setup, specially the first time you do it. That is why I tried to write down as much details as possible. If anything is not clear or you find a roadblock setting it up please leave a comment below.
Edit: to collect the Ubuntu netboot files go to this link
ubuntu-installer/arch/ and collect the
linux kernel file and the