Problem:
I have just spend some time figuring out why I couldn’t provision a host with AlmaLinux 9 via UEFI/PXE but instead always ended up at grub2 shell and not the menu after it loaded the grub.cfg file for the host. The culprit is the unquoted ampersand in the ks URL. This has been generated for my host:
# This file was deployed via 'Kickstart default PXEGrub2' template
set default=0
set timeout=10
menuentry 'Kickstart default PXEGrub2' {
linuxefi boot/almalinux-9-baseos-x86_64-os-16602-vmlinuz BOOTIF=01-11-22-33-44-55-66 inst.ks=http://foreman8.example.com/unattended/provision?static=1&token=f5cce1a5-bb49-4fe8-94c9-afc7580fd5b4 ...
initrdefi boot/almalinux-9-baseos-x86_64-os-16602-initrd.img
}
Notice the static=1&token
part. According to https://access.redhat.com/solutions/6810791 it needs to be quoted or escaped. It gets generated by snippet kickstart_kernel_options, when boot mode is static:
if (is_fedora && os_major >= 33) || (rhel_compatible && os_major >= 9)
if subnet4 && !subnet4.dhcp_boot_mode?
options.push("inst.ks=#{foreman_url('provision', static: '1')}")
elsif subnet6 && !subnet6.dhcp_boot_mode?
options.push("inst.ks=#{foreman_url('provision', static6: '1')}")
else
options.push("inst.ks=#{foreman_url('provision')}", "inst.ks.sendmac")
end
else
...
Expected outcome:
Booting and installing the server…
Foreman and Proxy versions:
foreman-3.4.1-1.el8.noarch