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

Answers

  • luisviveropena
    luisviveropena Posts: 896

    Hi @mike1234432 ,

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

    [[email protected] ~]$ 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):

    [[email protected] ~]$ 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.

  • coop
    coop Posts: 844

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

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

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

  • luisviveropena
    luisviveropena Posts: 896

    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.

  • coop
    coop Posts: 844

    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 .

  • coop
    coop Posts: 844

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

    rpm -qf /lib*/libco.so.6
    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.

  • luisviveropena
    luisviveropena Posts: 896

    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

  • luisviveropena
    luisviveropena Posts: 896

    Hi @donquijotedelasnubes , it's a pleasure!

    Saludos :)
    Luis.

Categories

Upcoming Training