Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2168967 - New kickstart_kernel_options snippet breaks UEFI (Grub2) PXE provisioning when boot_mode is static
Summary: New kickstart_kernel_options snippet breaks UEFI (Grub2) PXE provisioning whe...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Provisioning Templates
Version: 6.12.1
Hardware: Unspecified
OS: Unspecified
high
medium with 2 votes
Target Milestone: 6.13.0
Assignee: Joniel Pasqualetto
QA Contact: sganar
URL:
Whiteboard:
: 2172545 2242913 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-02-10 19:13 UTC by Joniel Pasqualetto
Modified: 2023-10-26 18:04 UTC (History)
11 users (show)

Fixed In Version: foreman-3.5.1.12-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2175005 (view as bug list)
Environment:
Last Closed: 2023-05-03 13:25:08 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 36082 0 Normal Ready For Testing kickstart_kernel_options snippet breaks UEFI (Grub2) PXE provisioning when boot_mode is static 2023-02-10 20:03:21 UTC
Github theforeman foreman pull 9477 0 None Merged fixes #9308 - fix kickstart_kernel_options.erb escaping 2023-02-23 16:57:10 UTC
Github theforeman foreman pull 9620 0 None closed Fixes #36082 - Ensure character & is escaped on ks URL 2023-02-23 16:57:11 UTC
Red Hat Issue Tracker SAT-15844 0 None None None 2023-02-13 14:17:57 UTC
Red Hat Knowledge Base (Solution) 6997923 0 None None None 2023-02-13 13:45:57 UTC
Red Hat Knowledge Base (Solution) 7008208 0 None None None 2023-10-26 18:04:25 UTC
Red Hat Product Errata RHSA-2023:2097 0 None None None 2023-05-03 13:25:23 UTC

Internal Links: 2172545

Description Joniel Pasqualetto 2023-02-10 19:13:03 UTC
Description of problem:

Starting on Satellite 6.12.2 (foreman-3.3.0.20-1.el8sat.noarch) a new version of the snippet kickstart_kernel_options is shipped.

This new version includes new options that push a parameter "static=1" to the ks URL. However, when pushing this extra parameter, it needs to co-exist with token=<token> on the same URL. The URL generated is not properly escaped and then we hit this Grub2 issue[1]

Solution is to properly escape the URL.

[1] https://access.redhat.com/solutions/6810791

Version-Release number of selected component (if applicable):

foreman-3.3.0.20-1.el8sat.noarch

How reproducible:

Always

Steps to Reproduce:
1. Have subnet with boot mode set to static
2. Try provisioning an UEFI hosts (using PXELoader Grub2 UEFI)
3. When boot, system will stop on the grub terminal(won't load the grub configuration)

Actual results:
Fails to PXE boot

Expected results:
Boot properly and start provisioning

Additional info:

marked version 6.12.1 because couldn't find 6.12.2 on the list. Keep in mind that  6.12.1 should not be affected by this issue.

Comment 1 Joniel Pasqualetto 2023-02-10 20:32:43 UTC
Workaround for customers running Satellite 6.12.2:

Create a patch file named /root/kickstart_kernel_options_fix.patch with the following content:

~~~
--- original.erb	2023-02-10 15:16:54.429723695 -0500
+++ fix.erb	2023-02-10 15:18:37.722730201 -0500
@@ -39,19 +39,19 @@
   # both current and legacy syntax provided
   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')}")
+      options.push("inst.ks=#{foreman_url('provision', static: '1').gsub('&','\\\\&')}")
     elsif subnet6 && !subnet6.dhcp_boot_mode?
-      options.push("inst.ks=#{foreman_url('provision', static6: '1')}")
+      options.push("inst.ks=#{foreman_url('provision', static6: '1').gsub('&','\\\\&')}")
     else
-      options.push("inst.ks=#{foreman_url('provision')}", "inst.ks.sendmac")
+      options.push("inst.ks=#{foreman_url('provision').gsub('&','\\\\&')}", "inst.ks.sendmac")
     end
   else
     if subnet4 && !subnet4.dhcp_boot_mode?
-      options.push("ks=#{foreman_url('provision', static: '1')}")
+      options.push("ks=#{foreman_url('provision', static: '1').gsub('&','\\\\&')}")
     elsif subnet6 && !subnet6.dhcp_boot_mode?
-      options.push("ks=#{foreman_url('provision', static6: '1')}")
+      options.push("ks=#{foreman_url('provision', static6: '1').gsub('&','\\\\&')}")
     else
-      options.push("ks=#{foreman_url('provision')}", "kssendmac", "ks.sendmac")
+      options.push("ks=#{foreman_url('provision').gsub('&','\\\\&')}", "kssendmac", "ks.sendmac")
     end  
   end
~~~

Run the following commands:

TEMPLATE_ID=$(hammer template list --search name=kickstart_kernel_options --fields id |grep -v -e 'ID' -e '^-')
cp /usr/share/foreman/app/views/unattended/provisioning_templates/snippet/kickstart_kernel_options.erb /root/kickstart_kernel_options_fix.erb
patch -p1 /root/kickstart_kernel_options_fix.erb < /root/kickstart_kernel_options_fix.patch 
hammer template update --locked false --id $TEMPLATE_ID
hammer template import --name kickstart_kernel_options --file /root/kickstart_kernel_options_fix.erb
hammer template update --locked true --id $TEMPLATE_ID

Comment 2 etiennedh 2023-02-13 19:30:51 UTC
same problem here.

need to force "BIOS mode" in VMware to start the VM

Comment 3 Joniel Pasqualetto 2023-02-13 19:39:44 UTC
Hello 

Have a look at comment #1 for a workaround: https://bugzilla.redhat.com/show_bug.cgi?id=2168967#c1

It was marked private, but I don't see a reason to keep it that way.

If you're a Red Hat customer, you can also find the workaround here: https://access.redhat.com/solutions/6997923

Comment 4 Leos Stejskal 2023-02-14 09:18:38 UTC
Hi,
in upstream PR [0] is suggested to use different approach,
instead of escaping special chars just quote the URL.
Could you please confirm the fix?

[0] https://github.com/theforeman/foreman/pull/9582/files

Comment 5 Joniel Pasqualetto 2023-02-14 13:13:13 UTC
Hello

While quoting would work for Grub2 and solve the problem described in this BZ, using a quoted URL would break BIOS provisioning which uses Grub.

Escaping works in both scenarios and that's why I proposed escaping in my PR.

Comment 6 Leos Stejskal 2023-02-23 13:52:45 UTC
*** Bug 2172545 has been marked as a duplicate of this bug. ***

Comment 8 Brad Buckingham 2023-02-23 16:58:15 UTC
Moving to POST as PR is merged upstream.

Comment 13 errata-xmlrpc 2023-05-03 13:25:08 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: Satellite 6.13 Release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2023:2097

Comment 14 Odilon Sousa 2023-10-26 18:04:25 UTC
*** Bug 2242913 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.