Use nfsroot for diskless clients

From FAIWiki
Revision as of 20:25, 6 April 2021 by Mrfai (talk | contribs)
Jump to navigation Jump to search

How to turn the FAI nfsroot into a file system for diskless clients

Someone asked me about using the FAI nfsroot for a diskless client setup. The clients should PXE boot and mount it's whole file system via NFS (NFS v3, v4 is not working with overlayfs) from the install server.

It's pretty easy. Tested with FAI 5.10.1 and Debian 11 (bullseye).

First add all packages you like to have for your diskless clients to /etc/fai/NFSROOT.

Create the FAI nfsroot

fai-make-nfsroot -v

The option -N will add nonfree firmware software (for e.g. for Wifi interfaces). Then disable some FAI specific things inside the nfsroot:

chroot /srv/fai/nfsroot bash
apt purge fai-nfsroot

This also works with XFCE and xorg running a graphical desktop.

That's it. Now, boot your client. Since FAI is using overlayfs, the whole filesystem is writeable for the client, even it's mounted read-only.

How to create a Live CD with Xfce desktop

You will have an account called demo, the pw is fai.

fai-make-nfsroot -v

chroot /srv/fai/nfsroot bash
apt purge fai-nfsroot
export LC_ALL=C
adduser --disabled-login --gecos "fai demo user" demo
usermod -p "$ROOTPW" demo

apt-get update
apt-get -y install at-spi2-core locales task-xfce-desktop network-manager systemd-sysv sysvinit-core-
apt-get clean

rm lib/systemd/system/wpa_supplicant@.service
# optional
# rm -f /etc/hosts /etc/resolv.conf* /var/lib/apt/lists/*_* /var/tmp/base.tar.xz

Then create the CD/USB ISO image using this command

fai-cd -HMJd '' -g ~/grub.cfg-live ~/fai-live.iso

See man page for more info.

Here's the

## grub2 configuration
set default="FAI live system"
set timeout=3

# make sure we can access partitions
insmod part_msdos
insmod part_gpt
insmod all_video
insmod gfxterm

set gfxmode=auto
set color_normal=white/black
set color_highlight=red/black
set menu_color_normal=white/black
set menu_color_highlight=black/yellow

menuentry "FAI live system" --unrestricted {
    search --set=root --file /FAI-CD
    linux   /boot/vmlinuz root=live:CDLABEL=FAI_CD
    initrd  /boot/initrd.img

This disk space for creating new files is limited by the amount of free space in the disk image (created inside fai-cd in subroutine calculate_required_size). You will have about 200MB of free disk space. This is NO persistent storage.

You can download an ISO image, for and example of this Live CD