Welcome to the Linux Foundation Forum!

rpm Query Command Examples

In lesson 06. RPM, Table: rpm Query Command Example

This example is wrong.
rpm -q --whatprovides libc.so.6
No package provides libc.so.6

The --whatprovides option will show which package provides this file
rpm -q --whatprovides bash

It is long option for the -f option, but must use the full path to the installed file.
rpm -qf /bin/bash

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Answers

  • Posts: 1,276

    Hi @mike1234432 ,

    It also works with libraries, but you need to specify the path. Look at this (on CentOS Stream 8):

    [luis@centos8server ~]$ rpm -q --whatprovides /usr/lib64/libc.so.6
    glibc-2.28-167.el8.x86_64

    It also can be done with dnf (with the filename only):

    [luis@centos8server ~]$ dnf whatprovides libc.so.6
    Last metadata expiration check: 1 day, 22:48:14 ago on Mon 02 May 2022 10:55:46 AM -05.
    glibc-2.28-155.el8.i686 : The GNU libc libraries
    Repo : baseos
    Matched from:
    Provide : libc.so.6

    glibc-2.28-158.el8.i686 : The GNU libc libraries
    Repo : baseos
    Matched from:
    Provide : libc.so.6

    [...]

    I'll inform the team of the missing path!

    Many regards,
    Luis.

  • Posts: 916

    Unless I'm dense or there is a difference between RHEL 8 and CentOS-8-stream, I see no problem:

    1. c8:/tmp>rpm -q --whatprovides libc.so.6
    2. glibc-2.28-164.el8_5.3.i686
    3. c8:/tmp>rpm -q --whatprovides bash
    4. bash-4.4.20-2.el8.x86_64
    5. c8:/tmp>rpm -q --whatprovides /bin/bash
    6. bash-4.4.20-2.el8.x86_64
    7. c8:/tmp>
    8.  

    Full path not required at all. I don't see an issue here or anything wrong

  • Posts: 1,276

    Hi @coop ,

    Unless I'm dense or there is a difference between RHEL 8 and CentOS-8-stream, I see no problem:

    Yep, there is a difference between these distros. That's why it won't work the same way on CentOS Stream 8 (and probably 9 as well).

    Regards,
    Luis.

  • Posts: 916

    i investigated this further. RHEL 8 and CentOS 8 stream have the same version of rpm as reported by rpm --version (4.14.3) although C8 has a slighter newer rpm package subrelease, but I doubt the change is there. (CentOS-9-Stream behaves as C8 Stream. Research and the man page for rpm indicate no real explanation of what the argument to --whatprovides should be, but it appears it should be the full path as was pointed out, unless it is a package name (such as "bash"). Probably should clarify this in the future, but apparently until recently the behaviour in RHEL 8 was widely accepted as correct .

  • Posts: 916

    btw, RHEL 8.6 which came out yesterday has the CentOS-8-Stream behaviour. These commands seem identical:

    1. rpm -qf /lib*/libco.so.6
    2. rpm --q --whatprovides /lib*/libco.so.6

    so the whatprovides option has little value unless you use it with the name of a package, such as bash, rather than a full path.

  • Posts: 1,276

    Hi @coop,

    so the whatprovides option has little value unless you use it with the name of a package, such as bash, >rather than a full path.

    Yep, I have used the command in the past with package names mainly.

    Regards,
    Luis.

  • thanks @luisviveropena , I was having the same problem using a Fedora system

  • Posts: 1,276

    Hi @donquijotedelasnubes , it's a pleasure!

    Saludos :)
    Luis.

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training