Bug 728268

Summary: koan artificially limits kernel command line length when installing RHEL5.2+
Product: Red Hat Satellite 5 Reporter: David Swegen <dswegen>
Component: ProvisioningAssignee: Milan Zázrivec <mzazrivec>
Status: CLOSED ERRATA QA Contact: Pavel Studeník <pstudeni>
Severity: medium Docs Contact:
Priority: medium    
Version: 541CC: cperry, gasmith, jwest, lzap, pstudeni, xdmoon
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: cobbler-2.0.7-12 Doc Type: Bug Fix
Doc Text:
On x86 architectures, previous versions of koan did not allow kernel boot parameters to be longer than 256 bytes, even though the kernel itself supports it. Consequent to this, it was impossible to provision or re-provision a machine if its kernel boot parameters exceeded this limit. This update adapts koan to increase this limit to 2048 bytes, resolving this issue.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-09-22 10:35:00 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 715348    

Description David Swegen 2011-08-04 14:39:12 UTC
Description of problem:

Koan checks that the kernel command line length does not exceed that of the kernel as specified in COMMAND_LINE_SIZE in asm-*/setup.h and exits if it does.

Up until kernel 2.6.18-53, ie RHEL 5.1 this was set at 256 for x86_64 and i686. In 2.6.18-92 (RHEL 5.2) this was increased to 2048 (see bug 247477). Koan has not been updated to reflect this.

The offending bit of code is in /usr/lib/python*/site-packages/koan/app.py around line 775:
=========
            # Validate kernel argument length (limit depends on architecture --
            # see asm-*/setup.h).  For example:
            #   asm-i386/setup.h:#define COMMAND_LINE_SIZE 256
            #   asm-ia64/setup.h:#define COMMAND_LINE_SIZE  512
            #   asm-powerpc/setup.h:#define COMMAND_LINE_SIZE   512
            #   asm-s390/setup.h:#define COMMAND_LINE_SIZE  896
            #   asm-x86_64/setup.h:#define COMMAND_LINE_SIZE    256
            if arch.startswith("ppc") or arch.startswith("ia64"):
                if len(k_args) > 511:
                    raise InfoException, "Kernel options are too long, 512 chars exceeded: %s" % k_args
            elif arch.startswith("s390"):
                if len(k_args) > 895:
                    raise InfoException, "Kernel options are too long, 896 chars exceeded: %s" % k_args
            elif len(k_args) > 255:
                raise InfoException, "Kernel options are too long, 255 chars exceeded: %s" % k_args
=========

How reproducible:

Every time

Steps to Reproduce:
1. Install using koan and provide a kernel command line with a length longer than 256
2.
3.
  
Actual results:

koan exits with the error "Kernel options are too long, 255 chars exceeded:"

Expected results:

Koan should only exit if the kernel command line is longer than the maximum of the kernel being installed.

Additional info:

Ideally the check should vary on the the kernel version so it copes with both the old maximum and the new.

Comment 2 Milan Zázrivec 2011-08-24 09:59:25 UTC
thirdparty.git SATELLITE-5.4: 23dee6c89eb16085fdccaf681915483a98b91073

Comment 4 Milan Zázrivec 2011-08-24 12:06:42 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause: Koan wouldn't allow kernel boot arguments on x86* architectures to be longer than 256 bytes.

Consequence: Impossible to (re)provision a machine in case the length of kernel boot arguments used was longer than 256 bytes (although technically the kernel would allow it).

Fix: Updated kernel boot argument lengths.

Result: On x86* architectures, the allowed kernel boot arguments are now set to 2048 bytes, provisioning in these situations is possible.

Comment 5 Jaromir Hradilek 2011-08-25 14:25:52 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,7 +1 @@
-Cause: Koan wouldn't allow kernel boot arguments on x86* architectures to be longer than 256 bytes.
+On x86 architectures, previous versions of koan did not allow kernel boot parameters to be longer than 256 bytes, even though the kernel itself supports it. Consequent to this, it was impossible to provision or re-provision a machine if its kernel boot parameters exceeded this limit. This update adapts koan to increase this limit to 2048 bytes, resolving this issue.-
-Consequence: Impossible to (re)provision a machine in case the length of kernel boot arguments used was longer than 256 bytes (although technically the kernel would allow it).
-
-Fix: Updated kernel boot argument lengths.
-
-Result: On x86* architectures, the allowed kernel boot arguments are now set to 2048 bytes, provisioning in these situations is possible.

Comment 7 errata-xmlrpc 2011-09-22 10:35:00 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, and where to find the updated
files, follow the link below.

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

http://rhn.redhat.com/errata/RHBA-2011-1331.html

Comment 8 Lukas Zapletal 2015-10-22 12:35:07 UTC
For the record, it looks like in RHEL 7 it is back to 512 bytes:

grep COMMAND_LINE_SIZE /usr/include/asm-generic/setup.h
#define COMMAND_LINE_SIZE       512

Comment 9 Lukas Zapletal 2015-10-22 12:46:38 UTC
Correction, that was a wrong file, its 2048 in RHEL 7. No surprise.