Chapter 14. Setting up a remote diskless system In a network environment, you can setup multiple clients with the identical configuration by deploying a remote diskless system. By using current Red Hat Enterprise Linux server version, you can save the cost of hard drives for these clients as well as configure the gateway on a separate server. The following diagram describes the connection of a diskless client with the server through Dynamic Host Configuration Protocol (DHCP) and Trivial File Transfer Protocol (TFTP) services. Figure 14.1. Remote diskless system settings diagram 14.1. Preparing environments for the remote diskless system Prepare your environment to continue with remote diskless system implementation. The remote diskless system booting requires the following services: Trivial File Transfer Protocol (TFTP) service, which is provided by tftp-server. The system uses the tftp service to retrieve the kernel image and the initial RAM disk, initrd, over the network, through the Preboot Execution Environment (PXE) loader. Dynamic Host Configuration Protocol (DHCP) service, which is provided by dhcp. Prerequisites You have set up your network connection. Procedure Install the dracut-network package: Add the following line to the /etc/dracut.conf.d/network.conf file: Ensure correct functionality of the remote diskless system in your environment by configuring services in the following order: Configure a TFTP service. For more information, see Configuring a TFTP service for diskless clients . Configure a DHCP server. For more information, see Configuring a DHCP server for diskless clients . Configure the Network File System (NFS) and an exported file system. For more information, see Configuring an exported file system for diskless clients . 14.2. Configuring a TFTP service for diskless clients For the remote diskless system to function correctly in your environment, you need to first configure a Trivial File Transfer Protocol (TFTP) service for diskless clients. Note This configuration does not boot over the Unified Extensible Firmware Interface (UEFI). For UEFI based installation, see Configuring a TFTP server for UEFI-based clients . Prerequisites You have installed the following packages: tftp-server syslinux Procedure Enable the tftp service: Create a pxelinux directory in the tftp root directory: Copy the /usr/share/syslinux/pxelinux.0 file to the /var/lib/tftpboot/pxelinux/ directory: Copy /usr/share/syslinux/ldlinux.c32 to /var/lib/tftpboot/pxelinux/ : Create a pxelinux.cfg directory in the tftp root directory: Verification Check status of service tftp : 14.3. Configuring a DHCP server for diskless clients The remote diskless system requires several pre-installed services to enable correct functionality. Prerequisites Install the Trivial File Transfer Protocol (TFTP) service. You have installed the following package: dhcp-server You have configured the tftp service for diskless clients. For more information, see Configuring a TFTP service for diskless clients . Procedure Add the following configuration to the /etc/dhcp/dhcpd.conf file to setup a DHCP server and enable Preboot Execution Environment (PXE) for booting: Your DHCP configuration might be different depending on your environment, like setting lease time or fixed address. For details, see Providing DHCP services . Note While using libvirt virtual machine as a diskless client, the libvirt daemon provides the DHCP service, and the standalone DHCP server is not used. In this situation, network booting must be enabled with the bootp file=<filename> option in the libvirt network configuration, virsh net-edit . Enable dhcpd.service : Verification Check the status of service dhcpd.service : 14.4. Configuring an exported file system for diskless clients As a part of configuring a remote diskless system in your environment, you must configure an exported file system for diskless clients. Prerequisites You have configured the tftp service for diskless clients. See section Configuring a TFTP service for diskless clients . You have configured the Dynamic Host Configuration Protocol (DHCP) server. See section Configuring a DHCP server for diskless clients . Procedure Configure the Network File System (NFS) server to export the root directory by adding it to the /etc/exports directory. For the complete set of instructions see Deploying an NFS server Install a complete version of Red Hat Enterprise Linux to the root directory to accommodate completely diskless clients. To do that you can either install a new base system or clone an existing installation. Install Red Hat Enterprise Linux to the exported location by replacing exported-root-directory with the path to the exported file system: By setting the releasever option to / , releasever is detected from the host ( / ) system. Use the rsync utility to synchronize with a running system: Replace example.com with the hostname of the running system with which to synchronize via the rsync utility. Replace exported-root-directory with the path to the exported file system. Note, that for this option you must have a separate existing running system, which you will clone to the server by the command above. Configure the file system, which is ready for export, before you can use it with diskless clients: Copy the diskless client supported kernel ( vmlinuz-_kernel-version_pass:attributes ) to the tftp boot directory: Create the initramfs- kernel-version .img file locally and move it to the exported root directory with NFS support: For example: Example for creating initrd, using current running kernel version, and overwriting existing image: Change the file permissions for initrd to 0644 : Warning If you do not change the initrd file permissions, the pxelinux.0 boot loader fails with a "file not found" error. Copy the resulting initramfs- kernel-version .img file into the tftp boot directory: Add the following configuration in the /var/lib/tftpboot/pxelinux/pxelinux.cfg/default file to edit the default boot configuration for using the initrd and the kernel: This configuration instructs the diskless client root to mount the /exported-root-directory exported file system in a read/write format. Optional: Mount the file system in a read-only` format by editing the /var/lib/tftpboot/pxelinux/pxelinux.cfg/default file with the following configuration: Restart the NFS server: You can now export the NFS share to diskless clients. These clients can boot over the network via Preboot Execution Environment (PXE). 14.5. Re-configuring a remote diskless system If you want to install packages, restart services, or debug the issues, you can reconfigure the system. Prerequisites You have enabled the no_root_squash option in the exported file system. Procedure Change the user password: Change the command line to /exported/root/directory : Change the password for the user you want: Replace the <username> with a real user for whom you want to change the password. Exit the command line. Install software on a remote diskless system: Replace <package> with the actual package you want to install. Configure two separate exports to split a remote diskless system into a /usr and a /var . For more information, see Deploying an NFS server . 14.6. Troubleshooting common issues with loading a remote diskless system Based on the earlier configuration, some issues can occur while loading the remote diskless system. Following are some examples of the most common issues and ways to troubleshoot them on a Red Hat Enterprise Linux server. Example 14.1. The client does not get an IP address Check if the Dynamic Host Configuration Protocol (DHCP) service is enabled on the server. Check if the dhcp.service is running: If the dhcp.service is inactive, enable and start it: Reboot the diskless client. Check the DHCP configuration file /etc/dhcp/dhcpd.conf . For details, see Configuring a DHCP server for diskless clients . Check if the Firewall ports are opened. Check if the dhcp.service is listed in active services: If the dhcp.service is not listed in active services, add it to the list: Check if the nfs.service is listed in active services: If the nfs.service is not listed in active services, add it to the list: Example 14.2. The file is not available during the booting a remote diskless system Check if the file is in the /var/lib/tftpboot/ directory. If the file is in the directory, ensure if it has the following permissions: Check if the Firewall ports are opened. Example 14.3. System boot failed after loading kernel / initrd Check if the NFS service is enabled on a server. Check if nfs.service is running: If the nfs.service is inactive, you must start and enable it: Check if the parameters are correct in the /var/lib/tftpboot/pxelinux.cfg/ directory. For details, see Configuring an exported file system for diskless clients . Check if the Firewall ports are opened.

Commands:
dnf install dracut-network
add_dracutmodules+=" nfs "
systemctl enable --now tftp
mkdir -p /var/lib/tftpboot/pxelinux/
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/pxelinux/
cp /usr/share/syslinux/ldlinux.c32 /var/lib/tftpboot/pxelinux/
mkdir -p /var/lib/tftpboot/pxelinux/pxelinux.cfg/
systemctl status tftp Active: active (running)
option space pxelinux; option pxelinux.magic code 208 = string; option pxelinux.configfile code 209 = text; option pxelinux.pathprefix code 210 = text; option pxelinux.reboottime code 211 = unsigned integer 32; option architecture-type code 93 = unsigned integer 16; subnet 192.168.205.0 netmask 255.255.255.0 { option routers 192.168.205.1; range 192.168.205.10 192.168.205.25; class "pxeclients" { match if substring (option vendor-class-identifier, 0, 9) = "PXEClient"; next-server 192.168.205.1; if option architecture-type = 00:07 { filename "BOOTX64.efi"; } else { filename "pxelinux/pxelinux.0"; } } }
systemctl enable --now dhcpd.service
systemctl status dhcpd.service Active: active (running)
dnf install @Base kernel dracut-network nfs-utils --installroot= exported-root-directory --releasever=/
rsync -a -e ssh --exclude='/proc/' --exclude='/sys/' example.com :/ exported-root-directory
cp / exported-root-directory /boot/vmlinuz-kernel-version /var/lib/tftpboot/pxelinux/
dracut --add nfs initramfs-kernel-version.img kernel-version
dracut --add nfs /exports/root/boot/initramfs-5.14.0-202.el9.x86_64.img 5.14.0-202.el9.x86_64
dracut -f --add nfs "boot/initramfs-USD(uname -r).img" "USD(uname -r)"
chmod 0644 / exported-root-directory /boot/initramfs- kernel-version .img
cp / exported-root-directory /boot/initramfs- kernel-version .img /var/lib/tftpboot/pxelinux/
default rhel9 label rhel9 kernel vmlinuz- kernel-version append initrd=initramfs- kernel-version .img root=nfs:_server-ip_:/ exported-root-directory rw
default rhel9 label rhel9 kernel vmlinuz- kernel-version append initrd=initramfs- kernel-version .img root=nfs: server-ip :/ exported-root-directory ro
systemctl restart nfs-server.service
chroot /exported/root/directory /bin/bash
passwd <username>
dnf install <package> --installroot= /exported/root/directory --releasever=/ --config /etc/dnf/dnf.conf --setopt=reposdir=/etc/yum.repos.d/
systemctl status dhcpd.service
systemctl enable dhcpd.service systemctl start dhcpd.service
firewall-cmd --get-active-zones firewall-cmd --info-zone=public
firewall-cmd --add-service=dhcp --permanent
firewall-cmd --get-active-zones firewall-cmd --info-zone=public
firewall-cmd --add-service=nfs --permanent
chmod 644 pxelinux.0
systemctl status nfs.service
systemctl start nfs.service systemctl enable nfs.service