Createrepo causes module conflict on RHEL 8 reposync

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 9
  • createrepo_c version 0.16.2-1.el8[Fixed]

Issue

  • How to manually insert module metadata into existing repodata

  • Repository mirror for RHEL8 created via createrepo_c command does not handle modules information correctly:

    # yum update
    ...
    Error:
     Problem 1: cannot install both perl-libs-4:5.24.4-404.module+el8.1.0+2926+ce7246ad.x86_64 and perl-libs-4:5.26.3-416.el8.x86_64
      - package perl-Algorithm-Diff-1.1903-10.module+el8.1.0+2926+ce7246ad.noarch requires perl(:MODULE_COMPAT_5.24.4), but none of the providers can be installed
      - cannot install the best update candidate for package perl-libs-4:5.26.3-416.el8.x86_64
      - cannot install the best update candidate for package perl-Algorithm-Diff-1.1903-9.el8.noarch
    
  • After switching to direct update from Red Hat provided repositories, then there are no errors.

Resolution

RHEL 8

 # reposync --download-metadata --repo <repo-id>

  • If you use createrepo on a RHEL 8 repository, you must also:
    • add the comps.xml with createrepo for groups
    • add the updateinfo.xml from cache for security package identification
    • add the modules.yaml from cache for modules, and you have to do this or you will encounter massive dependency issues.
# rm -rf /var/cache/dnf
# yum module list && yum updateinfo
# reposync --repo <repo-id> --download-path=/var/www/html

### With the repository downloaded, we now need to build the repodata. We should be sitting in the root of the repository.

# cd /var/www/html/<repo-id>

# cp $(find /var/cache/dnf/<repo-id>* -name *comps.xml) comps.xml
# createrepo -g comps.xml ./

### Find and add the module data  **NOTE** createrepo_c-0.16.2-2.el8 and later will automatically detect and include the modules.yaml, if present in the repo directory.

#  gunzip $(find /var/cache/dnf/<repo-id>* -name *modules.yaml.gz) -c > modules.yaml
# modifyrepo modules.yaml repodata/

###Find and add the security data
# gunzip $(find /var/cache/dnf/<repo-id>* -name *updateinfo.xml.gz) -c > updateinfo.xml
# modifyrepo updateinfo.xml repodata/

Note

  • The modular metadata will be all inclusive. If you use this on minimal repositories, it won't know what packages are missing

RHEL 9

  • RHEL 9 is not affected by this issue.
    • RHEL 9 shipped package createrepo_c-0.17.2-5.el9.x86_64.rpm is higher than the fix version createrepo_c-0.16.2-2.el8.

Root Cause

  • Red Hat Enterprise Linux 8 introduced new feature - modules. Information on this feature can be found in official documentation : Introduction to modules

  • Unfortunately the RPM packages do not contain data that are required for separating packages into modules. As reposync and createrepo_c(versions prior to createrepo_c-0.16.2-1.el8) only process RPM package information, they cannot handle the modules and so module information does not exist in the created repo. As a result yum/dnf is having 2 conflicting packages with the same version.

  • The issue was tracked in Red Hat Bugzilla This content is not included.Bug 1795936 - [RFE] createrepo_c should be able to handle modules information and is fixed in version createrepo_c-0.16.2-2.el8

Diagnostic Steps

  • Any version lower than createrepo_c-0.16.2-1.el8 would face this issue.

  • Check the installed version of package

    # rpm -q createrepo_c 
    createrepo_c-0.11.0-3.el8.x86_64
    
SBR

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.