|
|
(30 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
| = How to turn the FAI nfsroot into a file system for diskless clients = | | = How to build a live ISO for running diskless clients = |
|
| |
|
| Someone asked me about using the FAI nfsroot for a diskless
| | Building a live ISO: |
| client setup. The clients should PXE boot and have /tmp and /var as
| |
| tmpfs (means writable).
| |
|
| |
|
| It's pretty easy. (Tested with FAI 4.1 and dracut 034-2 (wheezy) and with FAI 4.4~beta and dracut 40-1 (jessie)).
| | You can create a live ISO using two FAI commands. First, you need to |
| | | build your own live environment, containing all software including |
| First add all packages you like to have for your | | configuration that you like to use. Using the command "fai dirinstall" |
| diskless clients to /etc/fai/NFSROOT.
| | you do an installation using the FAI config space into a directory |
| | | which will become your live system. After that you create a bootable |
| Create the FAI nfsroot
| | ISO which includes this directory tree using fai-cd. |
| | |
| <code>fai-make-nfsroot -v</code>
| |
| | |
| Then disable some FAI specific things inside the nfsroot:
| |
|
| |
|
| <pre> | | <pre> |
| chroot /srv/fai/nfsroot bash
| | Define the FAI classes: |
| rm -f /etc/init.d/rcS
| |
| dpkg-divert --package fai-nfsroot --remove --rename /etc/init.d/rcS
| |
| insserv -r fai-abort
| |
| exit
| |
| </pre>
| |
| | |
| This also works with XFCE and xorg running a graphical desktop.
| |
| | |
|
| |
|
| That's it. Now, boot your client.
| | cl="DEBIAN,BOOKWORM64,AMD64,FAIBASE,XFCE,XORG,DHCPC,DEMO,LIVEISO,LAST" |
| Since FAI is using aufs (advanced multi layered unification filesystem version 3.x), the whole filesystem is writeable for the client, even it's mounted read-only.
| |
|
| |
|
| | Build the live environment directory tree: |
|
| |
|
| | # LC_ALL=C fai -v dirinstall -u xfce33 -c $cl -s file:///srv/fai/config /srv/xfce |
|
| |
|
| == How to create a Live CD with Xfce desktop ==
| | Then create the live ISO: |
|
| |
|
| This is tested with FAI 5.0.3, Debian 8.0 (Jessie) and dracut
| | # fai-cd -s500 -MH -d none -g /etc/fai/grub.cfg.live -n /srv/xfce live.iso |
| 044+3-3. You will have an account called demo, the pw is fai.
| |
| Just confirmed that this is also working using FAI 5.3.6 with Debian 9 (stretch) and dracut 044+241-3
| |
| | |
| | |
| <pre>
| |
| fai-make-nfsroot -v
| |
| | |
| chroot /srv/fai/nfsroot bash
| |
| rm -f /etc/init.d/rcS
| |
| dpkg-divert --package fai-nfsroot --remove --rename /etc/init.d/rcS
| |
| insserv -r fai-abort
| |
| export LC_ALL=C
| |
| adduser --disabled-login --gecos "fai demo user" demo
| |
| ROOTPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1'
| |
| usermod -p "$ROOTPW" demo
| |
| | |
| apt-cache dumpavail > /var/lib/dpkg/available
| |
| aptitude -y install at-spi2-core locales lightdm xfce4 xterm xorg xserver-xorg-video-all xserver-xorg-input-all systemd-sysv sysvinit-core-
| |
| apt-get clean
| |
| | |
| # optional
| |
| # rm -f /etc/hosts /etc/resolv.conf* /etc/fai/fai.conf /var/lib/apt/lists/*_* /var/tmp/base.tar.xz
| |
| exit
| |
| </pre> | | </pre> |
|
| |
|
| Then create the CD/USB ISO image using this command
| | That's it. Now, boot your client. |
|
| |
|
| <pre>
| |
| fai-cd -MJd '' -g ~/grub.cfg-diskless ~/fai-diskless.iso
| |
| </pre>
| |
|
| |
| Adding -H to fai-cd will add some directories onto the CD, that are normally
| |
| excluded. Using FAI 5.3.6, this can only be used if you reduce this
| |
| value in fai-cd, which leads to a bigger disk image. Otherwise there
| |
| will be a no space on device error.
| |
|
| |
| <pre>
| |
| < count=$(($size/900))
| |
| ---
| |
| > count=$(($size/800))
| |
| </pre>
| |
|
| |
|
| |
|
| |
| Here's the grub.cfg.diskless:
| |
| <pre>
| |
| ## grub2 configuration
| |
| set default="FAI diskless client"
| |
| set timeout=3
| |
| set resolution=1024x768
| |
|
| |
|
| if loadfont /boot/grub/ascii.pf2 ; then
| | Hint: The FAI nfsroot is not needed when building a live ISO. |
| insmod png
| |
| set gfxmode=640x480
| |
| insmod gfxterm
| |
| insmod vbe
| |
| terminal_output gfxterm
| |
| fi
| |
| | |
| # make sure we can access partitions
| |
| insmod part_msdos
| |
| insmod part_gpt
| |
| | |
| if [ ${iso_path} ] ; then
| |
| set loopback="findiso=${iso_path}"
| |
| fi
| |
| | |
| menuentry "FAI diskless client" --unrestricted {
| |
| set gfxpayload=$resolution
| |
| linux /boot/vmlinuz rd.live.image root=live:CDLABEL=FAI_CD
| |
| initrd /boot/initrd.img
| |
| }
| |
| </pre>
| |
|
| |
|
|
| |
|
| This disk space for creating new files is limited by the amount of
| | '''Tip for beginners''': Using the FAIme web service https://fai-project.org/FAIme/live/ you can create your own customized live ISO without setting up an FAI server. |
| 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.
| |
|
| |
|
|
| |
|
| After booting the machine, you must enable the network interface, for
| | You can download an ISO image, for and example of this Live CD |
| e.g. dhclient -v ens3.
| | https://fai-project.org/fai-cd/debian12-live-xfce.iso |
How to build a live ISO for running diskless clients
Building a live ISO:
You can create a live ISO using two FAI commands. First, you need to
build your own live environment, containing all software including
configuration that you like to use. Using the command "fai dirinstall"
you do an installation using the FAI config space into a directory
which will become your live system. After that you create a bootable
ISO which includes this directory tree using fai-cd.
Define the FAI classes:
cl="DEBIAN,BOOKWORM64,AMD64,FAIBASE,XFCE,XORG,DHCPC,DEMO,LIVEISO,LAST"
Build the live environment directory tree:
# LC_ALL=C fai -v dirinstall -u xfce33 -c $cl -s file:///srv/fai/config /srv/xfce
Then create the live ISO:
# fai-cd -s500 -MH -d none -g /etc/fai/grub.cfg.live -n /srv/xfce live.iso
That's it. Now, boot your client.
Hint: The FAI nfsroot is not needed when building a live ISO.
Tip for beginners: Using the FAIme web service https://fai-project.org/FAIme/live/ you can create your own customized live ISO without setting up an FAI server.
You can download an ISO image, for and example of this Live CD
https://fai-project.org/fai-cd/debian12-live-xfce.iso