PXE network install, end to end: dnsmasq/grub chain, a four-layer troubleshooting map and unattended install (with anti-reloop rules)
What you will learn
Section titled “What you will learn”The complete PXE network install setup: the DHCP/TFTP/bootloader/kickstart quadruple, plus a completed end-to-end unattended install — including a troubleshooting map that dissects the classic “initrd takes over and hangs” failure into four root-cause layers. You get more than a success tutorial: the evidence and fix for every layer.
Architecture
Section titled “Architecture”┌─ PXE server (OL10, VM 388) ────────────┐│ dnsmasq: DHCP(67/69) + TFTP(69) ││ http.server:8000 → ks.cfg + stage2(ISO)││ NAT: 192.168.100.0/24 → outbound(repo) ││ tftp-root: ol10-grub/core.efi+grub.cfg ││ ol10/vmlinuz+initrd.img │└──────────────┬─────────────────────────┘ private bridge vmbr9 (192.168.100.0/24, no uplink) │┌─ PXE target (OVMF/q35, 4G RAM, 20G disk) ────┐│ PXE → grub → kernel+initrd → anaconda → install │└──────────────────────────────────────────────┘Bootloader: grub2-mknetdir (the EL10 way)
Section titled “Bootloader: grub2-mknetdir (the EL10 way)”EL10 no longer ships syslinux — for UEFI PXE, generate a dedicated bootloader with grub2-mknetdir:
dnf install -y grub2-efi-x64-modules grub2-tools-extragrub2-mknetdir --net-directory=/var/lib/tftpboot --subdir=ol10-grub# → /var/lib/tftpboot/ol10-grub/x86_64-efi/core.efi (boot file)grub.cfg (layered sourcing is the key):
menuentry 'OL10 PXE Install' { linux /ol10/vmlinuz ip=dhcp \ inst.stage2=http://<PXE-server-IP>:8000/iso \ inst.repo=https://yum.oracle.com/repo/OracleLinux/OL10/baseos/latest/x86_64 \ inst.ks=http://<PXE-server-IP>:8000/ks.cfg inst.text initrd /ol10/initrd.img}dnsmasq: four measured pitfalls
Section titled “dnsmasq: four measured pitfalls”dhcp-host=BC:24:11:3B:53:7C,set:pxe # pin the MAC (serve only the target)dhcp-range=192.168.100.50,192.168.100.60,12h # ⚠️ required, or dhcp-host is ignoreddhcp-option=6,192.168.50.1,223.5.5.5 # ⚠️ required when port=0 — hand out real DNS!dhcp-boot=tag:pxe,ol10-grub/x86_64-efi/core.efienable-tftptftp-root=/var/lib/tftpboot- No dhcp-range ⇒ dhcp-host is ignored (stated in the config comments) — symptom: the target gets no OFFER at all;
- SELinux blocks TFTP: files copied with
cpcarry the var_lib_t label and dnsmasq_t is denied (Permission denied) — fix withsemanage fcontext -a -t tftpdir_t "/var/lib/tftpboot(/.*)?" && restorecon -R; - The boot-file path is relative to tftp-root — no leading slash;
- The port=0 DNS trap:
port=0only turns off dnsmasq’s own DNS service, but the DHCP reply still hands out dnsmasq’s own address as the resolver (option 6 default) — every DNS lookup in the installer fails (dracut retry storm ofCould not resolve host, screenshot 33). Setdhcp-option=6,<working upstream>explicitly.
stage2 and repo: layered sourcing (the easiest 404 to hit)
Section titled “stage2 and repo: layered sourcing (the easiest 404 to hit)”The two supplies of an anaconda network install are independent:
| Parameter | Content | Size | Recommended source |
|---|---|---|---|
inst.stage2 | installer runtime image (images/install.img) | 1.17GB | boot.iso over local HTTP (mount the ISO, serve the mount point with python3 -m http.server) |
inst.repo | package repository (BaseOS etc.) | per package set | yum.oracle.com (outbound via NAT) or a full local tree |
The yum.oracle.com repo tree carries packages only, no stage2 — pointing inst.stage2 at the same URL yields a 404 loop (curl: (22), repeated “failed to fetch stage2”). Serving boot.iso over local HTTP is the most reliable stage2 source (screenshot 34: with stage2 in place the anaconda environment boots cleanly).
End-to-end install log
Section titled “End-to-end install log”The first attempt stalled at “initrd takes over” (screenshots 28/29/30: the chain was fully alive up to the kernel). The follow-up session dissected the stall into four root-cause layers, each fixed to expose the next:
| Layer | Symptom | Root cause | Fix |
|---|---|---|---|
| ① Memory | silence after initrd takes over | target defaulted to 512MB; the 228MB initrd needs ~700MB unpacked — OOM | give the target 4G |
| ② DNS | dracut loops on Could not resolve host | dnsmasq port=0 still hands itself out as DNS | dhcp-option=6 to a real upstream |
| ③ stage2 | 404 loop (curl(22)) | yum.oracle.com repo tree has no stage2 | inst.stage2 from a local boot.iso HTTP mount |
| ④ Reinstall loop | finished install reboots into the installer and wipes | after ks reboot, OVMF NVRAM still prefers the NIC | stop DHCP once ks is fetched; reboot falls through to disk |
Final result (screenshot 35): disk boot reaches Oracle Linux Server 10.2 / ol-pxe login:. SSH evidence: /root/ks-proof.txt (%post timestamp), 455 packages @core, getenforce=Enforcing, /etc/ssh/sshd_config.d/99-pxe-rootpw.conf (written by %post) — the whole kickstart chain took effect.
Evidence and limits on this page
Section titled “Evidence and limits on this page”- Measured: the full end-to-end chain (DHCP→TFTP→grub→kernel→initrd→stage2→anaconda→%post→reboot→disk boot; screenshots 28/29/30/33/34/35 + dnsmasq journal + ks-proof SSH evidence; E3 record of 15 steps, result=pass); the four dnsmasq pitfalls, layered sourcing, the four-layer troubleshooting map and the break-the-loop rule;
- Not measured / limits: BIOS (non-UEFI) PXE (EL10 has no syslinux; not exercised); concurrent multi-target installs (per-MAC dhcp-host pinning only); the serial0 socket stayed silent in this environment (diagnostics used QMP screendump instead — no impact on conclusions);
- Sources: OL10 installation guide: network install, dnsmasq(8), grub2-mknetdir.