Rolling Out Unattended Debian Installations (Part 2)

By: Carla Schroder
Monday, December 13, 2004 11:07:02 AM EST

Giving Clients The Boot

Last week, Part 1 covered the basic configuration for a Debian FAI (Fully Automatic Installation) server. Today we'll configure the client installations--network server settings, what software is going to be installed, and the client boot methods. FAI supports network booting, which is fast and easy when it works. FAI also supports booting the clients from FAI boot diskettes.

Most modern network cards and mainboards support network booting. For example, the Linksys LNE100TX, LNE100M, the D-Link DFE 500 series, Netgear FA312, Intel PRO/100, most 3Com cards, and most IBM network adapters support netbooting. There are three parts to enabling netbooting. First, you need an NIC and mainboard that support netbooting.

Secondly, you need to enable netbooting in the system BIOS, and make sure the NIC is the second boot device. Make the hard drive the first boot device. This is for systems with no operating system installed; on the first boot, it will not be able to boot from the hard drive so it will go to the second boot device. Then when you reboot after installation, it will boot from the hard drive. There are special instructions for 3Com cards, and of course check the documentation for your own hardware.

The last part is sending boot information over the network to the client PCs. The client PCs pick up an IP address, kernel, and a root filesystem from the FAI server. Obviously this is a chicken-and-egg situation when you are preparing to install Debian on clients with no operating system installed. The trick to this is collecting MAC addresses from the client PCs, then configuring dhcpd.conf on the FAI server to assign hostnames and IPs to each MAC address.

If you wish to install on PCs that already have an operating system, no problem, the FAI installer will overwrite everything. Just remember to set the BIOS order for netboot, then change it after installation to boot from the hard drive.

To set up FAI for netbooting, first install syslinux if it isn't already installed. Then create the FAI bootfiles:

#fai-chboot -IFv workstation1 workstation2 workstation3

Yes, you must name every host. Then make this entry in /etc/inetd.conf:

tftp dgram udp wait root /usr/sbin/in.tftpd in.tftpd -s /boot/fai

Using Boot Diskettes and Configuring dhcpd.conf

If you elect to use boot diskettes, rather than netbooting, simply use /usr/sbin/make-fai-bootfloppy, which comes with FAI, to create the diskettes. This little utility does a complete job: it installs GRUB as the bootloader, loads a kernel, and defaults to using DHCP to pick up all the network information. Sometimes it's easier to use diskettes than to fuss with getting netbooting working. You may use both, FAI doesn't care.

Edit the sample /usr/share/doc/files/examples/etc/dhcpd.conf so that it has your own server name and network IPs. Then copy it to /etc/dhcp3/dhcpd.conf. Then you'll need to collect all the client MAC addresses, then assign a hostname and IP address to each client in /etc/dhcp3/dhcpd.conf. I know, this is boring and tedious and no fun. But it's a necessary step.

The author of FAI, Thomas Lange, has thoughtfully provided an easy way to collect and order the MAC addresses with tcpdump. First, run this command on the FAI server. You can call the output file anything you like:

# tcpdump -qte broadcast and port bootpc > /tmp/mac.list

Then power up all of the client PCs. They will send out broadcast packets, trying to figure out who and where they are. They won't get answers, because dhcpd is not running yet, so they may experience self-esteem issues. But it's only temporary, so don't worry about it. Halt tcpdump with Ctrl+C, then use this command to sort out your tcpdump capture:

# perl -ane 'print "\U$F[0]\n"' /tmp/mac.list | sort | uniq

Now you must take all the client MAC addresses, and make entries in /etc/dhcp3/dhcpd.conf assigning each one a hostname and IP address, like this:

host workstation1 {
      hardware ethernet 0:4:5A:DC:37:F3;

host workstation2 {
      hardware ethernet 0:A:E4:40:8B:FD;

Now restart the DHCP server:

# /etc/init.d/dhcp3-server restart

You can also get the MAC addresses by booting the client PCs with a bootable rescue disk like Knoppix or tomsrtbt, and running /sbin/ifconfig.

Configuring The Client Installation

At last it is time to configure the packages you want installed and other installation options. All of this sits in /usr/local/share/fai on the FAI server. This will be mounted on the installation clients as /fai. The fast way, for those who want to get a test FAI installation going in a hurry, is to copy the example scripts into the working directory:

# cp -a /usr/share/doc/fai/examples/simple/* /usr/local/share/fai/

To customize package selection, edit /usr/local/share/fai/package_config/DEFAULT. To customize disk partitioning, edit /usr/local/share/fai/disk_ config/SMALL_IDE. /usr/local/share/fai/class/DEFAULT.var contains a number of variables you'll probably want to change, such as timezone, default root password for the client PCs, and kernel modules. To start the installation, restart the client PCs. You can monitor the installation of all install clients with the faimond command. All clients check to see if this daemon is running on the install server, and report their progress. For many users, this is enough to create a usable FAI server.

Customizing FAI can be rather daunting once you start investigating all the available options. In fact its customizability is nearly unlimited, restricted only by your script-writing and editing powers. FAI uses standard Linux utilities, glued together with bales of Bourne shell and Perl scripts, and cfengine configurations. One of FAI's nicest features is classes. Classes can be used to define all sorts of different installation types: server, notebook, desktop, programmer, and even different installation components, which you can mix n match. Creating and managing classes is a whole article by itself; you can get a head start with Defining Classes.

As you can see, the initial configuration of FAI can get complicated. However, you can't beat FAI for flexibility, it's just the ticket for mixed networks that contain all different kinds of PCs. And once it's set up client installations are lightning-fast.


FAI comes with an excellent manual, which is also installed to /usr/share/doc/fai/fai-guide.html. The /usr/share/doc/fai/ directory is full of scripts and configuration examples.
Wake on LAN mini HOWTO
Notes on problematic hardware.
Home page of PXE Linux, tftp-hpa, Syslinux, and much excellent netbooting information by the master of booting operating systems, H. Peter Anvin.
FAI Faq-O-Matic

Copyright © 1999 Corp. All Rights Reserved.