20

I'm going to install an RPM package and I can see that some of dependencies requires X server libraries to be installed as well. I'm absolutely sure that the package I need is a server software and does not need X server.

I wonder if there is a way to print a list of RPM dependencies like it's done in Gentoo Linux?

   enter image description here

This command prints first level dependencies only, so it does not suit me:

$ yum deplist <package name>
Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232
Anthony Ananich
  • 7,334
  • 5
  • 33
  • 45

2 Answers2

32

In RHEL6 there is command repoquery from yum-utils package. It can do this:

# repoquery --tree-requires bash
bash-4.1.2-15.el6_4.x86_64 [cmd line]
 \_  glibc-2.12-1.132.el6_5.4.i686 [1: rtld(GNU_HASH)]
 |   \_  basesystem-10.0-4.el6.noarch [1: basesystem]
 |   |   \_  filesystem-2.4.30-3.el6.x86_64 [1: filesystem]
 |   |   |   \_  setup-2.8.14-20.el6_4.1.noarch [1: setup >= 2.5.4-1]
 |   |   \_  setup-2.8.14-20.el6_4.1.noarch [1: setup]
 |   \_  glibc-common-2.12-1.132.el6_5.4.x86_64 [1: glibc-common = 2.12-1.132.el6_5.4]
 |   |   \_  bash-4.1.2-15.el6_4.x86_64 [2: /bin/bash, /bin/sh]
 |   |   |   \_  glibc-2.12-1.132.el6_5.4.i686 [1: rtld(GNU_HASH)]
 |   |   |   \_  glibc-2.12-1.132.el6_5.4.x86_64 [4: libc.so.6(GLIBC_2.4)(64bit), libdl.so.2()(64bit), libdl.so.2(GLIBC_2.2.5)(64bit), rtld(GNU_HASH)]
 |   |   |   \_  ncurses-libs-5.7-3.20090208.el6.i686 [1: ncurses-libs]
 |   |   |   \_  ncurses-libs-5.7-3.20090208.el6.x86_64 [2: libtinfo.so.5()(64bit), ncurses-libs]
 |   |   \_  glibc-2.12-1.132.el6_5.4.i686 [1: glibc = 2.12-1.132.el6_5.4]
 |   |   \_  glibc-2.12-1.132.el6_5.4.x86_64 [4: glibc = 2.12-1.132.el6_5.4, libc.so.6(GLIBC_2.3)(64bit), libdl.so.2()(64bit), libdl.so.2(GLIBC_2.2.5)(64bit)]
 |   |   \_  libcap-2.16-5.5.el6.x86_64 [1: libcap.so.2()(64bit)]
 |   |   |   \_  glibc-2.12-1.132.el6_5.4.i686 [2: /sbin/ldconfig, rtld(GNU_HASH)]
 |   |   |   \_  glibc-2.12-1.132.el6_5.4.x86_64 [3: /sbin/ldconfig, libc.so.6(GLIBC_2.3.3)(64bit), rtld(GNU_HASH)]
 |   |   |   \_  libattr-2.4.44-7.el6.x86_64 [2: libattr.so.1()(64bit), libattr.so.1(ATTR_1.0)(64bit)]
 |   |   |   |   \_  glibc-2.12-1.132.el6_5.4.i686 [2: /sbin/ldconfig, rtld(GNU_HASH)]
 |   |   |   |   \_  glibc-2.12-1.132.el6_5.4.x86_64 [3: /sbin/ldconfig, libc.so.6(GLIBC_2.4)(64bit), rtld(GNU_HASH)]
 |   |   \_  tzdata-2014e-1.el6.noarch [1: tzdata >= 2003a]
 |   \_  libgcc-4.4.7-4.el6.i686 [1: libgcc]
 |   \_  libgcc-4.4.7-4.el6.x86_64 [1: libgcc]
 |   \_  nss-softokn-freebl-3.14.3-10.el6_5.i686 [2: libfreebl3.so, libfreebl3.so(NSSRAWHASH_3.12.3)]
 |   |   \_  glibc-2.12-1.132.el6_5.4.i686 [5: libc.so.6(GLIBC_2.7), libdl.so.2, libdl.so.2(GLIBC_2.0), libdl.so.2(GLIBC_2.1), rtld(GNU_HASH)]
 |   |   \_  glibc-2.12-1.132.el6_5.4.x86_64 [1: rtld(GNU_HASH)]
 \_  glibc-2.12-1.132.el6_5.4.x86_64 [4: libc.so.6(GLIBC_2.4)(64bit), libdl.so.2()(64bit), libdl.so.2(GLIBC_2.2.5)(64bit), rtld(GNU_HASH)]
 |   \_  basesystem-10.0-4.el6.noarch [1: basesystem]
 |   \_  glibc-common-2.12-1.132.el6_5.4.x86_64 [1: glibc-common = 2.12-1.132.el6_5.4]
 |   \_  libgcc-4.4.7-4.el6.i686 [1: libgcc]
 |   \_  libgcc-4.4.7-4.el6.x86_64 [1: libgcc]
 |   \_  nss-softokn-freebl-3.14.3-10.el6_5.x86_64 [2: libfreebl3.so()(64bit), libfreebl3.so(NSSRAWHASH_3.12.3)(64bit)]
 |   |   \_  glibc-2.12-1.132.el6_5.4.i686 [1: rtld(GNU_HASH)]
 |   |   \_  glibc-2.12-1.132.el6_5.4.x86_64 [4: libc.so.6(GLIBC_2.7)(64bit), libdl.so.2()(64bit), libdl.so.2(GLIBC_2.2.5)(64bit), rtld(GNU_HASH)]
 \_  ncurses-libs-5.7-3.20090208.el6.i686 [1: ncurses-libs]
 |   \_  glibc-2.12-1.132.el6_5.4.i686 [6: /sbin/ldconfig, libc.so.6(GLIBC_2.4), libdl.so.2, libdl.so.2(GLIBC_2.0), libdl.so.2(GLIBC_2.1), rtld(GNU_HASH)]
 |   \_  glibc-2.12-1.132.el6_5.4.x86_64 [2: /sbin/ldconfig, rtld(GNU_HASH)]
 |   \_  ncurses-base-5.7-3.20090208.el6.x86_64 [1: ncurses-base = 5.7-3.20090208.el6]
 \_  ncurses-libs-5.7-3.20090208.el6.x86_64 [2: libtinfo.so.5()(64bit), ncurses-libs]
 |   \_  glibc-2.12-1.132.el6_5.4.i686 [2: /sbin/ldconfig, rtld(GNU_HASH)]
 |   \_  glibc-2.12-1.132.el6_5.4.x86_64 [5: /sbin/ldconfig, libc.so.6(GLIBC_2.4)(64bit), libdl.so.2()(64bit), libdl.so.2(GLIBC_2.2.5)(64bit), rtld(GNU_HASH)]
 |   \_  ncurses-base-5.7-3.20090208.el6.x86_64 [1: ncurses-base = 5.7-3.20090208.el6]
Anthony Ananich
  • 7,334
  • 5
  • 33
  • 45
  • What version of repoquery is this? I'm on F20 w/ version: 0.0.11 which does not include this switch. – slm Sep 02 '14 at 13:49
  • 1.1.30-17.el6_5 – Anthony Ananich Sep 02 '14 at 13:50
  • So that switch might not be a standard switch, it's likely only with an older version or a forked version for RHEL. – slm Sep 02 '14 at 13:53
  • Right you are. Even top have different switch set in different distros: http://unix.stackexchange.com/q/105908/16253 – Anthony Ananich Sep 02 '14 at 13:58
  • Yeah so I'd prefix your A so that it's clear this isn't standard switching, or find a general solution too and add it to this A. – slm Sep 02 '14 at 14:00
  • @slm - I'm also on F20 with version 0.0.11 and mine does have the --tree-requires option. – garethTheRed Sep 02 '14 at 14:33
  • @garethTheRed - I see the issue now, look in the repoquery --help and the man page. It's not listed there. Also doing a repoquery -- and hitting Tab doesn't list it, yet if you run that command it works. Looks like a issue should be filed against repoquery to get the help and usage updated. – slm Sep 02 '14 at 14:38
  • @AnthonyAnanich - is that option listed in the man page or in the --help? How did you come to find out about this switch? – slm Sep 02 '14 at 14:39
  • @slm, @AnthonyAnanich - I've just checked CentOS 7 and it's missing, but on CentOS 6.5 it's shown in repoquery --help and the man page.. – garethTheRed Sep 02 '14 at 14:42
  • Wow someone really did a great job on this one 8-). I checked and it's not in F19 or CentOS 5 either. It doesn't exist in CentOS 5 in any way shape or form. So that would seem to indicate that it might show up in F10-F14, perhaps. – slm Sep 02 '14 at 14:47
  • Thanks! In my case, I needed the package dependencies, so this did the trick for me: repoquery --installed --tree-whatrequires <package>. – Deacon Aug 21 '23 at 14:02
0

For new OS versions, please use below (replace bash with your package name). repoquery from yum-utils but with available switches.

# repoquery --requires bash --tree
asktyagi
  • 675