Found a couple of new tools for Redhat boxes. Here’s the story about how I came across them.
dbus-devel needed to be updated on a RHEL 5 box but when I tried to do a yum update things would bail out towards the end of the process with:
Error unpacking rpm package dbus-devel-1.1.2-12.el5.i386 error: unpacking of archive failed: cpio: lstat
Googling for similar unpacking/cpio errors showed that this was not uncommon. In most cases it is because of some funkiness with a directory that needs to be written to during unpacking. I initially tried to debug the issue with strace, but thought there must be an easier way.
The next thing I did was remove the offending package and try to re-install it with:
rpm -e --nodeps dbus-devel yum install dbus-devel
This got me nowhere. Knowing that there might be some messed up folder that needed to be unpacked to I wanted to see what files and folders dbus-devel created. The command for this is
rpm -qpl <package.rpm>
But of course I didn’t have the rpm sitting around and I didn’t feel like going to the RedHat Network to fetch it. This is where the yum plugin yum-downloadonly comes in handy. This can be installed with
yum install yum-downloadonly
This gives the added options to yum:
Now you can download the rpm without installing it. With this I could check out what files and directories dbus-devel wanted to add. I went through these one-by-one checking them out and removing them (making sure the directories were not referenced by another package: rpm -qf /path/to/dir). I did find the culprit: the directory /usr/share/devhelp had become corrupted so dbus-devel could not unpack there. I removed that directory and dbus-devel installed perfectly after that.
Afterwards I found another set of tool that allows one to download rpms from a repository: yumdownloader. It’s a part of the yum-utils package (yum install yum-utils). This nice thing about this one is that it allows you to download src.rpms too.
Update 2009-03-13: To retrieve a pacakge (that has been installed) another option is to configure yum to cache headers and packages. In yum.conf set
keepcache=1, then look in /var/cache/yum for the package.