dnf failed to update ruby package from 2.7 module stream in RHEL 8

Solution Verified - Updated -

Environment

Red Hat Enterprise Linux 8

Issue

  • While trying to update ruby package from 2.7 module stream , following errors are observed:

    # dnf update ruby.x86_64
    Updating Subscription Management repositories.
    ...
    
    Error:
    Problem: problem with installed package libselinux-ruby-2.9- 
    5.el8.x86_64
    - package libselinux-ruby-2.9-5.el8.x86_64 requires libruby.so.2.5() 
    (64bit), but none of the providers can be installed
    - cannot install both ruby-libs-2.7.4- 
    137.module+el8.4.0+12025+f744ca41.x86_64 and ruby-libs-2.5.9-107.module+el8.4.0+10822+fe4fffb1.x86_64
    - package ruby-2.7.4-137.module+el8.4.0+12025+f744ca41.x86_64 requires ruby-libs(x86-64) = 2.7.4-137.module+el8.4.0+12025+f744ca41, but none of the providers can be installed
    - cannot install the best update candidate for package ruby-2.5.9-107.module+el8.4.0+10822+fe4fffb1.x86_64
    - package ruby-libs-2.5.3-104.module+el8.0.0+3250+4b7d6d43.x86_64 is filtered out by modular filtering
    - package ruby-libs-2.5.5-105.module+el8.1.0+3656+f80bfa1d.x86_64 is filtered out by modular filtering
    - package ruby-libs-2.5.3-103.module+el8+2671+ebcc7ee0.x86_64 is filtered out by modular filtering
    - package ruby-libs-2.5.5-106.module+el8.3.0+7153+c6f6daa5.x86_64 is filtered out by modular filtering
    - package ruby-libs-2.5.9-107.module+el8.4.0+10822+fe4fffb1.x86_64 is filtered out by modular filtering
    (try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)                                                                                                                                   
    

Resolution

  • Ensure that 2.7 module stream of ruby package is already enabled on RHEL 8 server. For more information about how to switch module stream please refer to the article .

  • If 2.7 module stream of ruby package is enabled in the system, take a snapshot/backup of the server and execute the following command.

    # yum clean all
    # yum --allowerasing distro-sync ruby.x86_64
    # yum update ruby.x86_64                                                                                                                                          
    

Root Cause

While attempting to upgrade the ruby package,ruby-2.7.4-137.module requires ruby-libs(x86-64) = 2.7.4, however ruby-libs-2.5.9-107.module is not getting removed automatically by dnf.
Here the use of using --allowerasing option with yum\dnf command will allow resolving the dependency explicitly and help with the removal of the older dependent package.

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.

Comments