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:

1
apt-get install fai-quickstart

Add the following to /etc/exports:

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

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

1
2
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.

1
2
3
4
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:

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

or remove:

1
deny unknown-clients;

to allow all clients

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

1
range 192.168.1.1 192.168.1.50;

edit /etc/default/tftpd-hpa:

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

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

1
env TFTP_DIRECTORY="/srv/tftp"

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

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

Set permissions on kernel correctly:

1
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:

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

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#! /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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 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).

2 Comments

  1. Elb says:

    Hello Nava,

    Did you resolved your boot issue? I am having the same problem with my Ubuntu image.

    Thanks!

  2. Thomas Lange says:

    JFTR, the homepage of the FAI project is http://fai-project.org

Leave a Reply