orphaned dep cleanup in yum

November 9, 2010

I just checked this into yum on friday. It’s currently defaulting to off but I wanted to mention it so it gets more testing.

if you set:

clean_requirements_on_remove = 1


in your yum.conf under [main]

or use:


on the command line, then yum will remove no-longer-needed dependencies of pkgs that you are removing from your system.

Yum was sorta able to do this with the remove-with-leaves plugin but remove-with-leaves did kinda a poor job of it and we weren’t using the ‘reason’ info we’re now storing in the yumdb to know what is a dep and what is not.

Now we are. I’ve tested this in some kinda bizarre scenarios and it seems to work right but I’d appreciate more testing.

Yum that went into rawhide today (3.2.28-13) has this patch and testing (and filing bugs) is appreciated.



17 Responses to “orphaned dep cleanup in yum”

  1. Pieter Says:

    That’s great news, thanks! Once proven stable will this feature become available in F14 too?

  2. Rahul Sundaram Says:

    Send a note to users and test list and then noticed that yum-rawhide repo perhaps isn’t fully updated. Would be nice to get that updated for easy testing

  3. […] I’m very happy to discover that Seth Vidal has merged orphaned dependency cleanup on removal into Yum. […]

  4. Max Says:

    This is a great feature, Seth. Thanks for adding it!

  5. […] so grateful for this work – it’s something I’ve been crying out for ever since I made the decision to stick […]

  6. Chris Smart Says:

    So far so good.. Thank you so much for this feature!


  7. thruhike98 Says:

    Good stuff. This is very helpful. I look forward to turning it on.

    Is there a way to retroactively remove no-longer-needed dependencies for long-since removed applications?

    • Seth Vidal Says:

      I’d recommand package-cleanup –leaves

      that’ll give you the list of pkgs that are not required by anything else.

  8. sawrub Says:

    Just a question, i installed VLC and its downloaded 38 packages as dependencies, now when i’m trying to remove VLC its just listing 17 packages as dependences for VLC.
    So here is the question that the difference between install and erase call was around 3 hrs, so where are the other packages not getting depended upon. They were not needed earlier, but all of a sudden now they are needed.
    I expected all of the 38 to be listed for removal, can u please explain where are the others left out.

  9. Chris Smart Says:

    Hi Seth,

    Any idea whether this might make it into Fedora 14, or only Fedora 15?


  10. Chris Quinn Says:

    thanks, exactly what I am looking for. got some strange stuff going on here! proftpd and centos do not play well

  11. Gerald Says:

    Is there a way to get a list of manually installed packages?

    I vaguely remember installing all sorts of media player/codec stuff on a CentOS 5 server once to try something on the GUI and would love to remove those apps along with their dependencies again.

    yum.log doesn’t nearly go back far enough and I have not found any way to get a list of manually installed software that doesn’t include tons of dependencies which were pulled in.

    Is there any way to find out what apps were manually installed over the lifetime of the system (not including the base packages of the system and not including dependencies)?

    I’ve searched a lot and found nothing.

  12. Renatinho Says:

    Will it work on rhel/centos 6 as well?

  13. Thank you very much!!!!!!

  14. Marcos Says:

    Hi, is it possible tell yum to ignore a certain unused dep with “clean_requirements_on_remove=1”?

    Ex. on F19, “yum remove rsyslog” will remove logrotate, but I want it. Of course I can after run “yum install logrotate” again, but perhaps there’s some switch to tell yum do keep it installed.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: