27.5. Network Boot and Provisioning with PXE and iPXE
With preseed and cloud-init inputs prepared, the remaining question is how a bare machine reaches them without a person holding a USB stick. The answer is PXE - the Preboot eXecution Environment that every wired network card's firmware speaks - wrapped around a small production line: DHCP hands out a boot loader's name, TFTP delivers that loader, and HTTP delivers everything big. This section builds that line on auto1 and verifies each link of it from auto2, using the isolated network of Figure 27.1.
27.5.1. Boot Flow, Firmware Architectures, DHCP Options, TFTP, and HTTP
A network boot is a chain of four fetches, and each link names its
failure mode. The firmware's PXE stack starts by DHCP-ing like any
client, but it adds option 93 (client system architecture - the value
that says "I am a legacy BIOS PXE client" or "I am a 64-bit UEFI
client") and asks two extra things back: option 66 (next-server, the
TFTP server's address) and option 67 (filename, the loader to
fetch). The firmware then downloads that loader over TFTP - a simple
UDP protocol with tiny block sizes, fine for a 100 KB loader, painful
for a 12 MB installer kernel. That is why this design chains iPXE: a
modern, scriptable network boot loader whose first act is to run DHCP
again, this time advertising itself through option 77 (user class)
so the server can answer "you already have iPXE - here is an HTTP URL
instead of a file name". iPXE fetches a boot menu over HTTP, and from
that point every artifact - menu, kernel, initrd, preseed - rides
HTTP's larger blocks and real error reporting.
Figure 27.4. The two-stage boot chain. Stage one serves a TFTP loader chosen by architecture; iPXE's stage-two DHCP exchange, marked by its user class, returns an HTTP menu URL. A direct path using Debian's signed loaders avoids the iPXE stage for Secure Boot hosts (Section 27.5.5).
The loaders that appear in this design, and what each one is for:
| Loader file | Loaded by | Role in the chain |
|---|---|---|
undionly.kpxe |
BIOS PXE firmware | iPXE for legacy BIOS: tiny UNDI stub that becomes full iPXE. |
ipxe.efi |
UEFI firmware (via TFTP) | iPXE for 64-bit UEFI, stock Debian build. |
pxelinux.0 |
BIOS PXE firmware | Classic SYSLINUX PXE loader; the alternative to the iPXE chain. |
bootnetx64.efi |
UEFI firmware (via TFTP or HTTP) | d-i's own GRUB-based UEFI loader, signed by Microsoft's UEFI CA. |
grubx64.efi |
UEFI firmware or shim | Same GRUB loader, signed by Debian's Secure Boot CA. |
Serving the boot file names is a DHCP server decision, and Debian 13
offers three realistic candidates. The pipeline drops the
installed-version detail apt-cache policy also prints and keeps the
package names and candidate versions:
$ apt-cache policy isc-dhcp-server kea-dhcp4-server dnsmasq | grep -E '^(isc-dhcp-server|kea-dhcp4-server|dnsmasq):| Candidate:'
isc-dhcp-server:
Candidate: 4.4.3-P1-8
kea-dhcp4-server:
Candidate: 2.6.3-1+deb13u1
dnsmasq:
Candidate: 2.91-1+deb13u2
| Server | Lease storage and configuration | Fit for PXE provisioning |
|---|---|---|
isc-dhcp-server 4.4.3 |
classic dhcpd.conf, leases in a flat file |
The classic next-server/filename conditionals this chapter uses; long-frozen but well-understood code. |
kea-dhcp4-server 2.6.3 |
JSON configuration, memfile or SQL leases, HA hooks | ISC's maintained successor; boot-file selection uses client classification (Chapter 22 operates it in depth). |
dnsmasq 2.91 |
single config combining DNS and DHCP | Small networks; dhcp-boot with architecture tags serves PXE too. |
This chapter uses ISC DHCP because its conditional filename
selection reads as documentation - architecture and user class decide
the file - and because the isolated network contains its
limitations. A production deployment that already runs Kea should add
boot-file classification to the existing server rather than run two
DHCP services; the concepts (options 66/67/93/77) transfer unchanged.
27.5.2. Serving Debian Installer Boot Files and Selecting BIOS or UEFI Loaders
Install the provisioning stack on auto1: the DHCP server, the TFTP daemon, nginx to serve HTTP, and the loader packages:
$ sudo apt install isc-dhcp-server tftpd-hpa nginx-light pxelinux ipxe
Reading package lists...
Building dependency tree...
Reading state information...
isc-dhcp-server is already the newest version (4.4.3-P1-8).
tftpd-hpa is already the newest version (5.2+20240610-3).
nginx-light is already the newest version (1.26.3-3+deb13u11).
pxelinux is already the newest version (3:6.04~git20190206.bf6db5b4+dfsg1-3.1).
ipxe is already the newest version (1.21.1+git20250501.dad20602+dfsg-1).
Summary:
Upgrading: 0, Installing: 0, Removing: 0, Not Upgrading: 66
Debian publishes the installer's network-boot files as one archive
under the trixie distribution tree. Fetch it - curl is used
throughout this section, so its options once:
curl option |
Description |
|---|---|
-f |
Fail on HTTP errors instead of saving the error page. |
-s |
Silent; suppress the progress meter. |
-S |
Still show errors (useful with -s). |
-L |
Follow redirects. |
-o FILE |
Write the response to FILE. |
-I |
Fetch headers only (used for reachability checks). |
$ sudo curl -fsSL https://deb.debian.org/debian/dists/trixie/main/installer-amd64/current/images/netboot/netboot.tar.gz -o /srv/netboot.tar.gz
The download is silent on success. Verify the archive against Debian's published SHA-256 list - fetched over TLS from the same mirror, which is what makes the comparison meaningful:
$ curl -fsSL https://deb.debian.org/debian/dists/trixie/main/installer-amd64/current/images/SHA256SUMS | grep 'netboot/netboot.tar.gz'
d458e18257374a123a507c20b64d1f4706cd2a4495401a140b9c4407925c7796 ./netboot/netboot.tar.gz
$ sudo sha256sum /srv/netboot.tar.gz
d458e18257374a123a507c20b64d1f4706cd2a4495401a140b9c4407925c7796 /srv/netboot.tar.gz
The digests match. The current directory follows installer updates,
so this exact value is the digest at the time of writing - what stays
constant is the procedure: fetch the list from the mirror over TLS,
compare, and only then serve the files. Unpack the archive into the
TFTP root (create /srv/tftp first with sudo install -d /srv/tftp):
$ sudo tar -xzf /srv/netboot.tar.gz -C /srv/tftp
Extraction is silent. The archive unpacks into
/srv/tftp/debian-installer/amd64/ with the complete boot set: the
installer linux kernel and initrd.gz, the signed UEFI loaders
bootnetx64.efi and grubx64.efi (Section 27.5.5 inspects their
signatures), and a complete classic PXELINUX setup - pxelinux.0,
pxelinux.cfg/default, and the boot-screens/ menu files - usable
by pointing option 67 at debian-installer/amd64/pxelinux.0 directly.
Add the Debian-packaged iPXE loaders at the TFTP root so the short
names this design serves resolve without a path:
$ sudo install -m 0644 /usr/lib/ipxe/undionly.kpxe /usr/lib/ipxe/ipxe.efi /usr/lib/PXELINUX/pxelinux.0 /srv/tftp/
After this step /srv/tftp holds the loader files at its root -
undionly.kpxe and ipxe.efi from the ipxe package, the extra
pxelinux.0 from the pxelinux package - plus the
debian-installer/ tree. The BIOS/UEFI split is now a DHCP answer,
not a guess: option 93 in the client's DISCOVER tells the server which
file name to return, and the next subsection's dhcpd.conf encodes
exactly the branch of Figure 27.4.
27.5.3. Chainloading iPXE and Maintaining HTTP Boot Menus
iPXE does not ship a menu; you write one, in its small script language.
Here is the menu, provisioning/menu.ipxe:
#!ipxe
:start
menu Debian 13 provisioning
item --gap -- ------------------------------------------------
item install Debian 13 automated installation
item shell iPXE shell
item reboot Reboot this computer
choose --default install --timeout 10000 target && goto ${target}
:install
kernel http://192.168.227.10/debian-installer/amd64/linux initrd=initrd.gz auto=true priority=critical preseed/url=http://192.168.227.10/preseed/handbook.cfg ---
initrd http://192.168.227.10/debian-installer/amd64/initrd.gz
boot
:shell
shell
:reboot
reboot
The menu block presents three entries; choose waits ten seconds
(--timeout 10000, in milliseconds) and then takes the default,
install. That single timeout is the difference between an
interactive rescue network and an unattended production line: an
operator who presses a key gets the menu, a machine nobody is watching
installs itself. The kernel line is the heart of the chapter's
provisioning: it names the installer kernel over HTTP, passes
initrd=initrd.gz, and adds the two parameters that make the install
unattended - auto=true priority=critical suppress every question
that has a preseed answer or a packaged default - plus
preseed/url= pointing at the file built in Section 27.4.1. The
trailing --- separates installer parameters from anything a kernel
might otherwise swallow.
nginx serves the menu, the installer files, and the preseed. Here is
the site, provisioning/nginx-pxe.conf:
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /srv/http;
index index.html;
location /ipxe/ {
try_files $uri =404;
}
location /debian-installer/ {
alias /srv/tftp/debian-installer/;
}
location /preseed/ {
allow 192.168.227.0/24;
deny all;
try_files $uri =404;
}
}
Three locations with three different jobs: /ipxe/ serves the menu
from /srv/http; /debian-installer/ aliases into the TFTP tree,
so the kernel and initrd are served by HTTP without a second copy on
disk; /preseed/ is restricted to the provisioning subnet - the
allow/deny pair whose effect Section 27.5.6 demonstrates. Create the
HTTP directories the menu and the preseed will land in:
$ sudo install -d /srv/http/ipxe /srv/http/preseed
The command is silent. Install the menu and the preseed:
$ sudo install -m 0644 provisioning/menu.ipxe /srv/http/ipxe/menu.ipxe
$ sudo install -m 0644 preseed/handbook.cfg /srv/http/preseed/handbook.cfg
Both are silent. Now the DHCP server's configuration,
provisioning/dhcpd.conf:
option arch code 93 = unsigned integer 16;
default-lease-time 600;
max-lease-time 7200;
authoritative;
subnet 192.168.227.0 netmask 255.255.255.0 {
range 192.168.227.100 192.168.227.199;
option routers 192.168.227.10;
option domain-name "automation.lab";
option domain-name-servers 192.168.227.10;
next-server 192.168.227.10;
if exists user-class and substring(option user-class, 1, 4) = "iPXE" {
filename "http://192.168.227.10/ipxe/menu.ipxe";
} elsif option arch = 00:07 or option arch = 00:09 {
filename "ipxe.efi";
} else {
filename "undionly.kpxe";
}
}
Read the conditional from the client's perspective. A first-boot
firmware gets undionly.kpxe (legacy BIOS) or ipxe.efi (option 93
values 00:07 and 00:09, the 64-bit UEFI architectures). That loader
becomes iPXE, which DHCPs again announcing user class iPXE - and
that second exchange gets the HTTP menu URL. The one subtlety worth
its line of prose: option 77 on the wire carries a one-byte length
before the class text, so the comparison is
substring(option user-class, 1, 4) = "iPXE" - offset 1, four bytes -
not a whole-string equality; a plain option user-class = "iPXE"
does not match the packet as observed on this network. next-server
is option 66, the TFTP address the firmware fetches from; range
leases .100 through .199 for booting clients; the routers and
domain-name-servers options are ordinary lease data - and their
absence of real services behind them is worth remembering when a
booting client's post-boot networking misbehaves (Section 27.5.7
shows that effect). The interface selection lives in
/etc/default/isc-dhcp-server:
INTERFACESv4="eth1"
INTERFACESv6=""
and the TFTP daemon's configuration in /etc/default/tftpd-hpa:
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/srv/tftp"
TFTP_ADDRESS="192.168.227.10:69"
TFTP_OPTIONS="--secure --create"
--secure confines the daemon to TFTP_DIRECTORY (paths cannot
escape it), --create permits creating files - harmless here and
required if clients ever upload - and the explicit TFTP_ADDRESS
binds the daemon to the provisioning server's address only, one of
the isolation measures Section 27.5.4 collects. Install all three
configurations, then the nginx site:
$ sudo install -m 0644 provisioning/dhcpd.conf /etc/dhcp/dhcpd.conf
$ sudo install -m 0644 provisioning/isc-dhcp-server /etc/default/isc-dhcp-server
$ sudo install -m 0644 provisioning/tftpd-hpa /etc/default/tftpd-hpa
$ sudo install -m 0644 provisioning/nginx-pxe.conf /etc/nginx/sites-available/pxe.conf
$ sudo ln -sfn /etc/nginx/sites-available/pxe.conf /etc/nginx/sites-enabled/pxe.conf
All five commands are silent; the ln -sfn points the enabled-sites
directory at the new configuration (-f replaces a stale link, -n
treats a symlinked directory correctly). On this host nginx serves
nothing else, so the default site can be removed
(sudo rm -f /etc/nginx/sites-enabled/default) to avoid its
catch-all behavior; on a server that already runs web sites, give
PXE its own listen address or port instead of default_server.
Validate every configuration before activating it - the habit of
Section 27.2.3 applied to services:
$ sudo dhcpd -t -cf /etc/dhcp/dhcpd.conf
Internet Systems Consortium DHCP Server 4.4.3-P1
Copyright 2004-2022 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Config file: /etc/dhcp/dhcpd.conf
Database file: /var/lib/dhcp/dhcpd.leases
PID file: /var/run/dhcpd.pid
$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
dhcpd -t parses and exits (the banner is its whole success output);
nginx -t is the same check for the web server, as
Chapter 23 covered. A service that fails its
check stays stopped - never restart past a failed validation. Start
the three services and verify all three:
$ sudo systemctl restart isc-dhcp-server tftpd-hpa nginx
The restart produces no output of its own; is-active answers for
all three services:
$ systemctl is-active isc-dhcp-server tftpd-hpa nginx
active
active
active
$ sudo ss -lunp | grep -E ':(67|69) '
UNCONN 0 0 0.0.0.0:67 0.0.0.0:* users:(("dhcpd",pid=61660,fd=8))
UNCONN 0 0 192.168.227.10:69 0.0.0.0:* users:(("in.tftpd",pid=61664,fd=4))
The UDP listeners answer: dhcpd on port 67 and tftpd on port 69 -
the latter bound to the provisioning address only. (The
INTERFACESv4 setting is what keeps dhcpd answering solely on
eth1, even though its socket line reads 0.0.0.0.) Now verify the
whole delivery chain from the client side. On auto2, as john, create
the same workspace the chapter uses on auto1 - mkdir -p
~/debian-handbook/automation - and work from it for the rest of this
section; it is a convenient place for the fetched test files. The
client tools these checks use are not part of a minimal installation
either: the tftp command comes from the tftp-hpa package,
dhcpcd from dhcpcd-base, and the HTTP checks use curl - install
them on auto2 with sudo apt install tftp-hpa dhcpcd-base curl.
Fetch the BIOS loader exactly as firmware does, and prove the bytes are right:
$ tftp 192.168.227.10 -c get undionly.kpxe tftp-undionly.kpxe
tftp is silent on success. Compare the received file's digest with
the served file's - the server side, in the root shell on auto1:
# sha256sum /usr/lib/ipxe/undionly.kpxe
391bfe580ec9f823d046ee390765d6c389f482b9a8b9fae0f90871cd8ff57828 /usr/lib/ipxe/undionly.kpxe
and the client side, as john on auto2:
$ sha256sum tftp-undionly.kpxe
391bfe580ec9f823d046ee390765d6c389f482b9a8b9fae0f90871cd8ff57828 tftp-undionly.kpxe
Identical. Continue down the chain as iPXE would - the menu over HTTP:
$ curl -fsS http://192.168.227.10/ipxe/menu.ipxe
#!ipxe
:start
menu Debian 13 provisioning
item --gap -- ------------------------------------------------
item install Debian 13 automated installation
item shell iPXE shell
item reboot Reboot this computer
choose --default install --timeout 10000 target && goto ${target}
:install
kernel http://192.168.227.10/debian-installer/amd64/linux initrd=initrd.gz auto=true priority=critical preseed/url=http://192.168.227.10/preseed/handbook.cfg ---
initrd http://192.168.227.10/debian-installer/amd64/initrd.gz
boot
:shell
shell
:reboot
reboot
Then the installer kernel - a HEAD request checks size and reachability without downloading 12 MB:
$ curl -fsSI http://192.168.227.10/debian-installer/amd64/linux
HTTP/1.1 200 OK
Server: nginx
Date: Mon, 23 Nov 2026 20:09:01 GMT
Content-Type: application/octet-stream
Content-Length: 12171200
Last-Modified: Mon, 16 Nov 2026 09:27:16 GMT
Connection: keep-alive
ETag: "6afacc74-b9b7c0"
Accept-Ranges: bytes
Twelve megabytes of kernel, served with byte ranges - a reminder of why the big files ride HTTP and only the first loader rides TFTP. And the preseed, fetched the way the kernel line tells d-i to:
$ curl -fsS http://192.168.227.10/preseed/handbook.cfg | grep '^d-i netcfg/get_hostname'
d-i netcfg/get_hostname string provisioned
Finally, verify the DHCP selection itself - the two answers the
server gives. dhcpcd -T runs a real DHCP exchange, prints the
offered lease as shell assignments, and exits without configuring
the interface. The plain, BIOS-like exchange:
$ sudo dhcpcd -4 -T eth1 | grep '^new_filename='
new_filename='undionly.kpxe'
-4 is IPv4 only; the exchange itself is logged on standard error
(eth1: offered 192.168.227.100 from 192.168.227.10). Now the
stage-two answer, with -u iPXE adding the user class to the
request exactly as iPXE does:
$ sudo dhcpcd -4 -T -u iPXE eth1 | grep '^new_filename='
new_filename='http://192.168.227.10/ipxe/menu.ipxe'
dhcpcd option |
Description |
|---|---|
-4 |
IPv4 only. |
-T |
Test mode: perform the DHCP exchange, print the lease, configure nothing. |
-u CLASS |
Send CLASS as the DHCP user class (option 77). |
Every link of Figure 27.4 now has a verified answer: DHCP selects the right loader for each client class, TFTP delivers it byte-exact, HTTP serves the menu, the kernel, and the preseed, and the menu's kernel line points d-i at that preseed. What remains is the client firmware itself fetching the loader - the one link this network can verify from the outside but not exercise, because it runs before any operating system exists; Section 27.5.7 covers the client-side procedure.
27.5.4. Coexisting with Existing DHCP and Restricting Provisioning to an Isolated Network
A network-boot server answers DHCP, and DHCP is a network-wide
service: done carelessly, every PXE-capable machine on the segment -
including laptops that merely have their boot menu open - receives
your filename and starts installing Debian. The containment measures
already in place are worth collecting deliberately, because each one
is independent:
- Its own interface.
INTERFACESv4="eth1"restricts dhcpd to the provisioning link; the management network's own DHCP goes unheard. - Its own address. tftpd binds
192.168.227.10:69, so TFTP is unreachable on any other address, and nginx's site is the only web content on this host. On a shared server, bind services to the provisioning address instead of the wildcard. - Its own subnet. The isolated
192.168.227.0/24link has no forwarding to or from other networks, so a misbehaving booting client can reach exactly one server. Chapter 24 builds such networks for libvirt guests (Section 24.3.3); on physical infrastructure a dedicated VLAN serves the same purpose. - Restricted HTTP. The
/preseed/location answers only the provisioning subnet - Section 27.5.6 demonstrates the refusal - so the installer answers cannot be read from outside even if the network is reached.
When a dedicated segment is impossible - the classic case is a
production LAN where the existing DHCP server must stay
authoritative - the standard technique is a PXE proxy service: a
machine that answers only the boot-related options and never
competes for address leases. dnsmasq supports proxy PXE directly;
a second ISC dhcpd instance is the wrong tool for it, because two
address-assigning dhcpd servers on one segment fight over leases.
The production alternative that keeps one server is Kea with client
classification: the existing server returns filename only to hosts
classified as PXE clients, which Chapter 22 can
express. Either way, the safety property to aim for is the one this
network already has: a machine only receives boot instructions if it
is, by construction, a machine you intend to reinstall.
One planning point for a working install line: the installer
downloads packages from the mirror named in the preseed. The practice
network has no forwarding, so a client that reached this point would
need either a forwarding/NAT path to deb.debian.org (the
option routers line already points at this server - the server
would have to provide the forwarding, which this chapter's network
deliberately does not) or a local mirror (Chapter 6
builds one with reprepro). Choose before the first real client
boots; a preseeded install that fails halfway for want of a mirror
is the least fun failure in this chapter.
27.5.5. Signed Boot Chains, Secure Boot Constraints, and Image Verification
A UEFI machine with Secure Boot enabled verifies every EFI binary's
signature against the keys enrolled in its firmware before running it.
The chain matters to this design at exactly two points: the loader the
firmware fetches (must be signed by a key the firmware trusts), and -
because the whole point of network provisioning is not to touch each
machine - the archive those loaders came from. Debian ships the
network-boot loaders already signed in the two chains that matter, and
sbverify shows both; it comes from the sbsigntool package
(sudo apt install sbsigntool). Fetch d-i's own UEFI loaders explicitly - they were unpacked with the archive, and
keeping HTTP copies also serves firmwares that prefer URL boot:
$ sudo curl -fsSL https://deb.debian.org/debian/dists/trixie/main/installer-amd64/current/images/netboot/debian-installer/amd64/bootnetx64.efi -o /srv/http/bootnetx64.efi
$ sudo sbverify --list /srv/http/bootnetx64.efi
signature 1
image signature issuers:
- /C=US/ST=Washington/L=Redmond/O=Microsoft Corporation/CN=Microsoft Corporation UEFI CA 2011
image signature certificates:
- subject: /C=US/ST=Washington/L=Redmond/O=Microsoft Corporation/CN=Microsoft Windows UEFI Driver Publisher
issuer: /C=US/ST=Washington/L=Redmond/O=Microsoft Corporation/CN=Microsoft Corporation UEFI CA 2011
- subject: /C=US/ST=Washington/L=Redmond/O=Microsoft Corporation/CN=Microsoft Corporation UEFI CA 2011
issuer: /C=US/ST=Washington/L=Redmond/O=Microsoft Corporation/CN=Microsoft Corporation Third Party Marketplace Root
signature 2
image signature issuers:
- /C=US/O=Microsoft Corporation/CN=Microsoft UEFI CA 2023
image signature certificates:
- subject: /C=US/ST=Washington/L=Redmond/O=Microsoft Corporation/CN=Microsoft UEFI CA 2023 signer
issuer: /C=US/O=Microsoft Corporation/CN=Microsoft UEFI CA 2023
- subject: /C=US/O=Microsoft Corporation/CN=Microsoft UEFI CA 2023
issuer: /C=US/O=Microsoft Corporation/CN=Microsoft RSA Devices Root CA 2021
warning: data remaining[908192 vs 1036152]: gaps between PE/COFF sections?
Two signatures, from Microsoft's 2011 and 2023 UEFI CAs - the
certificate authorities that virtually every vendor's firmware trusts
out of the box. That is the whole point of this file: bootnetx64.efi
is loadable by Secure Boot firmware directly, with no enrollment
step, because it is signed in the chain the firmware already carries.
(The trailing warning is sbverify noting padding between the binary's
sections - informational, not a verification failure.) Now the GRUB
form of the same loader:
$ sudo curl -fsSL https://deb.debian.org/debian/dists/trixie/main/installer-amd64/current/images/netboot/debian-installer/amd64/grubx64.efi -o /srv/http/grubx64.efi
$ sudo sbverify --list /srv/http/grubx64.efi
signature 1
image signature issuers:
- /CN=Debian Secure Boot CA
image signature certificates:
- subject: /CN=Debian Secure Boot Signer 2022 - grub2
issuer: /CN=Debian Secure Boot CA
One signature, by Debian's own Secure Boot CA - the key Debian
enrolls in firmware through its shim during a normal installation.
Debian's signed GRUB therefore boots on a machine that already has
Debian's shim in place, and on fresh Secure Boot hardware the
Microsoft-signed bootnetx64.efi is the friction-free entry point.
Now the negative result that completes the picture - the stock iPXE binary this design chainloads. In the root shell on auto1:
# sbverify /usr/lib/ipxe/ipxe.efi
Signature verification failed
No signature table present
The exit status is 1 and the reason is the second line: the binary
carries no signature table at all. The Debian-packaged ipxe.efi is
built unsigned, so a Secure Boot machine will refuse it. The BIOS-side undionly.kpxe is
unaffected - legacy BIOS PXE has no signature checking - but for UEFI
Secure Boot clients the design must change shape at one line: serve
debian-installer/amd64/bootnetx64.efi (or the GRUB variant) as the
filename in place of ipxe.efi, and the firmware loads d-i
directly, skipping the iPXE menu. The cost is the menu's
convenience; the gain is a boot chain that works with the firmware's
security policy enabled rather than asking the reader to disable it.
A signed iPXE exists as an option - a custom build signed with your
own CA (or Debian's shim chain) - but "serve the loader Debian
already signed" is the simpler posture, and it is the one this
chapter recommends.
Image verification closes the loop that Section 27.5.2 opened: the archive was checksum-compared against the mirror's published SHA-256 list at download time, and the loaders' signatures were inspected here at rest. Neither step requires the client - both are supply-chain checks you can run on the server while no machine is booting at all.
27.5.6. Delivering Preseed Configuration Without Exposing Enrollment Secrets
The preseed travels over plain HTTP, so its content policy has one
rule: the file may describe a machine, but it may not contain
anything that still matters after the machine exists. The example
file follows the rule by construction - the only credential in it is
a crypt hash (Section 27.4.1 demonstrated that its plaintext appears
nowhere), and the late_command writes a marker, not a key. The
restriction on who can read even that is the nginx allow/deny
pair from Section 27.5.3, and it is worth seeing the refusal work
rather than trusting the directive. From the provisioning server
itself, in the root shell, request the preseed from the loopback
address - a source the rule does not allow:
# curl -fsS http://127.0.0.1/preseed/handbook.cfg >/dev/null
curl: (22) The requested URL returned error: 403
The refusal is on standard error, and the command exits 22 - curl's
"HTTP error" code; the redirection to /dev/null is only so a
successful fetch would print nothing. Every address outside
192.168.227.0/24 receives the same answer, while Section 27.5.3's
fetch from auto2 succeeded. The boundary is the network itself: on the
provisioning segment, anything can read the preseed - including a
machine you did not mean to install, which is the second argument for
the isolated network of Section 27.5.4.
What of the credentials a new machine genuinely needs? The pattern this book uses splits them by lifetime:
- Short-lived or derived: the account password, delivered as a hash in the preseed and changed on first use - readable on the provisioning network by design, worthless moments later.
- Long-lived: the enrollment token of Section 27.3.4, SSH host keys, TLS keys - never in the image, never in the preseed. The host generates its own identity on first boot (Section 27.4.3), and configuration management delivers the rest after the host exists and is reachable over SSH - the boundary drawn in Figure 27.3.
- Bridging the gap: a
late_command(orruncmd) can enroll the host - one line that fetches a first-boot hook or writes a marker - but keep it to that. The moment the hook grows logic, move the logic into the playbooks where it is versioned, checked, and idempotent.
d-i also accepts preseed/url=https://… for encrypted transport; on
an isolated network it buys confidentiality against sniffing but only
if the installer can verify the certificate, which is its own
distribution problem. The simpler and stronger control on a
dedicated provisioning network is the one already in place: the
network is small, the file is harmless, and the reader's long-lived
secrets never ride it.
27.5.7. Installing a Disposable Guest and Checking Identity, Configuration, and First Boot
The procedure from the client's side, in order: connect the machine to
the provisioning network; open its firmware settings and enable
network boot (on UEFI, the built-in PXE/network stack, sometimes
under a boot-option menu); and let it power on. The client needs a
console for this first boot - a physical monitor, or for a virtual
machine the hypervisor's console window (Chapter 24
covers guest consoles) - because there is no operating system to
SSH into yet. Then watch the chain of Figure 27.4 happen: the
firmware's DHCP exchange, the TFTP fetch, iPXE's menu with its
ten-second countdown, and then the installer kernel and initrd
downloading over HTTP. With auto=true priority=critical the
installer shows only what it lacks: a mostly silent run through
partitioning, package installation, and the finishing steps, ending
in a reboot into the installed system. An installer that stops has
stopped on a question - the screen names it, and that question is
the bug report against your preseed; the answers it did use are
recorded in the installed system's /var/log/installer/syslog.
Each link the console shows has already been verified from the
outside in Section 27.5.3, and one more link can be exercised right
now - the client's DHCP exchange itself, using auto2 as the
stand-in client. The exercise temporarily replaces eth1's address on
auto2; management access rides eth0, so nothing here can cost
you the session, but the isolated link's address changes for a
minute. On auto2, as john, in the workspace there as well. First,
preserve the resolver configuration, because the lease below will
rewrite /etc/resolv.conf with what the DHCP server advertises:
$ cp /etc/resolv.conf resolv.conf.before-dhcp
Now take a real lease. The sequence clears the static address first
so that the lease is the only address on the interface while it
lasts - clear, then request - and dhclient -1 obtains exactly one
lease and returns; -v logs the exchange, which is the point of the
exercise:
dhclient option |
Description |
|---|---|
-1 |
Obtain one lease and exit (the default is to keep renewing). |
-v |
Log the DHCP exchange while it happens. |
-r IFACE |
Release the lease on IFACE and exit. |
$ sudo ip addr flush dev eth1 && sudo dhclient -1 -v eth1
Internet Systems Consortium DHCP Client 4.4.3-P1
Copyright 2004-2022 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/eth1/52:54:00:0b:23:7d
Sending on LPF/eth1/52:54:00:0b:23:7d
Sending on Socket/fallback
DHCPDISCOVER on eth1 to 255.255.255.255 port 67 interval 4
DHCPOFFER of 192.168.227.100 from 192.168.227.10
DHCPREQUEST for 192.168.227.100 on eth1 to 255.255.255.255 port 67
DHCPACK of 192.168.227.100 from 192.168.227.10
bound to 192.168.227.100 -- renewal in 283 seconds.
The full exchange - discover, offer, request, acknowledge - with the server answering from the provisioning range. Check the lease the way any client would:
$ ip -4 addr show eth1
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
altname enp0s6
altname ens6
altname enx5254000b237d
inet 192.168.227.100/24 brd 192.168.227.255 scope global dynamic eth1
valid_lft 598sec preferred_lft 598sec
The dynamic marker and the short lifetime are the lease at work.
Note what else the server handed out: it advertised itself as the
DNS resolver (option domain-name-servers), and no resolver runs
there - so the lease above replaced /etc/resolv.conf with a
pointer at nothing. Release the lease and put the static address and
saved resolver back:
$ sudo dhclient -r eth1
The release is terse - dhclient reports on standard error that it
killed the lease-holding client process, and the address leaves the
interface with it. Restore:
$ sudo ip addr flush dev eth1 && sudo ip addr add 192.168.227.20/24 dev eth1
$ sudo cp resolv.conf.before-dhcp /etc/resolv.conf
Both commands are silent. Verify the link is whole again:
$ ping -c1 -W2 192.168.227.10
PING 192.168.227.10 (192.168.227.10) 56(84) bytes of data.
64 bytes from 192.168.227.10: icmp_seq=1 ttl=64 time=0.604 ms
--- 192.168.227.10 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.604/0.604/0.604/0.000 ms
For a real provisioned machine the same observation means something different: if your DHCP configuration advertises a resolver that does not exist, every installed machine inherits it, so either run a resolver on the provisioning server (Chapter 22) or drop the option - and let Section 27.3's playbook manage the resolver properly afterwards.
When the install finishes and the machine reboots from its own disk, the acceptance checks are the ones this chapter has built, run on the new host and from the control node:
- Identity is unique. On the new host, read its machine ID
(
cat /etc/machine-id) and its SSH fingerprint (ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub) and confirm no other machine - including the template it came from - shares either; compare withcmpas in Section 27.4.3. - The automation ran. The marker exists:
ls -l /etc/handbook-provisioned, written by the preseed'slate_commandor cloud-init'sruncmd. - The account works. Log in as john with the password whose hash the preseed carried, and change it - a password that existed as a hash in an HTTP-served file is a password to retire on first contact.
- Configuration management takes over. Add the inventory line on
the control node, run the playbook with
--limitfor the new host, and read the recap: the goal ischanged=0(Section 27.4.4), and whatever it reports as changed tells you how far the image drifted from the baseline. - History starts now.
etckeeper initon the new host (Section 27.2.1) so its/etcis tracked from the first day.
A machine that passes all five is a provisioned system in the sense this chapter means it: born unattended, unique, verified, and already under management.
27.5.8. Diagnosing DHCP, Boot-File, Kernel, Initrd, and Unattended-Install Failures
Network-boot failures are layered, and the fast path to a fix is to find the layer that breaks before touching any other. The client console tells you roughly where it stopped - "no DHCP offer", a TFTP timeout, "no bootable device", an installer question that should not have been asked - and each symptom maps to one link of the chain in Figure 27.4:
| Symptom at the client | Layer to check | How to check |
|---|---|---|
| No IP address; PXE times out | DHCP offer not arriving | systemctl is-active isc-dhcp-server; journalctl -u isc-dhcp-server for the DISCOVER lines; is the client's NIC on the isolated network at all? |
| Address acquired, no loader | Boot file name or TFTP | sudo dhcpcd -4 -T eth1 from a client (Section 27.5.3) to see the offered new_filename; sudo ss -lunp \| grep ':69 '; a tftp -c get of the offered name |
| Loader runs, no menu | iPXE's second exchange or HTTP | journalctl -u nginx; curl -fsS http://192.168.227.10/ipxe/menu.ipxe from a client; the substring(option user-class, 1, 4) match (Section 27.5.3) if the menu URL never arrives |
| Menu appears, kernel fails | Installer file paths | curl -fsSI http://192.168.227.10/debian-installer/amd64/linux - a 404 means the alias or the unpacked tree moved; the menu's URLs must match the nginx paths exactly |
| Installer asks questions | Preseed not fetched | From the installer's own shell (the d-i menu offers one) or a client: fetch the preseed URL and check the 403 rule and the file itself; debconf-set-selections -c at home for syntax |
| Install stops mid-way | Mirror unreachable from the client | The client needs option routers to lead somewhere that forwards, or a local mirror - Section 27.5.4's planning point |
The server-side tools catch the configuration errors before any of that happens. The value of validating before restart is easiest to see with a genuinely broken file:
$ sudo dhcpd -t -cf /etc/dhcp/dhcpd.conf.bad
Internet Systems Consortium DHCP Server 4.4.3-P1
Copyright 2004-2022 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
/etc/dhcp/dhcpd.conf.bad line 1: semicolon expected.
this is
^
Configuration file errors encountered -- exiting
If you think you have received this message due to a bug rather
than a configuration issue please read the section on submitting
bugs on either our web page at www.isc.org or in the README file
before submitting a bug. These pages explain the proper
process and the information we find helpful for debugging.
exiting.
The offending file is the single line this is not dhcpd syntax;
dhcpd names the line, shows the token, and exits 1 - so the service
keeps its last-known-good configuration instead of dying on the new
one. The live configuration was never touched - the bad candidate
sat at a separate path - so the only cleanup is removing the
practice file:
$ sudo rm -f /etc/dhcp/dhcpd.conf.bad
The command is silent, and /etc/dhcp/dhcpd.conf remains exactly the
configuration validated and installed in Section 27.5.3.
Two more instruments complete the diagnostic kit. When the server
logs do not explain a client, watch the wire: the DHCP exchange is
plain UDP on port 67, and Chapter 22 shows the
packet-capture workflow (Section 22.8.2) that names which options
each side actually sent - indispensable when the client's firmware
is the least-documented component in the room. And when an
unattended install succeeds but leaves doubt about what it did,
the installed system keeps the installer's own record:
/var/log/installer/ holds the syslog of everything debconf
answered, which is the difference between debugging a preseed from
memory and debugging it from evidence.