PXE Network Booting on Ubuntu Linux

PXE Network Booting on Ubuntu Linux

How to use PXE network boot to install workstations automatically. This article is a work in progress. Copyright 2006-2008 Tero Karvinen

Make DHCP work.

Add PXE configuration to dhcpd.conf:

 filename "pxelinux.0";

(Corrected: server-name → next-server)

Install TFTP server. Also install client for testing. Trivial file transfer protocol is not related to FTP.

 $ sudo apt-get install tftpd-hpa tftp-hpa

Configure TFTP server. Notice nice path for TFTPd root (don’t use “/tftpsomething”). In RUN_DAEMON, “yes” must be small caps.

 $ sudo nano /etc/default/tftpd-hpa
# /etc/default/tftpd-hpa
OPTIONS="-l -s /home/pxetero/"

Add a user for TFTP service:

 $ sudo adduser pxetero

Allow your normal user to modify /home/pxetero/. Ues your own username and group instead of tkarvine.

 $ whoami
 $ sudo chown pxetero.tkarvine /home/pxetero/
 $ sudo chmod g+rwx /home/pxetero

Now you can modify files in TFTPd root dir (/home/pxetero/) without using sudo.

Download netboot files to /home/pxetero. (mirror of netboot files):

 $ cd /home/pxetero
 $ wget -np -r http://archive.ubuntu.com/ubuntu/dists/breezy/main/installer-i386/current/images/netboot/
 $ mv archive.ubuntu.com/ubuntu/dists/breezy/main/installer-i386/current/images/netboot/* .
 $ rm -rf archive.ubuntu.com/

Kernel “linux” and initial RAM disk image “initrd.gz” must match the version of your distribution. Change version nickname (breezy, dapper, feisty, gutsy) in the url accordingly. For example, 7.04 Feisty’s kernel and initrd are http://archive.ubuntu.com/ubuntu/dists/feisty/main/installer-i386/current/images/netboot/ubuntu-installer/i386/initrd.gz and http://archive.ubuntu.com/ubuntu/dists/feisty/main/installer-i386/current/images/netboot/ubuntu-installer/i386/linux

Start TFTP server and test it

 $ sudo /etc/init.d/tftpd-hpa start
 $ cd
 $ tftp localhost -c get pxelinux.0
 $ ls pxeli*

Now that it works (pxelinux.0 was downloaded successfully), start DHCP server:

 $ sudo /etc/init.d/dhcp3-server start

Boot your target workstation (the one whose MAC number is in dhcpd.conf). The installer should start automatically.

If that worked, it is time to enable kickstart:

 $ nano /home/pxetero/pxelinux.cfg/default

Under “label linux”, in the end of “append” row, add your kickstart like


Change timeout to non-zero value

 timeout 100

Now that you boot your workstation from network, kickstart should work and workstation should install automatically.

You can even automate waking up the computer from shutdown state. Enable “universe”, and install “wakeonlan” or “etherwake”.

Try booting the client computer (either manually choosing network boot or by magic packet). If the installer starts and asks for language, congratulations, your setup works!

What Next?

In Helia labs, boot with magic packet usually works once, and the it does not work for a long while. Probably related to switch settings.

It works, now what? – Collect IP numbers from switch – Make your own mirror of all ubuntu packages (use wget -r -X to download) – Test the whole package: magic packet, pxe, kickstart

Appendix: Modified dhcpd.conf for PXE

# dhcpd.conf for Helia labs
# Copyright 2006 Tero Karvinen http://www.iki.fi/karvinen
# License: GNU General Public License, version 2 or later
# ChangeLog:
# 2006-03-27    Initial version, testing in Helia labs
# Don't set "authoritative" until everything else is correct in dhcpd.conf
authoritative;  # Warning: this overrides other DHCP servers
# Default options in Ubuntu:
ddns-update-style none;
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
# Subnet row defines server's network card. Also set in "/etc/default/dhcp3-server"
# 'ifconfig' shows subnet (ipaddress, zeroes as in mask)
subnet netmask {
        host terotestaa {
                # 'ping target_host', 'arp' shows MAC address
                # only give DHCP information to this computer:
                hardware ethernet 00:0D:F0:1C:22:33;
                # Basic DHCP info (see 'ifconfig', 'route', 'cat /etc/resolv.conf')
                option subnet-mask;
                option routers;
                option domain-name-servers,;
                # Non-essential DHCP options
                option domain-name "tielab.helia.fi";
                # TFPT server for PXE boot
                server-name "";
                filename "pxelinux.0";
# 'sudo /etc/init.d/dhcp3-server force-reload'
# http://www.iki.fi/karvinen

Appendix: Modified pxelinux.cfg/default for Kickstart

display ubuntu-installer/i386/boot-screens/syslinux.txt
default linux
F1 ubuntu-installer/i386/boot-screens/f1.txt
F2 ubuntu-installer/i386/boot-screens/f2.txt
F3 ubuntu-installer/i386/boot-screens/f3.txt
F4 ubuntu-installer/i386/boot-screens/f4.txt
F5 ubuntu-installer/i386/boot-screens/f5.txt
F6 ubuntu-installer/i386/boot-screens/f6.txt
F7 ubuntu-installer/i386/boot-screens/f7.txt
F8 ubuntu-installer/i386/boot-screens/f8.txt
F9 ubuntu-installer/i386/boot-screens/f9.txt
F0 ubuntu-installer/i386/boot-screens/f10.txt
label linux
        kernel ubuntu-installer/i386/linux
        append vga=normal initrd=ubuntu-installer/i386/initrd.gz ramdisk_size=16432 root=/dev/rd/0 rw  -- ks=http://iki.fi/karvinen/notexists-ks.cfg
label expert
        kernel ubuntu-installer/i386/linux
        append DEBCONF_PRIORITY=low vga=normal initrd=ubuntu-installer/i386/initrd.gz ramdisk_size=16432 root=/dev/rd/0 rw  --
label server
        kernel ubuntu-installer/i386/linux
        append base-config/package-selection= base-config/install-language-support=false vga=normal initrd=ubuntu-installer/i386/initrd.gz ramdisk_size=16432 root=/dev/rd/0 rw  --
label server-expert
        kernel ubuntu-installer/i386/linux
        append base-config/package-selection= base-config/install-language-support=false DEBCONF_PRIORITY=low vga=normal initrd=ubuntu-installer/i386/initrd.gz
ramdisk_size=16432 root=/dev/rd/0 rw  --
prompt 1
timeout 20


Posted in Old Site | Tagged , , , , | Leave a comment

Leave a Reply

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