Dangerous Things
Custom gadgetry for the discerning hacker

The Store is now open! Check out the gadgetry »
Like what you're reading?
Share It.

How to fix a bum package or force a re-install on CentOS

I recently had a package show up in yum as being installed, but it was not or had been manually removed, so the yum removal process was broken and the ghost package was causing a yum update to fail. The solution was to use rpm to simply and safely remove the entry from the database, but not actually do any file management. Once the entry was removed, I was free to re-install the package and run yum update.

From http://hacktux.com/yum/force/reinstall

Since Yum does not have a force flag, rpm commands must be used along with Yum to do some heavy lifting. Here are a few ways to force the reinstall of a broken package on a Yum Managed system.

Yum Remove and then Install

The easiest solution is to yum remove the package and then yum install the same package. If there are too many dependencies at stake with the package in question, try another method.

yum remove PACKAGE
yum install PACKAGE

Force Erase and then Yum Install

RPM dependencies sometimes make a simple yum remove impossible and Yum will want to erase your entire OS before moving on. In this case, use rpm to force erase, then yum to install.

rpm -e –nodeps PACKAGE
yum install PACKAGE

Prune RPM Database and then Yum Install

If your package install is so corrupted that an rpm -e is dangerous or impossible, even with –nodeps, remove the package from the local RPM database to trick yum into reinstalling the package. No files are deleted when using rpm -e with –justdb.

rpm -e –justdb –nodeps PACKAGE
yum install PACKAGE

Tags: ,

Leave a Reply

Get Adobe Flash player