PXE network booting


About

The PXE environment allows you to boot a computer with SystemRescueCd even if this computer has no CDRom drive or USB socket. It allows you to boot SystemRescueCd from the network, and then it is faster to troubleshoot computers on your network once a PXE-boot-server is installed. It is also useful if you want to boot a computer that has no optical drive (CD or DVD) or to troubleshoot a remote computer to which you have no physical access to insert the disc.

Requirements

  • Servers to provide PXE services including DHCP with SystemRescueCd files available to serve clients requests
  • A client computer with a PXE able network card on the same network and enough memory to fully store SystemRescueCd files

How the PXE boot process works

The PXE boot server

The PXE boot server is made of three stages:

  • stage1: the DHCP server sends an IP address to the client with extra info such as the address of the TFTP server
  • stage2: the TFTP server sends the first boot files (boot loader and kernel image and sysresccd.img) to the client
  • stage3: the HTTP or TFTP or NFS or NBD server sends the squashfs root filesystem image to the client.

These three parts can be installed either on a single machine or on several computers.

The PXE boot process

You may need to understand what happens when you boot SystemRescueCd from the network. You will need this knowledge for troubleshooting in case of problems. Here are the most important steps of the PXE boot process:

  • When the client computer tries to boot with PXE, it first emits a DHCP request on the network to get an IP address.
  • Then a DHCP server replies with a DHCP offer that contains a new IP address that was not already allocated and some specific options (DNS, default route) and the IP address of the TFTP server
  • The client receives this DHCP offer and accepts it. It connects to the TFTP server (it received its IP address in the previous stage) to get the boot loader files.
  • The TFTP server sends the boot loader files (pxelinux) and the text files displayed on the screen by pxelinux.
  • The client displays the pxelinux prompt, and the user can choose the boot options. It then requests from the TFTP server the kernel and initramfs files necessary to boot the system
  • The TFTP server sends the kernel and initramfs files (eg: vmlinuz + sysresccd.img) to the client
  • The client boots this kernel and executes the init programs that come with the initramfs.
  • During its initialization the kernel makes a DHCP request again because of the ip=dhcp kernel boot parameters. Indeed the kernel does not know the IP address used by the computer at the pxelinux stage.
  • The client needs the airootfs.sfs file. If you use HTTP or TFTP for the third stage, then airootfs.sfs will be downloaded into RAM so the client has to have enough memory (estimated requirement: 1GB). If you use either NFS or NBD then you don’t have this memory requirement and the client will make permanent requests to the server each time it needs a file from the root filesystem.
  • The client mounts airootfs.sfs and it can now complete the boot process.
  • At this stage the client holds all the files in memory, if you used TFTP/HTTP for the third stage, so it does not require a boot server any more. If you are using NFS or NBD, the connection is still required.

Customization of the boot command line

The PXE server is made of several services. In the second stage, the server uses TFTP to send multiple things to the client: boot loader (pxelinux.0), kernel image (vmlinuz), initramfs (sysresccd.img). The boot loader is pxelinux.0 and it comes with a configuration file which is sent to the client. This configuration file contains the boot command line which will be used by the client to start the linux kernel. This command line is important since it contains the SystemRescueCd boot options that are required to run the third stage. The boot command line can be used to specify the network settings and the method that the PXE client will use in the third stage of the PXE boot process. Here are two examples of valid command lines for PXE boot:

PXE boot options supported by SystemRescueCd

SystemRescueCd-6.x is based on ArchLinux hence it supports PXE boot options implemented by the upstream. These boot options provide support for various protocols (HTTP, NFS, NBD) and are documented on the following page: https://git.archlinux.org/archiso.git/tree/docs

Example of a PXE configuration to boot SystemRescueCd-6.x using TFTP and HTTP

Here is an example of a PXE configuration which allows to boot SystemRescueCd using TFTP and HTTP only. It is one of the simplest PXE configuration you can have hence it is recommended to follow this example if you want a simple PXE configuration for SystemRescueCd.

In this example the boot loader is pxelinux.0 and TFTP is used to get the kernel image and initramfs images. It then uses an HTTP server to download the large squashfs filesystem airootfs.sfs.

When you configure the TFTP server you have to copy the boot loader (pxelinux binary files), a pxelinux configuration file in pxelinux.cfg/default, and you need to copy the sysresccd directory as it is (even though not all files are required by the TFTP server) from the ISO image to provide files that will be requested via TFTP.

Here is the list of all required files and their location on the TFTP server:

./sysresccd/boot/x86_64/vmlinuz
./sysresccd/boot/x86_64/sysresccd.img
./sysresccd/boot/memtest.COPYING
./sysresccd/boot/memtest
./sysresccd/boot/intel_ucode.LICENSE
./sysresccd/boot/intel_ucode.img
./sysresccd/boot/amd_ucode.LICENSE
./sysresccd/boot/amd_ucode.img
./sysresccd/VERSION
./sysresccd/pkglist.x86_64.txt
./pxelinux.cfg/default
./ldlinux.c32
./pxelinux.0

And here is the example of a configuration located in pxelinux.cfg/default:

DEFAULT sysresccd
LABEL sysresccd
  LINUX sysresccd/boot/x86_64/vmlinuz
  INITRD sysresccd/boot/intel_ucode.img,sysresccd/boot/amd_ucode.img,sysresccd/boot/x86_64/sysresccd.img
  APPEND archisobasedir=sysresccd archiso_http_srv=http://10.0.2.4/ checksum
  SYSAPPEND 1

You need to update the IP address of the HTTP server from which the squashfs image will be downloaded. In this example it will download this file and its checksum from the following URLs:

http://10.0.2.4/sysresccd/x86_64/airootfs.sfs
http://10.0.2.4/sysresccd/x86_64/airootfs.sha512

Make sure you are able to successfully download these files from a regular web client before you try to boot from PXE. You can customize the boot command line by adding options such as setkmap=us after the checksum option.


Documentation
Manual (EN)
LVM Guide
Disk partitioning
Networking

Project
Git repository
Bug reports