Warning message

Log in to add comments.

Performing DHCP kexec on discovered hosts

Lukas Zapletal published on 2017-08-11T08:00:00+00:00, last updated 2017-08-11T08:21:02+00:00

Satellite 6.2 introduced PXE-less discovery which is targeted to networks without PXE or DHCP services available. In this workflow, kernel on discovered nodes is replaced (via kexec technology) instead of rebooting. This turns out to be useful feature on PXE/DHCP networks as well.

To configure kexec on PXE/DHCP enabled network, do the following simple steps.

Step 1: Verify foreman discovery image version

Newer version of foreman-discovery-image must be used in order to send required "discovery_kexec" fact. We are planning rebase of foreman-discovery-image package in Satellite 6.2 upcoming errata. In the meantime, it is possible to download upstream version which is based on CentOS 7 rather than Red Hat Enterprise Linux. Series 3.4 are known to work with Satellite 6.2.

tftp_capsule# cd /var/lib/tftpboot/boot/
tftp_capsule# wget http://downloads.theforeman.org/discovery/releases/3.4/fdi-image-3.4.1.tar
tftp_capsule# tar -xvf fdi-image-3.4.1.tar

Step 2: Configure foreman discovery image kernel options

Satellite will either reboot or kexec discovered node based on presence of special fact called "discovery_kexec". When present and KExec template is associated with given Hostgroup and Operating System, kexec is performed. Reboot is the fallback mechanism if the two requirements are not met.

In Hosts - Provisioning templates search for "global" string and edit "PXELinux global default" template. In Satellite 6.2 it is possible to directly edit this template, in upcoming version this template must be cloned and Global setting must be changed to use the cloned template instead the default one.

ONTIMEOUT discovery_upstream
LABEL discovery_upstream
  MENU LABEL Foreman Discovery Image 3.4.1
  KERNEL boot/fdi-image/vmlinuz0
  APPEND initrd=boot/fdi-image/initrd0.img rootflags=loop root=live:/fdi.iso rootfstype=auto ro rd.live.image acpi=force rd.luks=0 rd.md=0 rd.dm=0 rd.lvm=0 rd.bootif=0 rd.neednet=0 nomodeset proxy.url=https://CAPSULE_URL:9090 proxy.type=proxy fdi.pxfactname1=discovery_kexec fdi.pxfactvalue1=1

Change proxy.url and proxy.type accordingly to point to either Satellite Server or Capsule. Note the options fdi.pxfactname1=discovery_kexec fdi.pxfactvalue1=1 which are required in order to have the "discovery_kexec" fact sent along.

Now click on Build PXE Default to rebuild pxelinux.cfg/default template. Hosts can be discovered now.

Step 3: Modify Red Hat KExec template

Find Red Hat Kexec template, clone it, associate it with requied Operating System and edit its contents:

kind: kexec
name: Red Hat kexec
- CentOS 4
- CentOS 5
- CentOS 6
- CentOS 7
- Fedora 19
- Fedora 20
- Fedora 21
- Fedora 22
- RedHat 4
- RedHat 5
- RedHat 6
- RedHat 7
  mac = @host.facts['discovery_bootif']
  bootif = '00-' + mac.gsub(':', '-') if mac
  append = @host.facts['append']
  "kernel": "<%= @kernel %>",
  "initram": "<%= @initrd %>",
<% if (@host.operatingsystem.name == 'Fedora' and @host.operatingsystem.major.to_i > 16) or
    (@host.operatingsystem.name != 'Fedora' and @host.operatingsystem.major.to_i >= 7) -%>
  "append": "ks=<%= foreman_url('provision') %> inst.ks.sendmac <%= "ksdevice=bootif BOOTIF=#{bootif} #{append}" %>"
<% else -%>
  "append": "ks=<%= foreman_url('provision') %> kssendmac <%= "BOOTIF=#{bootif} #{append}" %>"
<% end -%>

The template was designed for DHCP-less environments and it assumes static IP configuration. These "discovery_*" facts are not present, therefore the default template generates "ip=::::::none" Anaconda configuration which leads to System halted. The modified version does not provide static configuration, therefore Anaconda performs DHCP request.

Make sure to set this template as default one for required Operating Systems.

Step 4: Verify requirements and provision

Before provisioning the very first discovered node, show the detail page, expand all facts and search for "discovery_kexec" fact, it should be set to "1". Also make sure the Red Hat KExec template is associated with Operating System.

Discovered hosts now can be provisioned or auto-provisioned and kexec will be performed instead of reboot.


On some hardware or VMs, kexec will freeze when discovered node is on the first virtual console (tty1) with the text user interface.

To workaround this issue switch virtual terminal to tty2 (Alt+F2) before kexecing.

About The Author

rhn-engineering-lzapletal's picture

Lukas Zapletal

Satellite 6 engineering.

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.