Ubuntu: Find out if installed package is a dependent to other installed package



Question:

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.


Solution: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  


Solution:2

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]  


Solution:3

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'  


Solution:4

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.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »