Netbooting Debian 12 with NFS Root and No Root Access
In this article, we will discuss how to netboot Debian 12 using PXE and NFS root file system, with no root access. This method is useful for creating a diskless workstation or a thin client setup. We will cover the key concepts and provide detailed instructions to help you get started.
Prerequisites
Before we begin, make sure you have the following prerequisites:
- A Debian 12 installation media, such as a CD or ISO image.
- A network-enabled device, such as a workstation or a thin client, with PXE boot support.
- A server with NFS and TFTP servers installed and configured.
Setting up the NFS Root File System
The first step is to set up the NFS root file system on the server. This will serve as the root file system for the client device. Here are the steps to set up the NFS root file system:
- Create a directory to serve as the root file system. For example:
# mkdir /srv/nfsroot
- Mount the Debian installation media to a temporary directory. For example:
# mount -o loop /path/to/debian.iso /mnt
- Copy the root file system from the installation media to the NFS root directory. For example:
# rsync -aAXv /mnt/ /srv/nfsroot/
- Unmount the installation media.
# umount /mnt
- Configure the NFS server to export the NFS root file system. For example:
# echo "/srv/nfsroot *(rw,no_root_squash,no_subtree_check)" >> /etc/exports
- Restart the NFS server to apply the changes.
# systemctl restart nfs-kernel-server
Setting up the TFTP Server
The next step is to set up the TFTP server on the server. This will serve the PXE boot files to the client device. Here are the steps to set up the TFTP server:
- Install the TFTP server package. For example:
# apt-get install tftpd-hpa
- Create a directory to serve as the TFTP root directory. For example:
# mkdir /srv/tftp
- Copy the PXE boot files to the TFTP root directory. For example:
# cp /usr/lib/syslinux/pxelinux.0 /srv/tftp/
# cp /usr/lib/syslinux/menu.c32 /srv/tftp/
# cp /usr/lib/syslinux/ldlinux.c32 /srv/tftp/
- Create a configuration file for the PXE boot loader. For example:
# vi /srv/tftp/pxelinux.cfg/default
Add the following contents to the configuration file:
DEFAULT vmlinuz
PROMPT 0
TIMEOUT 30
ONTIMEOUT local
LABEL local
KERNEL vmlinuz
APPEND initrd=initrd.img root=/dev/nfs nfsroot=192.168.1.100:/srv/nfsroot ip=dhcp rw
- Restart the TFTP server to apply the changes.
# systemctl restart tftpd-hpa
Configuring the Client Device
The final step is to configure the client device to boot from the network and use the NFS root file system. Here are the steps to configure the client device:
- Restart the client device and press the appropriate key to enter the boot menu. For example, F12 on Dell workstations.
Select the network boot option.
- The client device should now load the PXE boot loader from the server. Select the "local" option from the menu.
The client device should now boot from the NFS root file system and start the Debian installation process.
In this article, we have discussed how to netboot Debian 12 using PXE and NFS root file system, with no root access. We have covered the key concepts and provided detailed instructions to help you get started. By following these steps, you can create a diskless workstation or a thin client setup.