I have a simple question.

When you install a package using apt-get install, oftentimes, it will install several dependency packages as well as the main one. I was wondering if there is a way to completely reverse this install. Often, removing the main package will leave several packages behind. For example, I recently installed kubuntu-desktop. Wanting to completely remove it, I had to follow the instructions on this page:


I would like to know exactly how they obtained that information concerning all the packages to uninstall.

Thanks for any help!

  • There's a program called deborphan which has this type of functionality from memory. – boehj Apr 28 '11 at 3:36

In most cases the autoremove command of apt-get would do the trick, it will remove all packages installed and marked as automatically installed, but not required by any other installed package. This is the preferred and secure method when the master package is not a metapackage.

This is not the case for metapackages like kubuntu-desktop, and this is because packages installed as a consequence of the installation of a metapackage are not marked as automatically installed, so that cannot be remove by autoremove.

Removing all packages marked as dependences of, or recommended by a given metapackage, like kubuntu-desktop, could be dangerous, because some of those packages could be on your system before the installation of the metapackage.

The most secure method to proceed, in my opinion, is an analysis of /var/log/dpkg.log and its ancestors, to see which packages were installed in timestamps around the timestamp of the installation of the given offending package. I suggest a command to get a more terse and cleaned-up view of the concatenation of the involved log files:

less $(ls -rt /var/log/dpkg.log*) |
  awk '$3 ~ /^(install|upgrade|remove|purge)$/' |
  • What I've done is uninstalled everything that sounded like KDE using apt-get remove - then look carefully to see if there is anything in the list of packages to be removed that you want to keep. If you want to keep something in the list, then the package you started to remove can't be removed. – Mei May 3 '11 at 19:20

Use apt-cache depends to list all the packages "inside" a meta package :

apt-cache depends kxstudio-meta-audio-plugins-lv2
  Depends: carla-lv2
  Depends: carla
  Depends: carla-dbg
  Depends: abgate
  Depends: avldrums.lv2
  Depends: drmr
  Depends: eq10q
  Depends: freaked-plugins

I think the easiest way to find out what packages came with something like kubuntu-desktop (or any other package) would be to check out http://packages.ubuntu.com/. This gives you a detailed listing of everything that is required, recommended and suggested for every package available via the offiial repositories.

For 10.10, the kubuntu-desktop package is located here: http://packages.ubuntu.com/maverick/kubuntu-desktop

If something is marked "depends" it is required for the package to function correctly. If it is marked as "recommends" then it is installed by default, but not required (apt-get install --no-intstall-recommends will stop them from being installed), and suggested are purely optional and not installed by default.

You can also check in synaptic package manager (installed by default - in the administration menu I believe). Right click any package and select Properties, select the Dependencies tab and make sure the drop down is on "Dependencies". This shows you the same information that is found at packages.ubuntu.com.

As far as I know, both of those methods list the direct dependencies of the current package, but not dependencies of dependencies. I'm not 100% on this, but it would not surprise me.

if you install packages via apt-get and it is pulling in dependencies and recommended packages, before you hit the 'y' key, you can always copy the lists of packages that will be installed. Then later you can plug that list into an apt-get remove and it should get rid of all that. Just make sure nothing else you installed (that you want to keep) also depends on anything that's going to be removed.

Another useful tool is apt-get autoremove. This will remove anything that you didn't manually install (it was pulled in as a dependency or suggested package) that was a dependency of something that is no longer installed. In my experience, this doesn't always work for meta packages like kubuntu-desktop though.


Try debfoster. First install it using sudo apt-get install debfoster and then run sudo debfoster kubuntu-desktop. It will remove all meta packages installed as part of kubuntu-desktop.

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.