Fedora 20, How I got by my RPM breakage of the day

It’s not that common that RPM breaks its database, but it already happened to me twice since f20 released.

Last time, and because I was in a hurry, I finished by simply reinstalling my system, but today I think I got through enough WTF to post something about it.

It started with the usual message of a yum no longer able to install anything, and a notice about corruption and the advise of rebuilding the package database.

That’s what I did, with rpm --rebuilddb but that lead to a brand new error message… so was my first time it broke that bad. rpmdb --rebuilddb didn’t do any better so I finished with this very old (and bad) advise which consists of removing the databases files themselves. After that, the above –rebuilddb commands worked well, but:

  • Yum was by then unable to connect to any mirror, because it was unable to parse the $releasever tag for its queries,
  • yum check was reporting about 2500 packages with missing dependencies (!!!)

I found the first issue very irritating, because despite of the database problem that was finally gone, I was now hit by a bug from nowhere preventing me from fetching the packages I could require for fixing my stuff…
But hopefully this can be worked around by passing the –releasever=20 parameter to any yum command.

So now, what do when yum puts $releasever in the URLs of the mirrors it tries to connect with? Simply install the fedora-release package that provides the missing redhat-release.

But this sadly doesn’t fix the 2500+ “has missing requires” errors returned by yum check. Before moving away the rpmdb files, I did a rpm -qa > pkglist.txt just inc case… So what about a yum $(cat pkglist.txt) then? Sadly it didn’t work, with yum answering all packages are already installed… (Hu! ô.O) So I ended with the above snippet (source):

yum check dependencies \
| grep 'has missing requires' \
| sed 's/.\+has missing requires of //' \
| sed 's/ [=<>].\+//' \
| while read dep; do yum -y install "$dep"; done

This will run yum install as many times as there is a missing dep, so it will literally kill your yum history and very likely run much more commands than required. I’d rather suggest a:

yum check dependencies \
| grep 'has missing requires' \
| sed 's/.\+has missing requires of //' \
| sed 's/ [=<>].\+//' > yumrescue.list

in combination with a yum install $(cat yumrescue.list)

Hope it helps.

Donate Dogecoins: DJi4fgSMxcq5vRjytvCEq9A1TVsDZevd7c Whats This?

Leave a Reply

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

Blue Captcha Image