FAI on Ubuntu 12.04

These notes are a work in progress and detail my installation of FAI (Fully Automatic Installation) on Ubuntu 12.04. I had some issues before realising I needed a 64bit client to install to (had PXE working then realised my client is 32bit only). This is worth noting as it’s most likely /VERY/ annoying to build a FAI server for a different architecture.

Also, be careful about doing this on an active network, as you can easily setup a rogue DHCP server which will make bad things happen.

Install the basic FAI packages:

apt-get install fai-quickstart

Add the following to /etc/exports:

/srv/fai/config (async,ro,no_subtree_check,no_root_squash)

Edit: /etc/fai/make-fai-nfsroot.conf

Change: FAI_DEBOOTSTRAP="squeeze http://cdn.debian.net/debian"
To    : FAI_DEBOOTSTRAP="precise http://gb.archive.ubuntu.com/ubuntu"

Do the initial debbootstrap, copy the sample dhcp server config into place.

sudo fai-setup
/etc/init.d/nfs-kernel-server reload
apt-get install isc-dhcp-server syslinux-common tftpd-hpa
cp /usr/share/doc/fai-doc/examples/etc/dhcpd.conf /etc/dhcp/dhcpd.conf

add hosts to /etc/dhcp/dhcpd.conf similar to the example line already present:

host demohost {hardware ethernet 0:2:a3:b5:c5:41;fixed-address demohost;}

or remove:

deny unknown-clients;

to allow all clients

add a range if required under the subnet line, e.g.:

range 192.168.1.1 192.168.1.50;

edit /etc/default/tftpd-hpa:

CHANGE: TFTP_DIRECTORY="/var/lib/tftpboot"
TO    : TFTP_DIRECTORY="/srv/tftp"

and/or add the following in /etc/init/tftpd-hpa.conf :

env TFTP_DIRECTORY="/srv/tftp"

Install demo configuration files (this may not be required):

cp -a /usr/share/doc/fai-doc/examples/simple/* /srv/fai/config

Set permissions on kernel correctly:

chmod o+r /srv/tftp/fai/vmlinuz-3.2.0-36-generic

Edit: /srv/fai/config/files/boot/grub/menu.lst/postinst

Comment out as follows:

#$ROOTCMD grub-install --no-floppy $(device2grub $BOOT_DEVICE)

Edit, /srv/fai/config/scripts/GRUB/10-setup replace the entire contents as follows:

#! /bin/bash

error=0 ; trap "error=$((error|1))" ERR

# Eventual source the disk_var.sh just in case 
# the BOOT_DEVICE/BOOT_PARTITION/ROOT_PARTITION 
# variables are overwritten
[ -r /tmp/fai/disk_var.sh ] && . /tmp/fai/disk_var.sh

ifclass NOMBR && BOOT_DEVICE=$BOOT_PARTITION

[ -z "$BOOT_DEVICE" ]    && exit 701
[ -z "$BOOT_PARTITION" ] && exit 702

# call grub-install from ubuntu
$target/usr/sbin/grub-install --no-floppy --root-directory=/$target $BOOT_DEVICE

# call update-grub inside ubuntu chroot with special "no user questions" flag
$ROOTCMD /usr/sbin/update-grub -y

exit $error

Create: /srv/tftp/fai/pxelinux.cfg/default with the following contents:
Note, this currently boots to fai then tries to connect to the nfs server.

       # Default boot option to use
       DEFAULT x64

       # Prompt user for selection
       PROMPT 0
       # Menu Configuration
       MENU WIDTH 80
       MENU MARGIN 10
       MENU PASSWORDMARGIN 3
       MENU ROWS 12
       MENU TABMSGROW 18
       MENU CMDLINEROW 18
       MENU ENDROW 24
       MENU PASSWORDROW 11
       MENU TIMEOUTROW 20
       MENU TITLE Main Menu
       # Menus
       LABEL x64
         MENU LABEL x64
         KERNEL vmlinuz-3.2.0-36-generic
         APPEND initrd=initrd.img-3.2.0-36-generic ip=dhcp root=/dev/nfs nfsroot=/srv/fai/nfsroot boot=live FAI_FLAGS=verbose,sshd,createvt FAI_ACTION=install FAI_CONFIG_SRC=nfs://192.168.1.100/srv/fai/config

This config installs an Ubuntu system for me, but there appear to be bootloader issues (hopefully resolved now, testing).