Debian Fully Automatic Installation with FAI
Fully Automatic Installation (FAI) is an automated system deployment tool engineered to install, configure, and manage Debian systems unattended. By combining standard network booting mechanisms, declarative configuration files, and a modular class-based system, FAI provisions bare-metal servers, virtual machines, and cloud instances without human intervention. This article examines the core architecture, installation workflow, and mechanisms that allow FAI to deliver consistent and scalable Debian deployments.
Network Booting and the Install Environment
FAI initiates installations over the local network using standard infrastructure services:
- DHCP: The target machine boots using PXE (Preboot Execution Environment) and queries the local DHCP server for an IP address and the network boot file location.
- TFTP: The client downloads the Linux kernel and an initial RAM filesystem (initrd) from a TFTP server.
- NFS Root (nfsroot): Once the kernel boots, it
mounts a minimal Debian environment (the
nfsroot) exported by the FAI install server. This read-only environment contains all necessary utilities, such as partitioning tools, hardware detection modules, and the FAI runtime engine.
The Class-Based Configuration System
The defining feature of FAI is its class-based approach to configuration. Instead of requiring a distinct profile for every unique machine, FAI assigns dynamic classes to each host to dictate its role, storage layout, software selection, and network configuration.
- Class Definition: Classes are defined centrally on
the FAI server within the configuration space
(
/srv/fai/config). Classes can be assigned statically based on hostnames or MAC addresses, or dynamically via discovery scripts (e.g., assigning a64BITclass viauname -m, or aVIRTUALclass if hypervisor flags are detected). - Inheritance and Ordering: Multiple classes combine
to build a complete profile. For instance, a system might inherit
classes such as
DEFAULT,DEBIAN,WEBSERVER, andHOST_WEB01. Settings in more specific classes override generic defaults.
The Installation Execution Phases
Once the client boots into the installation environment, FAI executes a sequence of standardized operational tasks:
1. Hardware Detection and Storage Setup
FAI utilizes the setup-storage tool to automatically
prepare block devices. The tool parses declarative disk configuration
files mapped to the system's active classes. It automatically
handles:
- Partition tables (MBR and GPT)
- Software RAID arrays (mdadm)
- Logical Volume Management (LVM)
- Disk encryption (LUKS)
- Filesystem creation (ext4, XFS, Btrfs)
2. Base System Bootstrapping
FAI builds the core Debian operating system on the newly formatted
target partitions using debootstrap. This creates a clean,
minimal root directory structure matching the designated Debian release
(such as Debian Bookworm or Bullseye) directly from an official or local
APT mirror.
3. Software Package Installation
Software installation is controlled through package configuration
lists found in the package_config directory. FAI evaluates
the host's classes and determines which packages to install or remove
via apt-get. Administrators can specify package groups,
specific versions, kernels, and backports, allowing both minimal base
systems and fully loaded application servers to be generated from the
same setup.
4. System Configuration and Customization
After packages are installed, FAI executes custom configuration tasks. FAI provides native tools to automate:
- Debconf Preseeding: Applying non-interactive debconf answers to configure packages silently during installation.
- File Copying (
fcopy): Deploying class-specific configuration files (such as/etc/network/interfacesor/etc/ssh/sshd_config) to the target filesystem with preserved ownership and permissions. - Hook and Script Execution: Running shell, Perl, or Python scripts to execute specialized logic, register the host with configuration management tools (like Ansible, Puppet, or Salt), or create local users.
5. Bootloader Installation and Finalization
In the final step, FAI installs and configures the bootloader (typically GRUB) into the target storage drive's master boot record or EFI system partition. Once the bootloader is written, the temporary filesystems are unmounted, and the system reboots directly into the newly installed, fully operational Debian operating system.