0

In opkg (package manager in OpenWRT) I can get dependents pages of some package. For example

command

opkg depends vsftpd

will outptut

vsftpd depends on:
        libc

Is there any alternative to this command in dpkg (on Debain)?

1

On Debian you can use apt-cache to query the package database. There are several ways of getting a list of dependencies, varying in behaviour and output format:

  • Print dependencies (name only) for a specific package version:

    apt-cache depends <pkg_name>[=version|/target_release]
    
  • Print package information (including dependency name+version) for each available package version:

    apt-cache showpkg <pkg_name>
    
  • Print human readable package information for each available package version:

    apt-cache show <pkg_name>[=version|/target_release]
    

Consult man apt-cache for full syntax and available command line options (such as --no-recommends, --no-suggests, --no-all-versions).

Consider grepping the output (see examples below) but note that in Debian there are several types of dependency and whilst apt-get install <pkg_name> will always try to install ones listed as Depends:, it might also try to install ones listed as Recommends: (a default behaviour).


Example outputs:

  • apt-cache depends vsftpd | grep Depends:

      |Depends: debconf
      Depends: <debconf-2.0>
      Depends: init-system-helpers
      Depends: libc6
      Depends: libcap2
      Depends: libpam0g
      Depends: libssl1.0.0
      Depends: libwrap0
      Depends: adduser
      Depends: dialog
      Depends: libpam-modules
      Depends: netbase
    
  • apt-cache showpkg vsftpd | grep -A1 Dependencies:

    Dependencies:
    3.0.3-5 - debconf (18 0.5) debconf-2.0 (0 (null)) init-system-helpers (2 1.18~) libc6 (2 2.15) libcap2 (2 1:2.10) libpam0g (2 0.99.7.1) libssl1.0.2 (2 1.0.2d) libwrap0 (2 7.6-4~) adduser (0 (null)) libpam-modules (0 (null)) netbase (0 (null)) logrotate (0 (null)) ssl-cert (0 (null)) ftp-server (0 (null)) ftp-server (0 (null))
    
  • apt-cache show vsftpd | grep Depends:

    Depends: debconf (>= 0.5) | debconf-2.0, init-system-helpers (>= 1.18~), libc6 (>= 2.15), libcap2 (>= 1:2.10), libpam0g (>= 0.99.7.1), libssl1.0.2 (>= 1.0.2d), libwrap0 (>= 7.6-4~), adduser, libpam-modules, netbase
    
  • apt-cache depends vsftpd | grep Depends | grep -o '[^ ]*$' works exactly as I want. Thank you very much for help. – Misaz Aug 9 '16 at 19:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.