Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-87356

RHEL 8 Installation fails when version comparison involves base kernel

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: Generate New Ti...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Undefined Undefined
    • None
    • rhel-8.10
    • anaconda
    • None
    • No
    • Moderate
    • rhel-anaconda
    • None
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • Unspecified
    • Unspecified
    • Unspecified
    • x86_64
    • None

      What were you trying to do that didn't work?

      Installing a RHEL machine with kickstart that loads a custom yum repository

      What is the impact of this issue to you?

      It works fine with kernel 4.18.0-553.42.1.el8_10.x86_64 but fails when kernel 4.18.0-553.47.1.el8_10.x86_64  

       

      Please provide the package NVR for which the bug is seen:

      Any anaconda-core.el8_10.x86_64. All of them have the same unchanged version comparison. 

        File "/usr/lib64/python3.6/site-packages/pyanaconda/payload/utils.py", line 180, in version_cmp
          return (first_version > second_version) - (first_version < second_version)

       

      I even found anaconda-core-33.16.8.9-1.el8_8.x86_64 still having the same call

      ~~~
      def version_cmp(v1, v2):
          """Compare two version number strings."""
          first_version = LooseVersion(v1)
          second_version = LooseVersion(v2)
          return (first_version > second_version) - (first_version < second_version)
      ~~~

      Any python3-3.6.*.el8_10.x86_64. I tested on python3-libs-3.6.8-51.el8.x86_64 that has below code for comparison. 

      ~~~
          def _gt_(self, other):
       64         c = self.cmp(other)                    ->>         File "/usr/lib64/python3.6/distutils/version.py", line 64, in __gt_
       65         if c is NotImplemented:
       66             return c
       67         return c > 0

      267 class LooseVersion (Version):

              <SNIP>

      331     def _cmp (self, other):
      332         if isinstance(other, str):
      333             other = LooseVersion(other)
      334 
      335         if self.version == other.version:
      336             return 0
      337         if self.version < other.version:
      338             return -1
      339         if self.version > other.version:
      340             return 1
      341 
      ~~~

      How reproducible is this bug?:

      100%

      Steps to reproduce

      1.  Copy entire RHEL 8.10 ISO DVD and add additional repo called DCROS. Ensure that group name 'rhel-extras' is set for all packages provided by this repo in comps.xml
      2. Mention the repo as group "@rhel-extras" in %packages section of kickstart script
        --------------------
        %packages
        @^minimal-environment
        @debugging
        @development
        @legacy-unix
        @rhel-extras  <--- This is this DCROS repo
        @security-tools
        @system-tools
        glibc.i686
        glibc-devel.i686
        glibc-headers.i686
        kexec-tools
        Location of the repo as defined in the kickstart:
      3. Additional repositories that can be used as sources for package installation
        repo --name="BaseOS" --baseurl=file:///run/install/repo/BaseOS
        repo --name="AppStream" --baseurl=file:///run/install/repo/AppStream
        repo --name="DCROS" --baseurl=file:///run/install/repo/addons/DCROS/packages
        --------------------
         
      4. Perform installation with kernel 4.18.0-553.47.1.el8_10.x86_64 included in the repository

      This can be easily reproduced  outside of all this hassel with directly invoking python :

      anaconda-core passes arguments to python3-utils  version.py as 
      other: 4.18.0-553.47.1.el8_10.x86_64
      self: 4.18.0-553.el8_10.x86_64

      We can pass them over cmdline:

      Comparing these works 
      4.18.0-553.47.1.el8_10.x86_64 > 4.18.0-553.42.1.el8_10.x86_64 : Returns true
      ~~~

      1. /usr/bin/python3  -c 'from distutils.version import LooseVersion as V; print(V("4.18.0-553.47.1.el8_10.x86_64") > V("4.18.0-553.42.1.el8_10.x86_64"))'
        True
        ~~~

      Comparing these fails
      4.18.0-553.47.1.el8_10.x86_64 > 4.18.0-553.el8_10.x86_64
      ~~~

      1. /usr/bin/python3  -c 'from distutils.version import LooseVersion as V; print(V("4.18.0-553.47.1.el8_10.x86_64") > V("4.18.0-553.el8_10.x86_64"))'
        Traceback (most recent call last):
          File "<string>", line 1, in <module>
          File "/usr/lib64/python3.6/distutils/version.py", line 64, in _gt_
            c = self._cmp(other)
          File "/usr/lib64/python3.6/distutils/version.py", line 337, in _cmp
            if self.version < other.version:
        TypeError: '<' not supported between instances of 'int' and 'str'
        ~~~

        Expected results

      Comparing version should not fail with traceback 
      4.18.0-553.47.1.el8_10.x86_64 > 4.18.0-553.el8_10.x86_64 

      Actual results

      ~~~
      installing boot loader

      17:39:11,499 INF installation: Queue started: Bootloader installation (7/17)
      17:39:11,499 INF installation: Task started: Configure the bootloader (12/44)
      17:39:11,613 INF threading: Thread Failed: AnaInstallThread (140606170601216)
      17:39:11,613 DBG exception: running handleException
      17:39:11,615 CRT exception: Traceback (most recent call last):

        File "/usr/lib64/python3.6/site-packages/pyanaconda/threading.py", line 280, in run
          threading.Thread.run(self)

        File "/usr/lib64/python3.6/threading.py", line 885, in run
          self._target(*self._args, **self._kwargs)

        File "/usr/lib64/python3.6/site-packages/pyanaconda/installation.py", line 406, in run_installation
          queue.start()

        File "/usr/lib64/python3.6/site-packages/pyanaconda/installation_tasks.py", line 311, in start
          item.start()

        File "/usr/lib64/python3.6/site-packages/pyanaconda/installation_tasks.py", line 311, in start
          item.start()

        File "/usr/lib64/python3.6/site-packages/pyanaconda/installation_tasks.py", line 311, in start
          item.start()

        File "/usr/lib64/python3.6/site-packages/pyanaconda/installation_tasks.py", line 490, in start
          self.run_task()

        File "/usr/lib64/python3.6/site-packages/pyanaconda/installation_tasks.py", line 456, in run_task
          self._task(*self._task_args, **self._task_kwargs)

        File "/usr/lib64/python3.6/site-packages/pyanaconda/installation.py", line 351, in configure_bootloader
          boot_task = bootloader_proxy.ConfigureWithTask(payload.kernel_version_list)

        File "/usr/lib64/python3.6/site-packages/pyanaconda/payload/dnf/payload.py", line 2105, in kernel_version_list
          return sorted(files, key=functools.cmp_to_key(payload_utils.version_cmp))

        File "/usr/lib64/python3.6/site-packages/pyanaconda/payload/utils.py", line 180, in version_cmp
          return (first_version > second_version) - (first_version < second_version)

        File "/usr/lib64/python3.6/distutils/version.py", line 64, in _gt_
          c = self._cmp(other)

       File "/usr/lib64/python3.6/distutils/version.py", line 337, in _cmp
          if self.version < other.version:

      TypeError: '<' not supported between instances of 'str' and 'int'

      >> an unknown error has occurred look at /tmp/anaconda* for more details.
      ~~~

      The problem here is the comparison is happening between 
      self "str"~"el8_10.x86_64" (or part of it) with other "int" ~ "47.1.el8_10.x86_64" (or part of it)

      If we separate out the numeric part before el8_10 and separate the version in 2 variables each and pass them to python LooseVersion, it would not fail.

              anaconda-maint-list anaconda-maint-list
              rhn-support-plawate Pranav Lawate
              anaconda-maint-list anaconda-maint-list
              Release Test Team Release Test Team
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: