Kernelcmd not being honored during provisioning using Kickstart default PXELinux template

Problem:
I am trying to set net.ifnames=0 and biosdevname=0 to kickstart a rhel-7 host using the “Kickstart default PXELinux” template. I want to use the eth naming convention for the interfaces. Here is the command I use to create the host.

hammer host create \
  --name tests001 \
  --architecture x86_64 \
  --build true \
  --content-view rhel-7-server \
  --domain local.net \
  --enabled true \
  --lifecycle-environment rhel-7-server_08-08-2022 \
  --location MyLocation \
  --managed true \
  --medium rhel-server-7.7-x86_64-dvd-20190728 \
  --operatingsystem rhel-server-7.7-x86_64 \
  --organization MyOrganization \
  --overwrite true \
  --partition-table "rhel-7-server-dynamic-xfs" \
  --product rhel-7-server-rpms \
  --provision-method build \
  --pxe-loader "PXELinux BIOS" \
  --interface "mac=08:00:27:cc:2a:40, \
               ip=192.168.0.145, \
               type=interface, \
               managed=true, \
               primary=true, \
               provision=true, \
               subnet=192.168.0.0, \
               virtual=false" \
  --interface "mac=08:00:27:f0:6d:8a, \
               ip=192.168.1.145, \
               type=interface, \
               managed=true, \
               primary=false, \
               provision=false, \
               subnet=192.168.1.0, \
               virtual=false" \
  --parameters "selinux-mode=permissive, \
                bootloader-append=selinux=1 audit=1 transparent_hugepage=never, \
                time-zone=Etc/GMT, \
                disable-firewall=false, \
                redhat_install_agent=false, \
                redhat_install_host_tools=false, \
                redhat_install_host_tracer_tools=false, \
                activation_key=rhel-7-server-latest, \
                atomic=false, \
                subscription_manager=true, \
                subscription_manager_auto_attach=false, \
                subscription_manager_certpkg_url=http://formn001/pub/katello-ca-consumer-latest.noarch.rpm, \
                subscription_manager_org=MyOrganization, \
                package_upgrade=true, \
                loader_timeout=2, \
                kernelcmd=net.ifnames=0 biosdevname=0"

After I run the command, I navigate to “Hosts > Provisioning Templates > Kickstart default PXELinux” and select Preview. I can see the APPEND line correctly shows “net.ifnames=0 biosdevname=0”.

APPEND initrd=boot/rhel-server-7-7-x86_64-dvd-20190728-qWmnKQBMBQsJ-initrd.img net.ifnames=0 biosdevname=0 network ksdevice=bootif ks.device=bootif BOOTIF=01-08-00-27-cc-2a-40 ks=http://formn001.local.net/unattended/provision?token=3d07f52d-740d-4e3a-b9bd-07068bdbfa8d kssendmac ks.sendmac ip=192.168.0.145::192.168.0.1:255.255.255.0:tests001.local.net::none nameserver=192.168.0.12 nameserver=192.168.1.12

After that I start the new VM using Oracle VM VirtualBox and boot to the network. The correct PXE menu is displayed, and I hit TAB to see the pxe command line. I see everything as written in the APPEND line above except for net.ifnames=0 and biosdevname=0. If I continue to provision the host everything is setup correctly except net.ifnames=0 and biosdevname=0 are not honored and I do not get the eth naming convention. I can manually enter net.ifnames=0 and biosdevname=0 on the pxe command line and it works correctly, but that is not feasible to provision hundreds of hosts.

If I clone the template and manually add net.ifnames=0 and biosdevname=0, I can see it on the pxe command line, the options are honored, and I get the eth naming convention.

Expected outcome:
Expecting net.ifnames=0 and biosdevname=0 to show on the pxeboot command line.

Foreman and Proxy versions:
Using Foreman 3.3 with Katello 4.5.

Foreman and Proxy plugin versions:

rpm -qa | grep -iE ‘foreman|katello’

foreman-release-3.3.0-1.el7.noarch
foreman-3.3.0-1.el7.noarch
foreman-cli-3.3.0-1.el7.noarch
katello-common-4.5.0-1.el7.noarch
tfm-rubygem-katello-4.5.0-1.el7.noarch
foreman-service-3.3.0-1.el7.noarch
tfm-rubygem-hammer_cli_katello-1.5.2-1.el7.noarch
foreman-selinux-3.3.0-1.el7.noarch
foreman-postgresql-3.3.0-1.el7.noarch
katello-debug-4.5.0-1.el7.noarch
foreman-debug-3.3.0-1.el7.noarch
foreman-dynflow-sidekiq-3.3.0-1.el7.noarch
tfm-rubygem-hammer_cli_foreman_tasks-0.0.17-1.fm3_2.el7.noarch
katello-selinux-4.0.2-1.el7.noarch
katello-4.5.0-1.el7.noarch
foreman-installer-3.3.0-1.el7.noarch
tfm-rubygem-foreman-tasks-6.0.2-1.fm3_3.el7.noarch
tfm-rubygem-hammer_cli_foreman-3.3.0-1.el7.noarch
foreman-installer-katello-3.3.0-1.el7.noarch
foreman-proxy-3.3.0-1.el7.noarch
katello-client-bootstrap-1.7.9-1.el7.noarch
katello-repos-4.5.0-1.el7.noarch
katello-certs-tools-2.9.0-1.el7.noarch
tfm-rubygem-foreman_remote_execution-7.1.0-1.fm3_3.el7.noarch
rubygem-foreman_maintain-1.1.1-3.el7.noarch
tfm-rubygem-hammer_cli_foreman_remote_execution-0.2.2-1.fm3_0.el7.noarch

Distribution and version:
Using Oracle VM VirtualBox to install Red Hat Enterprise Linux 7.7.

Hi!
I can confirm this bug.
I also found a workaround - just flip the build status of the host to build=false and then back to true. That will make foreman to regenerate the pxelinux config for the host - and this time it will do it right.
Don’t ask me why.

I know it’s probably very helpful, but it works.

Just found much better workaround:
Define a hostgroup and add the parameter there.
Then create your hosts with specifying the hostgroup.
Apparently, hostgroup-level parameters are not ignored.

Hope that helps

Thank you very much. That worked!

Hi!

I am trying to achieve the same as @cmstjohn01. I found this thread, followed the marked solution by adding the parameters to the hostgroup. Going to the template and rendering the preview looks correct, but once the system boots and I press Tab to see the commandline, the options I specified in the hostgroup are missing.

I’m not seeing any (obvious) errors in the logfiles and I am currently lost where to look further.

I am running Foreman 3.5.2 and I’m trying to install Rocky Linux 8. The Foreman installation was updated numerous times in the past and also migrated from EL7 to EL8. Could it be possible that I missed a step somewhere that impacts template rendering?

Sorry for the spam, somehow I can’t edit my post.

I just noticed that if I select “Rebuild config” for that host, the template is rendered correctly with my parameters, so all in all I suspect they seem to be set correctly. Maybe it’s a problem in combination with using hammer to create the hosts?

Just in case anyone finds this via Google or something.

My workaround is to issue hammer host rebuild-config --only TFTP immediately after hammer host create. With this it is not even necessary to use a hostgroup. If kernelcmd was passed via hammer host create --parameters, rebuild-config will generate the file correctly.