Skip to content

Devel environment for PXE booting

Marek Czernek edited this page Jan 31, 2024 · 9 revisions

In order to test PXE booting in a development environment the following are needed:

  • The Uyuni server must be accessible from the LAN. If running in a VM it must use bridged networking.
  • The virtual machine that will be PXE booted must be configured to access the LAN using bridged networking
  • The LAN DHCP server must be configured to tell the PXE clients which server and image to load. The exact configuration depends on the DHCP server (see bellow)
  • RHEL/Centos/Oracle Linux clients requires at least 2GB of RAM, otherwise anaconda will fail with a message like mount wrong fs type...
  • The following configurations assume you want to boot into legacy mode. To test UEFI, change the DHCP boot file from pxelinux.0 to grub/shim.efi (or other file you want to test that resides in /srv/tftp; grub/shim.efi is typically used for secure boot).

Do one of the following configurations:

OpenWrt configuration

OpenWrt uses dnsmasq under the hood but the actual configuration is OpenWrt specific. The network boot options are not available in the Web UI. You must SSH into the router and execute the following:

# uci add_list dhcp.@dnsmasq[0].dhcp_boot='pxelinux.0,<uyuni_server_hostname>,<uyuni_server_ip>'
# uci commit dhcp
# service dnsmasq restart

Make sure to have the <uyuni_server_hostname> in there otherwise PXE boot won't boot from the correct server.

ISC DHCP configuration

See https://documentation.suse.com/sles/15-SP1/html/SLES-all/cha-deployment-prep-pxe.html#sec-deployment-dhcp-server Basically:

next-server: <IP_Address_of_Server>
filename: "pxelinux.0"

dnsmasq configuration

dhcp-boot=pxelinux.0,<uyuni_server_hostname>,<uyuni_server_ip>

libvirt configuration

In the definition of the network used to run the Uyuni machines, add the following configuration:

<network>
  <ip ...>
    <dhcp>
      ...
      <bootp file='pxelinux.0' server='<uyuni_server_ip>'/>
    </dhcp>
  </ip>
</network>

This is known to work on network with nat forwarding mode.

You can create VMs with virt-install, e.g.:

# legacy
virt-install --pxe --network default --os-variant sle15sp5
# UEFI
virt-install --pxe --network default --os-variant sle15sp5 --boot uefi

Debugging tips

  • To prevent pxe-default-profile profile from shutting down at the end of the registration and to get a shell add the spacewalk-finally=running to the kernel parameters in the PXE boot menu.
  • To enable debugging in dracut scripts add rd.debug to the kernel parameters.
  • RHEL/Centos 8 installer (Anaconda) debugging tips:
    • The installer starts Anaconda in a tmux session. The usual tmux shortcuts work. Window 2 is a shell.
    • Logs are saved in /tmp
    • Anaconda is written in Python.The usual Python debugging tricks work.
Clone this wiki locally