Rpm Command Errored

The RPM database is made upwardly of files under the /var/lib/rpm/ directory in CentOS and other enterprise Linux distributions such as RHEL, openSUSE, Oracle Linux and more than.

If the RPM database is corrupted, RPM will non work correctly, thus updates cannot be practical to your organisation, you encounter errors while updating packages on your system via YUM packet manager. The worst case scenario is being unable to run any rpm and yum commands successfully.

Read Also: xx Applied Examples of RPM Command in Linux

In that location are a number of factors that can pb to the RPM database abuse, such as incomplete previous transactions, installation of certain 3rd-party software, removing specific packages, and many others.

In this commodity, we will evidence how to rebuild a corrupted RPM database; this fashion you can recover from an RPM database corruption in CentOS. This requires root user privileges, otherwise, use the sudo command to gain those privileges.

Rebuild Corrupted RPM Database in CentOS

First start by backing up your current RPM database before proceeding (you might demand information technology in the time to come), using the following commands.

# mkdir /backups/ # tar -zcvf /backups/rpmdb-$(date +"%d%m%Y").tar.gz  /var/lib/rpm        
Backup RPM Database
Backup RPM Database

Next, verify the integrity of the master package metadata file /var/lib/rpm/Packages; this is the file that needs rebuilding, only start remove /var/lib/rpm/__db* files to forbid dried locks using following commands.

# rm -f /var/lib/rpm/__db*		 # /usr/lib/rpm/rpmdb_verify /var/lib/rpm/Packages        
Verify RPM Database
Verify RPM Database

In case the above operation fails, pregnant y'all still see errors, and so you should dump and load a new database. Also verify the integrity of the freshly loaded Packages file every bit follows.

# cd /var/lib/rpm/ # mv Packages Packages.back # /usr/lib/rpm/rpmdb_dump Packages.back | /usr/lib/rpm/rpmdb_load Packages # /usr/lib/rpm/rpmdb_verify Packages        
Dump and Load RPM Database
Dump and Load RPM Database

Now to check the database headers, query all installed packages using the -q and -a flags, and attempt to carefully detect any error(southward) sent to the stderror.

# rpm -qa >/dev/cypher	#output is discarded to enable printing of errors only        

Last merely not to the lowest degree, rebuild the RPM database using the following command, the -vv option allows for displaying lots of debugging information.

# rpm -vv --rebuilddb        
Rebuild RPM Database
Rebuild RPM Database

Use dcrpm Tool to Detect and Correct RPM Database

Nosotros too discovered the dcrpm (detect and correct rpm) command line tool used to place and correct well known problems to exercise with RPM database corruption. It is a simple and easy-to-use tool which you can run without choice. For constructive and reliable usage, you should run information technology regularly via cron.

Yous tin can install it from source; download the source tree and install information technology using setup.py (which should grab the psutil dependency from pypi likewise), as shown.

# git clone https://github.com/facebookincubator/dcrpm.git # cd dcrpm # python setup.py install        

Once you take installed dcrpm, run it as shown.

# dcrpm        

Finally, try to run your failed rpm or yum command again to see if everything is working fine.

dcrpm Github repository: https://github.com/facebookincubator/dcrpm
You can find more information from RPM database recovery folio.

That'south all! In this article, we have explained how to rebuild a corrupted RPM database in CentOS. To ask whatever questions or share your thoughts almost this guide, employ the feedback form below.

If Y'all Appreciate What We Do Hither On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or scan the thousands of published articles bachelor FREELY to all.

If you like what y'all are reading, please consider buying us a java ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

gladdenachim1992.blogspot.com

Source: https://www.tecmint.com/rebuild-corrupted-rpm-database-in-centos/

0 Response to "Rpm Command Errored"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel