By the time I had got a VPN connection up and running, the yum process had been terminated, which in turn caused yum's database to become corrupt. How can you tell that your server's yum database is corrupt? Running yum will generate this vaguely-terrifying error:
# yum update
error: rpmdb: BDB0113 Thread/process 4498/140039588845376 failed: BDB1507 Thread died in Berkeley DB library
error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 - (-30973)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:
Error: rpmdb open failed
Here is what I did to resolve this issue:
1) I created a back of the yum database files referenced in the `cannot open Packages database in /var/lib/rpm` line of the error:
# mv /var/lib/rpm/__db* /tmp/
You can never go wrong with backing up your data before troubleshooting. I do it reflexively.
2) I then used the following command to rebuild the database indices from the installed package headers:
# rpm -rebuilddb
1) I created a back of the yum database files referenced in the `cannot open Packages database in /var/lib/rpm` line of the error:
# mv /var/lib/rpm/__db* /tmp/
You can never go wrong with backing up your data before troubleshooting. I do it reflexively.
2) I then used the following command to rebuild the database indices from the installed package headers:
# rpm -rebuilddb
3) I cleaned out all of yum's caches and rpm header files.
# yum clean all
At this point, the few solutions to this issue I found online before writing this article claim the issue should be resolved. Under some circumstances, this would probably work on its own. But for me, because my connection was severed by the Internet gurus at my ISP, I also had existing transactions pending in yum,
In my situation, running `yum update` again at this point produced this notification after yum began processing dependencies:
There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help).
So I needed to take one more step.
4) I finally ran `yum-complete-transaction` with the --cleanup-only flag. I wasn't entirely confident about how the database rebuild impacted the transaction list, so I wanted to get rid of it instead of trying to fix it.
# yum-complete-transaction --cleanup-only
Fortunately, this fixed things for me and I didn't have to worry about "removing/installing packages by hand". However, I'd like to throw in a quick note about that and the "maybe package-cleanup can help" note in the same warning message.
The very, very first time I saw that package-cleanup error I wasn't sure what they were talking about. I thought it might have been a typo and they mean to refer to the similar `yum clean packages` command. After all, package-cleanup is:
- not a native yum command
- not a part of the core yum package and
- not a separate package
So what is it? package-cleanup is part of the yum-utils package. I know my failure to understand what package-cleanup is might make me look like a dummy, but its doubtful I'm the only one who got a little confused. Check out this incredibly helpful wiki page for the application on the yum website (and be sure to mis-spell "PackageClenup" with 2 A's instead of 3 in the URI to get to the webpage):
Awesome. |
That's all for today. Have a good weekend, folks.
No comments:
Post a Comment