Bookmark this page

Chapter 6.  Troubleshooting RPM Issues

Abstract

Goal

Identify and resolve issues with the package management subsystem.

Objectives
  • Identify and resolve package dependency issues.

  • Identify and rebuild a corrupted RPM database.

  • Identify and restore changed files with package management tools.

  • Register a system with Red Hat and manage Red Hat subscriptions.

Sections
  • Resolving Package Dependency Issues (and Guided Exercise)

  • Recovering a Corrupted RPM Database (and Guided Exercise)

  • Identifying and Recovering RPM Managed Files (and Guided Exercise)

  • Managing Red Hat Subscriptions

Lab
  • Troubleshooting RPM Issues

Resolving Package Dependency Issues

Objectives

  • Identify and resolve package dependency issues.

Package Management

Package management is the method of installing, updating, removing, and tracking software updates. The RPM Package Manager (RPM) and Yellowdog Updater Modified (YUM) are both Linux-based package managers. YUM v4, which is used in Red Hat Enterprise Linux 8, is based on Dandified YUM (DNF) technology. It is the primary package manager in RHEL, and is compatible with YUM v3 in RHEL 7. The yum command is a symbolic link to the dnf command. Most 'yum' options work the same in RHEL 8 as in earlier RHEL versions.

RHEL 8 content is distributed through two main repositories:

BaseOS

Content in the BaseOS repository provides the core set of the OS functionality that is the underlying foundation for all installations. This content is available in the RPM format and is subject to similar support terms in previous releases of RHEL.

AppStream

Content in the AppStream repository includes additional user-space applications, runtime languages, and databases to support various workloads and use cases. Content in AppStream is available in one of two formats: the familiar RPM format and an extension to the RPM format called modules. Modules are collections of packages.

Package Dependencies

Package dependencies occur when an RPM package requires functionality from other RPM packages. Package requirements are defined in the metadata of each RPM package.

Installing Packages with Dependencies

Although the rpm command can install, upgrade, and remove individual RPM packages, it does not automatically install package dependencies. Alternatively, the yum command can install a package with dependencies; it can also install, upgrade, or downgrade dependency packages according to the defined requirements in the package metadata.

Diagnosing Dependency Issues

The /var/log/dnf.log file contains the history of installed and erased packages, but does not provide sufficient information when dependency issues occur. To display diagnostic information during package installation, use the -v option with the yum install command. Multiple -v options generate increasingly verbose details.

[root@host ~]# yum install -v yum
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...
Versionlock plugin: number of lock rules from file "/etc/dnf/plugins/versionlock.list" applied: 1
Package yum-4.4.2-11.el8.noarch is already installed.
--> Starting dependency resolution
--> Finished dependency resolution
Dependencies resolved.
Nothing to do.
Complete!

Displaying Package Dependencies

The yum deplist command displays a list of dependencies for a specified package. The command prints the name and the latest available package version that satisfies each dependency.

[root@host ~]# yum deplist yum
Last metadata expiration check: 1 day, 2:06:36 ago on Tue 19 Oct 2021 09:26:43 PM EDT.
package: yum-4.4.2-11.el8.noarch
  dependency: dnf = 4.4.2-11.el8
   provider: dnf-4.4.2-11.el8.noarch

Alternatively, use the rpm command to display package dependency information. The --requires option, or -R, displays the other packages that this package requires.

[root@host ~]# rpm -q --requires yum
config(yum) = 4.4.2-11.el8
dnf = 4.4.2-11.el8
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsXz) <= 5.2-1

Additionally, use the rpm -q --provides command to list capabilities that this package provides for other packages.

[root@host ~]# rpm -q --provides yum
config(yum) = 4.4.2-11.el8
yum = 4.4.2-11.el8

Resolving Package Dependencies

The yum downgrade command replaces the specified package with an earlier version of that package by removing the currently installed package and installing the earlier version in its place. YUM downgrades to a specific package version if a valid version is specified in the command. Downgrading works for packages that allow only one version to be installed on the system at a time. Some packages, such as for the Linux kernel, C library, SELinux, or the system dbus, are restricted to update-only or install-only and cannot be downgraded.

Important

If the package to downgrade is a prerequisite for other installed packages, then the dependent packages might also require being specified and downgraded.

Listing All Versions of a Package

Use the yum list --showduplicates command option to list all versions of a package, both installed and available.

[root@host ~]# yum list --showduplicates python3-bind.noarch
Last metadata expiration check: 0:02:57 ago on Sat 23 Oct 2021 08:07:39 PM EDT.
Installed Packages
python3-bind.noarch      32:9.11.26-4.el8_4   @rhel-8-for-x86_64-appstream-rpms
Available Packages
python3-bind.noarch      32:9.11.26-3.el8     rhel-8.4-for-x86_64-appstream-rpms

Using YUM to Lock Package Versions

The YUM versionlock subcommand locks down a package or group of packages to a specific version. The python3-dnf-plugin-versionlock.noarch plug-in package provides the versionlock subcommand.

The following table lists common versionlock command options:

CommandFunction
yum versionlock list Display the list of locked package versions.
yum versionlock add WILDCARD Lock the current versions of the packages that the wildcard matched.
yum versionlock delete WILDCARD Delete the locks that the wildcard matched.
yum versionlock clear Clear all package version locks.

When a specific version of a package is locked, YUM does not attempt to update the package when using yum update. Version locking typically maintains an interdependent set of packages at the required versions for the application that they belong to.

Viewing Transaction History

YUM history provides information about the timeline of YUM transactions, the dates and times when they occurred, the number of affected packages, whether these transactions succeeded or were aborted, and whether the RPM database was changed between transactions.

Use the yum history command to list, revert, and repeat transactions. To display a list of the latest YUM transactions, use the yum history command without subcommands:

[root@host ~]# yum history
ID     | Command line             | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
     7 | install dovecot          | 2021-10-23 20:37 | Install        |    2
...output omitted...
     2 | -y upgrade               | 2021-06-14 03:38 | I, O, U        |   33
     1 | localinstall -y test.rpm | 2021-06-14 03:37 | Install        |    1 EE

To view specific transaction details, use the info subcommand with the transaction ID:

[root@host ~]# yum history info 7
Transaction ID : 7
Begin time     : Sat 23 Oct 2021 08:37:12 PM EDT
Begin rpmdb    : 639:4dc8e19f4fa090599874bee11c2dcf30b4e53bdd
End time       : Sat 23 Oct 2021 08:37:15 PM EDT (3 seconds)
End rpmdb      : 641:942bc72f7299bd957f1bb643f5c63bc5fdd0bbc6
User           : Student User <student>
Return-Code    : Success
Releasever     : 8
Command Line   : install dovecot
Comment        :
Packages Altered:
    Install clucene-core-2.3.3.4-31.20130812.e8e3d20git.el8.x86_64
      @rhel-8.4-for-x86_64-appstream-rpms
    Install dovecot-1:2.3.8-9.el8.x86_64
      @rhel-8.4-for-x86_64-appstream-rpms

To revert a specific transaction, use the undo subcommand with the transaction ID:

[root@host ~]# yum history undo 7

To repeat a specific transaction, use the redo subcommand with the transaction ID:

[root@host ~]# yum history redo 7

References

rpm(8), yum(8), and yum-versionlock(1) man pages

For further information, refer to Chapter 12. Managing Software Packages at https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/configuring_basic_system_settings/index#managing-software-packages_configuring-basic-system-settings

Revision: rh342-8.4-6dd89bd