• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

CentOS/RHEL: How to find the package with a missing file using YUM

by admin

Question: How to find the package with a missing file in the system using YUM? This how-to is also applicable when the file is not missing and is already installed, but for some reason, it is required to know the package that provides it.

The YUM package manager tool uses repositories to retrieve information and download packages. The repositories configurations are at /etc/yum.repos.d/*.repo files and in these files it can be multiple repositories enabled and others disabled.

1. The sub command to use is “provides”. For example, looking for /usr/src/kernels/4.1.12-124.18.6.el7uek.x86_64 file:

# yum provides /usr/src/kernels/4.1.12-124.18.6.el7uek.x86_64

This will show the repository and package that need to installed to have it in the system.

2. But the command might not find the package because repository that has it is disabled:

No Matches found

In that case it can be attempted to enable all or just one repository to search. For that has to be using option –enablerepo. FOr example, using all repositories configured in the .repo files, eanbled and disabaled.

# yum provides /usr/src/kernels/4.1.12-124.18.6.el7uek.x86_64 --enablerepo=*

or just a specific repo:

# yum provides /usr/src/kernels/4.1.12-124.18.6.el7uek.x86_64 --enablerepo=ol7_UEKR4_archive

or multiple ones matching a regular expression

# yum provides /usr/src/kernels/4.1.12-124.18.6.el7uek.x86_64 --enablerepo=ol7_*_archive

Sample Output:

kernel-uek-devel-4.1.12-124.18.6.el7uek.x86_64 : Development package for building kernel modules to match the kernel
Repo        : ol7_UEKR4_archive
Matched from:
Filename    : /usr/src/kernels/4.1.12-124.18.6.el7uek.x86_64

3. If the final goal is to install it and it was only possible using option –enablerepo, use same option to install the package:

# yum install kernel-uek-devel-4.1.12-124.18.6.el7uek.x86_64 --enablerepo=ol7_UEKR4_archive

If looking for a file that the path location is unknown, a file path with wildcard can be used:

# yum provides */fileX

Filed Under: CentOS/RHEL 6, CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. apt-cache: command not found
  2. How to Configure Device File owner/group with udev rules
  3. homectl Command Examples in Linux
  4. lpr: command not found
  5. compsize: command not found
  6. chcpu: command not found
  7. pvcreate Command Examples in Linux
  8. LVM VG Metadata Corruption with ‘Checksum error’
  9. ‘lxc_cgfs – Device or resource busy – failed to set memory.use_hierarchy to 1; continuing’ – error while starting LXC container
  10. dbus-daemon Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • pw-cat Command Examples in Linux
  • pvs: command not found
  • pulseaudio: command not found
  • pulseaudio Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright