Booting On PXE And On A Customized Debian System 

This document describes how to boot on a Debian system with a PXE boot. It is not recommended to use this tutorial for many PXE clients, but you can use it for network deployement, for example.

The PXE server and client will be running both on Debian Etch 4.0.

You can use a crossover cable or boot over a switch.

1. Installing Debian (on the server)

1.1 Installing the base system

Follow the excellent tutorial "The Perfect Setup - Debian Etch (Debian 4.0)", the first 2 pages.

1.2 Configuring the network

Edit the file /etc/network/interfaces.

vi /etc/network/interfaces
And change the file to have something like this:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static

Change the gateway or adapt the IP configuration to work on your environment. Please change allow-hotplug eth1 to auto eth0 to avoid to lose your network if you reboot your server without network cable (in case of you need to unplug your computer to plug in a crossover cable).

2. Installing the packages

You must install :

- a DHCP server to enable PXE
- a TFTP server to transfer somes files
- the debootstrap package to create a virtual system

apt-get install tftpd-hpa dhcp3-server debootstrap nfs-kernel-server

3. Creating the virtual system

3.1 Creating a minimal Debian Etch system

In this section, we will create a folder containing the future system. You will be able to customize this system without changing you PXE server configuration. First, create the base system:

mkdir /pxeroot
cd /pxeroot
debootstrap etch /pxeroot

The last command may take a long time depending on your internet connection. It will download a basic Debian system. Then you must configure your network.

cp /etc/network/interfaces /pxeroot/etc/network/interfaces
vi /pxeroot/etc/network/interfaces

And paste this content into the file. This will allow the PXE client to have a dynamic IP address.

# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp

Set the network name:

echo pxeboot > /pxeroot/etc/hostname
cp /etc/hosts /pxeroot/etc/hosts
vi /pxeroot/etc/hosts

And change the file to have something like this: localhost pxeboot
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

Create the fstab file:

cp /etc/fstab /pxeroot/etc/fstab
vi /pxeroot/etc/fstab

And change the file to look like this:

# /etc/fstab: static file system information.
# <file system>   <mount point>   <type>   <options>   <dump>    <pass>
/dev/ram0  /       ext2   defaults    0   0
proc       /proc      proc   defaults    0   1
tmpfs      /tmp       tmpfs  defaults    0   1

3.2 Customize your virtual system

You can use the chroot command to customize your system. Simply run:

chroot /pxeroot

First, you must install a Linux kernel:

apt-get install linux-image-386

Some warnings will appear because your system might not be bootable because there is no boot loader on the system (grub, lilo,...). Don't stop the script by answering "no" when it aks if you want to stop the installation.

Then simply install the wanted package. In our case, we will run partimage for dumping partition.

apt-get install partimage

When your configuration is finished, exit the chroot:


4 Configuring the DHCP server

Now we need to have a dhcp server to give the address to the PXE client.

vi /etc/dhcp3/dhcpd.conf

And change the file to have something like this:

subnet netmask {
    option subnet-mask;
    filename "pxelinux.0";
    option root-path "";
    option broadcast-address;

You can set other options as gateway, dns,... but in our example, we don't need it.

Restart the DHCP server when the configuration is finished:

/etc/init.d/dhcp-server restart

5 Configuring the TFTP server

Setting up the startup:

vi /etc/default/tftpd-hpa

And change the file to look like this:

OPTIONS="-l -s /var/lib/tftpboot"

Then restart the service:

/etc/init.d/tftpd-hpa restart

6 Configuring PXE boot

These commands will create the PXE boot system:

cd /var/lib/tftpboot
cp /pxeroot/vmlinux ./
cp /pxeroot/initrc.img ./
mkdir pxelinux.cfg
vi pxelinux.cfg/default

Then paste this into the file:

DISPLAY boot.txt2
F1 f1.txt


LABEL linux
    kernel vmlinuz
    append vga=normal initrd=initrd.img ramdisk_size=14332 root=/dev/nfs nfsroot= rw --


You can optionally write a comment visible on boot into /var/lib/tftpboot/boot.txt.

7 Configuring NFS

You must simply export the folder /pxeroot.

vi /etc/exports

And add this line:


Restart the nfs sever for the changes to take effect:

/etc/init.d/nfs-kernel-server restart

8 Starting the computer (on the client)

You must check that the network boot is before the other bootable device. When you computer startup, press on "F2", "DELETE" or "F10" depending on your configuration. Find the boot order section then set up the Network boot at the first place. For example here:

BIOS configuring network at first boot

Share this page:

Suggested articles

7 Comment(s)

Add comment


By: Anonymous

That sounds wrong. I get the same error message on a very dumb switch. I can mount the NFS share on other machines, just not as nfsroot when PXE booting.


hi this how-to is very good and i learn how to use PXE whit this.

but it has some typos and some errors.

in chapter 3 in the lan configuration, if you use dhcp there the boot crash...

 and in chappter 6 where say

cp /pxeroot/initrc.img ./

should say cp /pxeroot/initrd.img ./

( cp /pxeroot/initrD.img ./ )


thanks for this how to 

By: Anonymous

alternative good approach here...

By: Anonymous

Yes, it looks good, but ... it never worked for me!

I installed it several times (debian etch 4.0 r3), I've been searching a damn clue everywhere, BUT :

nfs: server not responding, still trying

until the end of eons... And no answer.

Lots of people suffered with this, just check Google, but I found no answer for my particular case :

- network cable OK;

- switch changed 5 times, with different HW;

- nfs is working (??? whatever, I can mount it by hand);

- DHCP OK (client gets valid address );

- TFTP looks good too;

No idea at all of what could trick.



This sounds similar to two problems I've had before.

The first goes something like this:

  • You PXE boot and DHCP works
  • You start the installer
  • It times out waiting for a network service (DHCP, NFS, etc)

The problem is Spanning Tree or other network negotiations. When the second attempt to connect to the network happens the switch port has to do it's Spanning Tree negotiation. This can take 30-60 seconds and the service waiting to get a reply from the network times out. The fix was to enable "port fast" on the switch port that the server was connected to; this skips the negotiations that happen. Cisco calls the option "port fast" though it may be different for other vendors.

The second problem I had was a box that had two NICs. PXE boot detected one NIC as eth0 but the kernel detected the other as eth0. The problem has to do with how the BIOS presents the NICs to the kernel and how the kernel determines which NIC is first. The solution was to physically switch ports between PXE boot and the installer doing DHCP. Another option is to disable one NIC in the BIOS. This will have consequences if you re-enable the NIC after you install since the kernel will still detect the other NIC as eth0.


Solution to "nfs: server not responding, still trying" for me was disabling network configuration in /pxeroot/etc/network/interfaces (network is allready configured at that time).

Also if you build custom kernel, don't forget to change "BOOT=nfs" in initramfs.conf, before you create initrd image (e.g. update-initramfs -c -k vmlinuz- ).

Great tutorial by the way.