OneFreeVoice

March 25, 2006

Yum Reverse Dependency Hell

Filed under: Code — Gregory Haase @ 11:54 am

Today I was trying to update my mail server, a CentOS 4.2 machine with Bill Shupps qmail toaster. After running “yum update” I noticed that exim was going to be installed as a dependency. I was afraid another mail server on my machine was going to mess things up, so I canceled the update. Then I began the frustrating process of trying to figure out what depended on exim.

First and foremost, it would have been nice if yum would have just listed the offending package in it’s summary. It tells you it’s resolving dependencies, and the package it needs to install to resolve the dependency, but it doesn’t tell you what package requires.

There are a couple of options within yum that can help, but they don’t get you all the way there. The deplist command will show you the dependencies of a particular package, but that only really helps if you know the offending package. There is also resolvedep, which shows you which package to install to resolve a dependency - that’s not help either.

I started thinking about it, and I figured I needed to get a list of all the packages that were updateable, and somehow feed that into yum depmod.

yum list updates

This only gets us part of the way there, though. The output contains the list of packages, but also some additional information - the architecture, version, repository, etc. This needs to be trimmed off. I use the cut command to return only the first field, and I set the field delimiter to a period so that it trims off the arch and everything else I don’t want. I save it to a file in /tmp.

yum list updates | cut -f 1 -d "." > /tmp/update_list

This gives you just the package list. But it also leaves a few extra lines at the top.

Reading repository metadata in from local files
Resolving Dependencies

I just quickly removed them in vi. Once you have your clean update_list file, you can pass it back into yum:

yum deplist `cat /tmp/update_list` > /tmp/update_dependencies

Now I have a list of all the packages that are going to be updated, with all the dependencies for those packages, and the packages that provide those dependencies.

I open that file using my favorite pager - less - and do a search on exim. It turns out that it is being required by mdadm. I don’t know why I need a different mail server on my machine to run raidtools, but I’m not using mdadm at the moment so I just remove it.

I can’t help but think there must be a much easier way to do this. If you know, please tell me (note: comments like “use emerge, apt-get, etc” are not really welcome).

2 Comments

  1. I poked around, but I didn’t see a better way to resolve your problem. A minor improvement in your instructions is to use cut(1)’s -s switch:

    yum list updates | cut -s -f1 -d'.'
    

    -s will remove any lines without the deliniation character. If I understand your input correctly, you will then be able to concatenate the two yum operations into a single pipeline and avoid temporary files:

    yum list updates | cut -s -f1 -d'.' | yum depends `cat` | less
    

    -Dave

    Comment by Dave Harding — March 25, 2006 @ 7:22 pm

  2. Ughh… I’ve burned myself on this 3 times now. I’ve run into the same error and I can never remember how I fixed it, and now this is the top google hit when I search this error.

    I had the same problem again today, and I found a brilliant post that gives the command:

    rpm -q --whatrequires smtpdaemon

    which works and is brilliant and I wish I would have stumbled upon before.

    I believe I had fixed the issue previously by added

    exclude=sendmail* exim* postfix*

    to my yum.conf file, but for some reason that isn’t working today.

    I tried installing the fake-smtp rpm package today from http://qmail.jms1.net/fake-smtp.shtml and that worked nicely.

    Comment by Gregory Haase — July 27, 2007 @ 9:42 pm

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Blog at WordPress.com.