Ubuntu PXE Booting

PROBLEM
Wife's new Dell laptop had a broken DVD drive, and wouldn't boot off any USB image either. We were shipping the laptop back to Dell (other, prior, various problems), but our financial data was on the HDD. I couldn't get into my familiar Ubuntu Live environment (wanted to wipe the hdd before returning), due to the broken DVD drive, and the unknown issue of the device not wanting to boot into a USB Live Environment.

SOLUTION
Ubuntu PXE Environment. I booted the laptop into it's BIOS, and moved the PXE Boot option to the top of the list. Then, I just had to add a tftp server to my existing Ubuntu server, make a few other alterations, and I was quickly in a PXE environment. I'll list out the details below.

PROCEDURE
1.) Install the needed servers:

sudo apt-get install tftpd-hpa dhcp3-server nfs-kernel-server syslinux

2.) Configure the /etc/default/tftpd-hpa file like so:

sudo vi /etc/default/tftpd-hpa

TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/srv/tftpboot"
TFTP_ADDRESS="IP.OF.YOUR.SERVER:69"
TFTP_OPTIONS="--secure"

3.) Configure the /etc/dhcp3/dhcpd.conf file like so:

sudo vi /etc/dhcp3/dhcpd.conf

allow booting;
allow bootp;
group
{
        next-server     IP.OF.YOUR.SERVER;
        filename        "/pxelinux.0";
        host laptop
        {
                hardware ethernet       mac:address:of:device;
                option host-name        "laptop";
        }
}

4.) Create the Ubuntu PXE Environment(s):

sudo mkdir -p /srv/tftpboot/pxelinux.cfg
sudo mkdir /srv/tftpboot/11.04x86desktop
sudo mkdir /srv/tftpboot/11.04x64desktop

5.) Loop mount the ISOs into place:

sudo mount -o loop /path/to/ubuntu-11.04-desktop-i386.iso /srv/tftpboot/11.04x86desktop
sudo mount -o loop /path/to/ubuntu-11.04-desktop-amd64.iso /srv/tftpboot/11.04x64desktop

6.) Create a nice message screen that will be displayed upon PXE boot:

sudo vi /srv/tftpboot/message


:: Ubuntu PXE Environment ::
============================

OPTIONS:              DESCRIPTIONS:
11.04x86 (Default) == Ubuntu 11.04 for 32bit devices

11.04x64           == Ubuntu 11.04 for 64bit devices
----------------------------------------------------

Type the option, and hit enter:


7.) Create the default pxelinux config file:

sudo vi /srv/tftpboot/pxelinux.cfg/default

DISPLAY message
DEFAULT 11.04x86
PROMPT 1
TIMEOUT 0
LABEL 11.04x86
	kernel 11.04x86desktop/casper/vmlinuz
	append root=/dev/nfs boot=casper netboot=nfs nfsroot=IP.OF.YOUR.SERVER:/srv/tftpboot/11.04x86desktop initrd=11.04x86desktop/casper/initrd.lz --
LABEL 11.04x64
        kernel 11.04x64desktop/casper/vmlinuz
        append root=/dev/nfs boot=casper netboot=nfs nfsroot=IP.OF.YOUR.SERVER:/srv/tftpboot/11.04x64desktop initrd=11.04x64desktop/casper/initrd.lz --

!! UPDATE !!
Ubuntu changed the CD layout for 12.10+ Server. You will have to update the above file like so. However, this uses the Internet to install. Still trying to find the solution to mimic the above desktop solution.:

LABEL 12.10x64_server
        kernel 12.10x64_server/install/netboot/ubuntu-installer/i386/linux
        append root=/dev/nfs boot=nfs nfsroot=IP.OF.YOUR.SERVER:/srv/tftpboot/12.10x64_server initrd=12.10x64_server/install/netboot/ubuntu-installer/i386/initrd.gz --

8.) Copy the pxelinux.0 file into place:

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

9.) Configure the NFS server like so:

sudo vi /etc/exports

/srv/tftpboot/11.04x86desktop *(ro,sync,no_root_squash,no_subtree_check)
/srv/tftpboot/11.04x64desktop *(ro,sync,no_root_squash,no_subtree_check)

10.) Start all the appropriate services:

sudo exportfs -va
sudo service tftpd-hpa start
sudo service dhcp3-server start
sudo service nfs-kernel-server start

11.) Go boot the laptop, and you should be presented with the ":: Ubuntu PXE Environment ::" menu.

Enjoy!