Is there any way to remove meta package and all its packages? Subset of metapackage is packages which don't depend on metapackage by all means. That's why if remove one metapackage only the package's subset of metapackage is not removed.

For example metapackage apache2 consists some packages which will be installed if install apache2. I used the apt-get install apache2 command in shell and synaptic and I installed some packages. Now if I remove metapackage apache2 via apt-get autoremove apache2 command or synaptic I remove apache2 package only and other packages which are a subset of the metapackage are not removed.

In my opinion the best way is to remove all packages within the metapackage. How to resolve the issue?


As far as I know apache2 is not a metapackage. Various packages have dependencies so installing apache2 will also cause other packages to be installed but that does not make them a metapackage.

In any case, I am not sure what exactly you are trying to achieve so I will give you a few options:

  1. If you want to remove packages that are no longer needed, for example things that were installed by apache2 and are no longer necessary now that you have removed it, use autoremove:

    apt-get autoremove
  2. If you really want to remove all packages installed by a true metapackage, you can do something like this (using the wicd metapackage as an example):

    i. Find the packages installed by the metapackage by searching through the apt log:

    $ grep -A 3 wicd /var/log/apt/history.log
    Commandline: apt-get install wicd
    Install: rfkill:amd64 (0.4-1, automatic), wicd:amd64 (, python-wicd:amd64 (, automatic), wicd-daemon:amd64 (, automatic), wicd-gtk:amd64 (, automatic)
    End-Date: 2013-05-07  18:10:24

    ii. You can parse this to get only the package names:

    $ grep -A 3 wicd /var/log/apt/history.log | 
        perl -ne 's/Install:*// && do {
          @a=(/\s+([^\s]+?):/g); print "@a\n"
      rfkill wicd python-wicd wicd-daemon wicd-gtk

    iii. You can now remove them (I am printing the apt command instead of executing it so you can see what it will uninstall first):

    $ grep -A 3 wicd /var/log/apt/history.log | 
        perl -ne 's/Install:*// && do {
          @a=(/\s+([^\s]+?):/g); print "apt-get remove @a\n"
      apt-get remove  rfkill wicd python-wicd wicd-daemon wicd-gtk

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.