yum: getting rid of everything that got installed from that install

September 4, 2008

So, we’ve all been in this situation. You install something you hadn’t seen before. It pulls in the world in dependencies. You use the program for a little while and you realize that you don’t really want it anymore. You run ‘yum remove whatever’ and it removes just whatever. But you know all the deps it pulled in are still installed dirtying up your system.

I wrote this today in response to a thread on fedora-devel-list:

http://skvidal.fedorapeople.org/misc/yum-remove-with-leaves.py

You run it as:

yum-remove-with-leaves.py name_of_package

Then it will remove that package and the deps that it pulled in that are not in use by anything else.

It works reasonably well. Let me know what you think.

9 Responses to “yum: getting rid of everything that got installed from that install”

  1. bochecha Says:

    This should definitely be a plugin to yum (or even in yum).

    Something like a –with-leaves option…

    package-cleanup is great, but having an easier and faster way to just remove all leaves after an install you don’t want anymore is just awesome !

    The only thing that is preoccupying me is that people will tend to use it always (like the -y option), introducing a lot of overheaded in downloading packages several times, installing / removing / installing / … the same package, etc.

  2. Thruhike98 Says:

    Cool! I’ve wondered about these leftovers before. This looks very helpful.

  3. Sam Says:

    I’m looking forward to this being part of yum proper.

    Saves me from copy and pasting the dependencies and saving them to a text file for future ‘complete’ removal.

    Thanks

  4. Andy Price Says:

    It looks promising. The ability to do this kind of thing has been in Debian (and its kids) for a while because Apt tracks automatically installed packages. So it’s good that you’re addressing the problem in Yum in some way, even if it isn’t initially at the core of yum. Perhaps an approach similar to Apt’s would reduce the level of loop nesting you have there? (I’m not looking for a cross-distro flamewar, I just think they got this problem solved nicely in Apt).

  5. timlau Says:

    very nice, a good candidate to go into yum-utils or maybe in yum core.

  6. moonpup Says:

    I agree, this is a great feature and should be part of yum by default. Like Tim says above, on Debian/Ubuntu the aptitude command has this by default so when you uninstall a package, all dependencies go with it. No fuss, no muss.

    Just do it 🙂

  7. stickster Says:

    Very nicely done, and useful when I need to get rid of ${OTHER_DE} applications that I’ve installed for specific trial or data exchange purposes.

  8. Kevin Kofler Says:

    APT doesn’t track automatically-installed packages, only aptitude does, and if you use apt-get or dpkg directly, you confuse aptitude.

  9. Andy Price Says:

    Kevin, I’m afraid your information is out-of-date. apt has groked automatically installed packages since June 2007: http://lists.debian.org/debian-devel/2007/06/msg00379.html

    apt and aptitude have played nicely together ever since then.


Leave a comment