Fedora PXE Boot/NFS Root

These are the basic steps for creating an NFSROOT fedora core PXE configuration.

Obtain tftp, dhcpd, nfs-utils, dracut, dracut-network and syslinuxCode:

yum install syslinux dhcp tftp nfs-utils

Configure dhcp server

edit /etc/dhcp/dhcpd.conf

vim /etc/dhcpd/dhcpd.conf

2. Add the following text and edit to suit your needs:

allow bootp;
allow booting;
filename = "/pxelinux.0";
ddns-update-style none;

subnet netmask {

  default-lease-time 3600;
  max-lease-time 4800;

  option domain-name-servers;
  option subnet-mask;
  option domain-name "local";
  option routers;
  option broadcast-address;

  host c1 {
    hardware ethernet 00:13:72:A5:9D:C1;
    option host-name "c1";
    filename "/pxelinux.0";

Configure the dhcp server to start at boot

chkconfig dhcpd on

Restart the dhcp server

service dhcpd restart

Configure the NFS Server

Create the directory where you will store all of your NFS Root images

sudo mkdir /home/nfsroot

Edit the /etc/exports file

vim /etc/exports

Add the following line:


Restart the nfs server or alternatively re-export everything

sudo service nfs restart
sudo exportfs -rfa

Setup the TFTP server and install syslinux

Make the top level tftp directory

sudo mkdir /tftpboot

Add the syslinux boot image

sudo cp /usr/share/syslinux/pxelinux.0 /tftpboot/
sudo cp /usr/share/syslinux/menu.c32 /tftpboot/

Create the pxelinux.cfg directory where you will put the menu files

mkdir -p /tftpboot/pxelinux.cfg

Create default pxe configuraiton

vim /tftpboot/pxelinux.cfg/default

Add the following lines


LABEL linux
        KERNEL vmlinuz_fc13
        APPEND initrd=fc_13.img selinux=0 nousb rootfstype=nfs root=/dev/nfs nfsroot=

TFTP uses xinetd. We need to enable the service

vim /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
#       protocol.  The tftp protocol is often used to boot diskless \
#       workstations, download configuration files to network-aware printers, \
#       and to start the installation process for some operating systems.
service tftp
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        # Turn on verbose options to help with troubleshooting and also change the path to /tftpboot
        server_args             = -s /tftpboot -v -v -v -c
        # Do not forget to enable the service
        disable                 = no
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4

Restart xinetd

service xinetd restart

Create an NFSRoot image to boot from

Creating a NFSROOT image can be accomplished many ways, including:

- Use virtualbox and install a basic operating system environment. Copy that environment to your nfsroot directory.
- Use yum to install a basic environment. (Not covered here)

1. Determine the method to roll your OS onto some storage platform.

2. Copy the relevant files over to the appropriate directory

rsync -avz --exclude="/dev/*" --exclude="/sys/*" exclude="/proc/*" --exclude="/home/*" --exclude="/tmp/*" --exclude="/selinux/* "-e ssh

3. Generate the the initrd image and copy the kernel to the /tftpboot directory

cp /boot/vmlinuz-`uname -r` /tftpboot/vmlinuz_fc13
dracut /tftpboot/fc_13.img $(uname -r)

4. Edit the fstab file in the image you just installed (Do not edit your systems fstab file....)

sudo vim /home/nfsroot/diskless/fedora/13/x86_64/etc/fstab

Remove every line. The change in step five will not require anyting to be in the fstab file.

5. Edit the /home/nfsroot/diskless/fedora/13/x86_64/etc/sysconfig/readonly-root directory and alter the file to appear like this:

# Set to 'yes' to mount the system filesystems read-only.
# Set to 'yes' to mount various temporary state as either tmpfs
# or on the block device labelled RW_LABEL. Implied by READONLY
# Place to put a tmpfs for temporary scratch writable space
# Label on local filesystem which can be used for temporary scratch space
# Options to use for temporary mount
# Label for partition with persistent data
# Where to mount to the persistent data
# Options to use for peristent mount

6. At this point you should have everything you need.

Section F: Troubleshooting

1. Use tail to monitor the messages log file. Look for tftp image files that can not be loaded.

sudo tail -f /var/log/messages

2. Use wireshark to monitor the network traffic between clients and servers.

3. Use virtualbox or some other virtualization solution to rapidly test your PXE/NFSroot configuration.

4. Using CHROOT to access your image. Useful if you want to install packages using YUM. Also use this to remove things that are not needed.

sudo mount --bind /proc /home/nfsroot/diskless/fedora/13/x86_64/proc
sudo mount --bind /sys /home/nfsroot/diskless/fedora/13/x86_64/sys
sudo mount --bind /dev /home/nfsroot/diskless/fedora/13/x86_64/dev

chroot /home/nfsroot/diskless/fedora/13/x86_64
source /etc/profile

5. During system initialization, there will be some complaints about certain things not being available. For the most part, these failures do not seem critical to the system. I am looking into the init scripts to fix these issues, but if anyone else has any comments, please let me know.