Setting Up an Arch PXE Server (serving the root filesystem)
This guide is the follow-up to the previous post where we served the Arch Linux ISO directly over PXE. In this blog, we configure the PXE server to boot machines from a complete root filesystem created using pacstrap instead of the ISO image. This approach is more flexible for clusters, labs, or diskless compute nodes because each machine boots into a full Arch system that behaves like a normal installation.
1. Create the Root Filesystem
Create a folder where the new Arch root filesystem will live:
sudo mkdir -p /srv/rootfs
sudo pacstrap -K /srv/rootfs base linux linux-firmware mkinitcpio-nfs-utils vim openssh nfs-utils
mount --bind /srv/rootfs /srv/rootfsThis installs a minimal Arch Linux system plus NFS utilities, SSH, and Vim.
2. Configure the System Inside the Chroot
Chroot into the root filesystem to configure the system for PXE boot:
sudo arch-chroot /srv/rootfsSet the root password
passwdRemember this password.
Enable SSH Login
Generate host SSH keys and enable the SSH service:
ssh-keygen -A
systemctl disable sshdgenkeys.service
systemctl enable sshdExit chroot
exit3. Configure DHCP, TFTP and NFS as Before
But, instead of using the initramfs from the previous one, you need to generate one for nfs sharing the rootfs. Here you will know how can you generate a Initial Ramdisk with NFSv4 Support.
4. Configure PXE Bootloader
Edit the menu file at /srv/tftp/pxelinux.cfg/default:
DEFAULT linux
PROMPT 0
TIMEOUT 50
LABEL linux
MENU LABEL ^Arch Linux NFS RootFS
KERNEL vmlinuz-linux
INITRD initramfs-linux.img
APPEND root=/dev/nfs nfsroot=192.168.144.1:/srv/rootfs ip=dhcpThis tells the client to mount the NFS root filesystem instead of the ISO.
5. Start All Required Services
Bring up the PXE server interface and start DHCP, NFS, and TFTP:
sudo ip link set enp2s0 up
sudo ip addr add 192.168.144.1/24 dev enp2s0
sudo dhcpd -4 -cf /etc/dhcpd.conf enp2s0
sudo systemctl start tftpd
sudo exportfs -rav
sudo systemctl start nfs-serverYour PXE environment is now ready to boot real Arch installations over the network.
6. Boot the Compute Node
Power on the diskless compute node and select Network Boot (PXE). When the system boots, log in using:
- Username: root
- Password: the password you set inside the chroot
The node now runs a complete Arch Linux system over NFS, suitable for HPC clusters or diskless labs.