We're an ISO27001:2013 Certified Supplier


Debian tends to prefer more finely grained packages than some other Linux distributions, but that can lead to there being a lot of packages installed. For example, on one reasonably simple server we have almost 2000 packages installed. On my workstation, I have over 3000. Sometimes it’s hard to know exactly why any given package is installed.

aptitude why

The aptitude why command can help with that question:

$ aptitude why xfce4-panel 
i   task-xfce-desktop Depends xfce4                   
i A xfce4             Depends xfce4-panel (>= 4.12.0)

Here we can see that xfce4-panel is installed because xfce4 requires it, and xfce4 is installed because task-xfce-desktop requires it.

In this next example, we can see that exim4 is installed because rt4-clients requires either exim4 or some other MTA:

$ aptitude why exim4
i   rt4-clients Depends exim4 | mail-transport-agent

But why is rt4-clients installed? We can check:

$ aptitude why rt4-clients
Manually installed, current version 4.4.1-3+deb9u3, priority optional
No dependencies require to install rt4-clients

Answer: it was manually installed.

aptitude why-not

Certain packages will conflict, and aptitude why-not will show us why a given package cannot be installed:

$ aptitude why-not postfix
i   exim4        Depends   exim4-base (< 4.89-2+deb9u3.1)         
i A exim4-base   Depends   exim4-config (>= 4.82) | exim4-config-2
i A exim4-config Conflicts postfix

The example above shows why postfix cannot be installed on this system. We get similar information if we try to install it:

# apt install postfix
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
Suggested packages:
  postfix-mysql postfix-pgsql postfix-ldap postfix-pcre postfix-lmdb sasl2-bin postfix-cdb ufw
The following packages will be REMOVED:
  exim4 exim4-base exim4-config exim4-daemon-light
The following NEW packages will be installed:
  postfix postfix-sqlite
0 upgraded, 2 newly installed, 4 to remove and 7 not upgraded.
Need to get 1,755 kB of archives.
After this operation, 554 kB of additional disk space will be used.
Do you want to continue? [Y/n] n

Was This Linux Tip Helpful?

Let us know in the comments below.

Leave a Reply

Your email address will not be published. Required fields are marked *

Secure. Reliable. Scalable.

If that doesn't describe your current Linux systems, check out our FREE Linux Survival Guide to help you get your systems up to scratch today!
  • This field is for validation purposes and should be left unchanged.