2

According to the title that.

Solution like this one: apt-cache rdepends packagename

Does list all the reverse package. Although most of the packages in the list I do not have in my system installed. Example:

apt-cache rdepends python-gpgme
python-gpgme

Reverse Depends:
  python-bzrlib
  bzr
  python-gpgme:i386
  nautilus-dropbox
  assword
  alot
  python-gpgme-dbg
  python-bzrlib
  bzr

I do not have bzr, nautilus, alot, and others installed.

So, what is the correct command to find out the list of installed dependent package to that "target" package?

I need to know if python-gpgme is OKAY to purge.

2

4 Answers 4

3

If in doubt, just use the -s (aka --simulate, --just-print, --dry-run, --recon and --no-act) flag. You can run the command without root and it'll tell you what it would do based on your current packages.

$ apt-get remove -s python-gpgme
NOTE: This is only a simulation!
      apt-get needs root privileges for real execution.
      Keep also in mind that locking is deactivated,
      so don't depend on the relevance to the real current situation!
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED
  python-gpgme
0 to upgrade, 0 to newly install, 1 to remove and 217 not to upgrade.
Remv python-gpgme [0.3-0ubuntu3]
1
  • In addition, even when removing a package (outside of simulation), I believe apt will give you the list of packages it will be removing and ask for confirmation. To add to this, running sudo apt-get autoremove will remove any auto-installed packages (usually libraries) that are no longer needed. Jul 15, 2014 at 15:51
2

With aptitude's search patterns (verbose syntax and equivalent shorthand syntax):

aptitude search '?depends(python-gpgme) ?installed'
aptitude search '~Dpython-gpgme ~i'

To include recommendations as well as strict dependencies:

aptitude search '(?depends(python-gpgme) | ?recommends(python-gpgme)) ?installed'
aptitude search '(~Dpython-gpgmg | ~Drecommends:python-gpgme) ~i'
2

Or, using aptitude as Gilles answer, just use the why command that will show you "why a package was installed":

aptitude why python-gpgme

For example:

➜  ~  aptitude why python-gpgme
i   bzr Recommends python-gpgme

This tells me, that if there was a reason to install python-gpgme it would be due bzr package that it's installed.

1

You can also do:

sudo dpkg -s <package_name> | grep Depends

For example:

sudo dpkg -s bcmwl-kernel-source | grep Depends 
Depends: dkms, linux-libc-dev, libc6-dev
1
  • 1
    This is only going to show first-line dependencies. It won't show you something that depends on one of these dependencies (so it might not give you a full picture of whether something or not will be safe to remove).
    – Oli
    Jul 15, 2014 at 16:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .