Better Management of Packages while Uninstalling September 30, 2005Posted by Carthik in administration, applications, commands, ubuntu.
Have you ever noticed how, when you install a required package using apt-get or synaptic, and lot of associated “required” packages such as library packages and documentation packages are also installed due to the dependencies between packages? There are some “meta-packages” like kubuntu-desktop, for example, which in and of themselves do not install any files on your system, but have a long list of dependencies, which, together assume a cetain function. I installed kubuntu-desktop to try KDE, and later removed it, and was surprised to see that all the dependencies that were installed we not removed! That is where this story began.
What I don’t like is that when I later remove the package I installed earlier, the packages that were installed because they were dpendencies don’t get removed. So, when I installed the package, 30 MB was used, say. Now after unistalling the package, only 5 MB is freed, since the other 25 MB was used up by the dependencies. Over a period of time, this leads to a number of “orphaned” packages remaining on your system. The package or application that used this package has long-since been removed, but apt “ignored” removing these dependency packages.
Now I like my system lean, and more importantly, clean. I use debfoster to keep my system clean over a longish period of time.
Debian uses the main programs apt and dpkg to manage packages. These programs do not make a distinction between packages that got installed because some other program happened to need it and packages you really asked for. Debfoster will help you get rid of packages (libraries for example) get left behind on your system when the program that required it was removed or upgraded to a version that doesn’t have the dependency.
In the above, what is said of Debian is also true of Ubuntu.
Install debfoster, read it’s man page, and take it out on a ride by running it. The first time, it will ask you a few questions. Later, periodically running it will keep your system clean of aliened packages that are no longer needed. If you make a mistake with the answers, you can always edit the file /var/lib/debfosterkeepers which defines the packages you want to remain on your system.
An alternative to debfoster is aptitude (instead of apt-get) but the catch is that one has to always use aptitude instead of apt-get from the very beginning, and if you like me, realized the orphaned packages problem late, then aptitude won’t work.
Of course, I should add that besides occupying some space on your hard drive, and a few extra installed applications, the extra orphaned packages cause no harm.