48

I want to install a package (DigiKam), but it has a lot of dependencies. If I decide I no longer need this software and uninstall it, will the now unnessary dependencies be removed?

If not, how can I do it manually?

80

You can use the command apt-get autoremove. It will remove packages that are installed as automatic dependencies, but are not depended anymore.

apt-get has a flag --auto-remove that can be used to automatically remove the automatically installed packages when removing a manually installed package:

apt-get remove --auto-remove packagename

Certain other tools are also capable of doing this, for example aptitude will automatically suggest that you remove the packages that have been orphaned.

The automatically installed packages tracking is built in to apt so the tracking should work no matter which tool you use to install the packages.

  • So, the answer would be that it is NOT done automatically on removing the "parent" package, right ? – jfoucher Jul 29 '10 at 21:12
  • It depends on the method you use to remove the parent package. For example aptitude suggests that those packages are removed when you uninstall the parent package. Not all tools do this though. – Ressu Jul 30 '10 at 6:08
  • You can remove a package and all of its now-no-longer-needed dependencies in one step with sudo apt-get remove --auto-remove package. – Marius Gedminas Jul 30 '10 at 11:58
  • the difference between autoremove and --auto-remove is a bit unclear. Can i combine them? – johny why Aug 23 '15 at 20:38
  • @johnywhy the flag is meant to be a parameter for remove command while the while the auto-remove command is a standalone one. I doubt you can combine them, but I can't check to make sure at the moment. – Ressu Aug 25 '15 at 16:01
10
aptitude purge digikam
deborphan
aptitude purge $(deborphan)

deborphan lists packages which are not used or do not depend. So you can safely uninstall them. I tend to use purge as option of aptitude because it removes also config files and other stuff.

  • When using deborphan it is often necessary to run it a few times in a row, or at least it was in my experience with it. It seemed to continue to find new stuff. – mfisch Jul 30 '10 at 2:58
  • Yep, that's right. Someone wrote an improvement to deborphan. But that never made its way into Debian. The algorithm was better and you had it to run only once. Maybe I'd ask the author if he wants to add it again to Debian/Ubuntu repos. – qbi Jul 30 '10 at 12:07
  • Maybe I cannot use it, but deborphan usually wants to remove many applications that I actually use, as well as some important system packages. – Rafał Cieślak Aug 25 '11 at 18:38
  • 1
    aptitude purge <pkgname> is very useful for completely obliterating packages that have had a failed/partially successful uninstallation. Their status may be listed by dpkg -L <pkgname> as deinstall but using aptitude will remove them completely from aptitude's database, and lingering files not removed by the failed installation seemed to be removed too. – KomodoDave Mar 12 '13 at 16:50
5

The Computer Janitor, in the system menu can do this too.

4

I use ubuntu tweak, it has a very effecient app cleaning utility that has never removed more then it should.

3
sudo apt-get remove --auto-remove 

Only run this.

Install BleachBit from Software Center. When you clean ur system using it, BleachBit will automatically run this command to clean the apt cache.

0

I had the same problem. Here is what I did:

sudo apt-get check

This command will provide the name of dependencies. E.g. my system had chromium-browser-l10n.

Then enter the following command

sudo apt-get remove --auto-remove chromium-browser-l10n

It will remove the dependencies completely from your system

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.