Bookmark this page

Guided Exercise: Resolving Package Dependency Issues

Resolve a package dependency issue, and then lock the prerequisite package to the relevant version.

Outcomes

You should be able to resolve package dependency issues.

As the student user on the workstation machine, use the lab command to prepare your system for this exercise.

[student@workstation ~]$ lab start rpm-dependency

Instructions

The security team recently updated the system requirements for hosts in the data center. The update requires installing a custom package, rht-main, on each host.

A colleague attempted unsuccessfully to install rht-main on servera. You are asked to resolve this issue and to verify that the rht-main package installs successfully. After installing the rht-main package, ensure that you can update the prerequisite rht-prereq package. Create a version lock for the rht-prereq-0.1-1.el8 package.

  1. Log in to servera and switch to the root user.

    [student@workstation ~]$ ssh student@servera
    ...output omitted...
    [student@servera ~]$ sudo -i
    [sudo] password for student: student
    [root@servera ~]#
  2. Reproduce the issue, to collect and record troubleshooting information.

    1. Use YUM to install the rht-main package. View the transaction messages.

      [root@servera ~]# yum install rht-main
      Last metadata expiration check: 2:29:27 ago on Wed 13 Oct 2021 05:41:46 PM EDT.
      Error:
       Problem: package rht-main-0.1-1.el8.noarch requires rht-prereq = 0.1-1.el8, but none of the providers can be installed
        - conflicting requests
        - package rht-prereq-0.1-1.el8.noarch is filtered out by exclude filtering
      (try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

      The transaction message indicates that the rht-main package requires a specific version (0.1-1.el8) of the rht-prereq package.

    2. Use the yum install -v command to generate verbose transaction details.

      [root@servera ~]# yum -v install rht-main
      Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, groups-manager, kpatch, needs-restarting, playground, repoclosure, repodiff, repograph, repomanage, reposync, uploadprofile, versionlock
      YUM version: 4.4.2
      ...output omitted...
      Last metadata expiration check: 3:11:29 ago on Mon 18 Oct 2021 07:59:41 PM EDT.
      Completion plugin: Generating completion cache...
      Versionlock plugin: number of lock rules from file "/etc/dnf/plugins/versionlock.list" applied: 1
      --> Starting dependency resolution
      --> Finished dependency resolution
      Error:
       Problem: package rht-main-0.1-1.el8.noarch requires rht-prereq = 0.1-1.el8, but none of the providers can be installed
        - conflicting requests
        - package rht-prereq-0.1-1.el8.noarch is filtered out by exclude filtering
      (try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

      The Versionlock plugin line indicates that a single package is present in the version lock list. Therefore, your next steps are to view dependencies and to verify whether a version lock is the root cause of the issue.

  3. Use the yum deplist command to view the rht-main package dependencies.

    [root@servera ~]# yum deplist rht-main
    Last metadata expiration check: 2:01:55 ago on Wed 13 Oct 2021 05:41:46 PM EDT.
    package: rht-main-0.1-1.el8.noarch
      dependency: rht-prereq = 0.1-1.el8
       provider: rht-prereq-0.1-1.el8.noarch
  4. To list all versions, both installed and available, of the rht-prereq package that are known to the YUM configuration, use the yum list --showduplicates command.

    [root@servera ~]# yum list --showduplicates rht-prereq
    Last metadata expiration check: 2:01:24 ago on Wed 13 Oct 2021 05:41:46 PM EDT.
    Installed Packages
    rht-prereq.noarch                0.2-1.el8                             @rht_lab
    Available Packages
    rht-prereq.noarch                0.1-1.el8                             rht_lab
    rht-prereq.noarch                0.2-1.el8                             rht_lab

    The command output indicates that a later version of the rht-prereq package, 0.2-1.el8, is already installed. However, the rht-main package requires an earlier version of the rht-prereq package. Because YUM automatically resolves package requirements even with version conflicts, additional troubleshooting is required.

  5. To determine whether any packages have specific version locks, use the yum versionlock command.

    [root@servera ~]# yum versionlock
    Last metadata expiration check: 2:02:30 ago on Wed 13 Oct 2021 05:41:46 PM EDT.
    rht-prereq-0:0.2-1.el8.*

    The rht-prereq package is locked to a later version than the required version.

  6. To resolve the version lock conflict, delete the version lock for the rht-prereq-0:0.2-1.el8 package.

    [root@servera ~]# yum versionlock delete rht-prereq-0:0.2-1.el8
    Last metadata expiration check: 2:59:52 ago on Wed 13 Oct 2021 05:41:46 PM EDT.
    Deleting versionlock for: rht-prereq-0:0.2-1.el8.*
    1. Confirm the deletion.

      [root@servera ~]# yum versionlock
      Last metadata expiration check: 3:00:06 ago on Wed 13 Oct 2021 05:41:46 PM EDT.
      [root@servera ~]#
  7. Use the yum command to install the mandated rht-main package.

    [root@servera ~]# yum install rht-main
    Last metadata expiration check: 3:05:12 ago on Wed 13 Oct 2021 05:41:46 PM EDT.
    Dependencies resolved.
    ===============================================================================
     Package            Architecture        Version        Repository         Size
    ===============================================================================
    Installing:
     rht-main           noarch              0.1-1.el8      rht_lab            6.8 k
    Downgrading:
     rht-prereq         noarch              0.1-1.el8      rht_lab            6.7 k
    
    Transaction Summary
    ===============================================================================
    Install    1 Package
    Downgrade  1 Package
    
    Total size: 13 k
    Is this ok [y/N]: y
    Downloading Packages:
    Running transaction check
    Transaction check succeeded.
    Running transaction test
    Transaction test succeeded.
    Running transaction
      Preparing        :                                                        1/1
      Downgrading      : rht-prereq-0.1-1.el8.noarch                            1/3
      Installing       : rht-main-0.1-1.el8.noarch                              2/3
      Cleanup          : rht-prereq-0.2-1.el8.noarch                            3/3
      Verifying        : rht-prereq-0.1-1.el8.noarch                            1/3
      Verifying        : rht-prereq-0.2-1.el8.noarch                            2/3
      Verifying        : rht-main-0.1-1.el8.noarch                              3/3
    
    Downgraded:
      rht-prereq-0.1-1.el8.noarch
    Installed:
      rht-main-0.1-1.el8.noarch
    
    Complete!

    As displayed in the transaction summary, the yum command downgrades the rht-prereq package from version 0.2-1 to 0.1-1; installs the rht-main package; and then removes the rht-prereq-0.2-1.el8.noarch package.

  8. Now that the rht-main package is installed, attempt to update the prerequisite rht-prereq package. Because of dependencies, YUM generates an error message and fails.

    [root@servera ~]# yum update rht-prereq
    Last metadata expiration check: 3:58:51 ago on Wed 13 Oct 2021 05:41:46 PM EDT.
    Error:
     Problem: problem with installed package rht-main-0.1-1.el8.noarch
      - package rht-main-0.1-1.el8.noarch requires rht-prereq = 0.1-1.el8, but none of the providers can be installed
      - cannot install both rht-prereq-0.2-1.el8.noarch and rht-prereq-0.1-1.el8.noarch
      - cannot install the best update candidate for package rht-prereq-0.1-1.el8.noarch
    (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)
  9. Create a version lock for the installed rht-prereq package. Adding a version lock ensures that YUM ignores any attempt to update the rht-prereq-0.1-1.el8 package.

    1. To lock the installed version of the rht-prereq package, use the yum versionlock add command.

      [root@servera ~]# yum versionlock add rht-prereq
      Last metadata expiration check: 0:32:06 ago on Wed 13 Oct 2021 09:52:41 PM EDT.
      Adding versionlock on: rht-prereq-0:0.1-1.el8.*
    2. Verify that the versionlock list includes the rht-prereq-0:0.1-1.el8 package.

      [root@servera ~]# yum versionlock
      Last metadata expiration check: 0:34:09 ago on Wed 13 Oct 2021 09:52:41 PM EDT.
      rht-prereq-0:0.1-1.el8.*
  10. To verify that YUM no longer prints an error message when attempting to update the rht-prereq package, run the yum update command again.

    [root@servera ~]# yum update rht-prereq
    Last metadata expiration check: 0:36:01 ago on Wed 13 Oct 2021 09:52:41 PM EDT.
    Dependencies resolved.
    Nothing to do.
    Complete!
  11. Return to workstation as the student user.

    [root@servera ~]# exit
    [student@servera ~]$ exit
    [student@workstation ~]$

Finish

On the workstation machine, use the lab command to complete this exercise. This is important to ensure that resources from previous exercises do not impact upcoming exercises.

[student@workstation ~]$ lab finish rpm-dependency

Revision: rh342-8.4-6dd89bd