Why I Use Gentoo: Unused Dependency Removal

This entry is part 7 of 10 in the series Why I Use Gentoo Linux

Perhaps with the exception of Slackware, today’s modern distributions have completely mastered the fine art of installing a package’s dependencies automatically. The installation of a package and all its required dependencies is no more difficult than a single command.

However, there does occasionally come a time when I decide to uninstall a software package I previously had installed. If only the package itself is removed, all of its now unused dependencies will be left behind. Over time, this unused cruft accumulates, wasting disk space and causing superfluous upgrades of these unused packages.

Gentoo’s key innovation in this area (and one of the many reasons I use it) is something called the world set. The world set is nothing more than the set of packages that were explicitly installed by the user. If a package is neither in the world set nor a direct or indirect dependency of another package that is, it can (in theory) be safely uninstalled. Thus, the system is kept free of unused dependencies.

In addition, all distributions come with a default set of packages have a core set of system packages that probably shouldn’t be removed. Gentoo calls this the system set, and this set is assumed to be part of the world set. As a result, system packages and their dependencies are never automatically removed.

This feature isn’t entirely exclusive to Gentoo. Aptitude, the popular front-end for apt, Debian’s package management system, has long had the ability to mark packages as either manually or automatically installed, removing unused dependencies as necessary. In addition, in the past few years, apt gained the ability to natively track this information, making apt as capable as Gentoo’s portage in this regard.

However, at least to my mind, Debian’s packaging makes the use of this feature somewhat more difficult. Instead of a single metapackage to install a default GNOME desktop environment, the user must mark as manually installed several packages in the GNOME desktop environment task. Ubuntu elegantly solves this problem through its ubuntu-minimal, ubuntu-standard and ubuntu-desktop packages, which allow you to simply mark the default system as manually installed. (Of course, if you want to remove a single package from the default system, you’re out of luck. I’ve never had that problem, however.)

In the end, Ubuntu seems the most comparable to Gentoo among the major distributions. I’m not even sure Fedora has a good equivalent, but I’d love to hear about it if it does. In any case, while this particular feature isn’t as much of a reason to use Gentoo as it was five years ago, it’s still one of the reasons I use Gentoo. On the other hand, a rolling release Ubuntu would be that much closer to getting the ultimate nod.

Series NavigationWhy I Use Gentoo: Simple Package ManagementWhy I Use Gentoo: Configuration File Management

11 thoughts on “Why I Use Gentoo: Unused Dependency Removal

  1. Fitzcarraldo

    If you’re interested in a rolling release binary distribution, and one that happens to be based on Gentoo, then check out Sabayon Linux. You can use the home-grown Entropy binary package manager and/or Gentoo’s Portage source package manager.

    1. Jason Lynch Post author

      I first heard about Sabayon quite some time ago, though I haven’t actually tried it out. I suppose at some point, it’d be worth loading it up in VirtualBox and seeing how it feels.

  2. Pingback: Links 23/1/2011: Pardus 2011 Reviews, Skolelinux Interview | Techrights

  3. Jonathan Vasquez

    Awesome read. I’m not a Gentoo user, I do like their work, but I personally don’t use it because there is no way I’m going to wait hours to install a base system from source.

    As for the Unused Dependency Removal or orphans, Arch does also have simple removal simply by typing “pacman -Rsu”.

    R – remove
    s – recursive
    u – unneeded

    -s, –recursive
    Remove each target specified including all of their dependencies, provided that (A) they are not required by other packages; and (B) they were not explicitly installed by the user. This operation is recursive and analogous to a backwards –sync operation, and helps keep a clean system without orphans. If you want to omit condition (B), pass this option twice.

    -u, –unneeded
    Removes the targets that are not required by any other packages. This is mostly useful when removing a group without using the -c option, to avoid breaking any dependencies.

    1. Jason Lynch Post author

      It’s been some time since I last used Arch, that’s for sure. Last time I checked it out, it seemed like it was saving which packages were manually installed, but I couldn’t figure out how to actually make use of that information. Whether that’s a relatively recent feature (in the past couple years) or I just didn’t dig deeply enough into the pacman documentation, I don’t know.

      My only concern is about how easy it is to manually change a package to or from being automatically installed On Gentoo, for instance, I can either manually edit the world file or I can use emerge –noreplace to add something to world.

      Either way, I’m glad Arch does have this ability, and I generally do like Arch, though last time I tried to use it, I gave up for some reason. I think I had to delve into the AUR for too many packages I use.

      1. Jonathan Vasquez

        If you want the console to search your local database for installed packages that are orphans, you can do:

        pacman -Qdt

        pacman -Rsu is to cleanly remove a package and not leave orphans.

  4. Pingback: Tweets that mention Why I Use Gentoo: Unused Dependency Removal | Penultimate Reality -- Topsy.com

  5. M G Berberich

    I don’t agree with your statement about Debian.
    There are tasks to select via “tasksel” like file-server, web-server, graphical-desktop-environment etc. And there are meta-packages.
    P.e. there are about a hundred texlive-packages, but there also is texlive, texlive-base and texlive-full, which depends on other texlive-packages and give you a basic, a standard or a full texlive-installation.


Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>