Book Image

Red Hat Enterprise Linux Server Cookbook

By : Jakub Gaj, Leemans
5 (1)
Book Image

Red Hat Enterprise Linux Server Cookbook

5 (1)
By: Jakub Gaj, Leemans

Overview of this book

Dominating the server market, the Red Hat Enterprise Linux operating system gives you the support you need to modernize your infrastructure and boost your organization’s efficiency. Combining both stability and flexibility, RHEL helps you meet the challenges of today and adapt to the demands of tomorrow. This practical Cookbook guide will help you get to grips with RHEL 7 Server and automating its installation. Designed to provide targeted assistance through hands-on recipe guidance, it will introduce you to everything you need to know about KVM guests and deploying multiple standardized RHEL systems effortlessly. Get practical reference advice that will make complex networks setups look like child’s play, and dive into in-depth coverage of configuring a RHEL system. Also including full recipe coverage of how to set up, configuring, and troubleshoot SELinux, you’ll also discover how secure your operating system, as well as how to monitor it.
Table of Contents (12 chapters)
11
Index

Recovering from a corrupted RPM database


Although everything is done to ensure that your RPM databases are intact, your RPM database may become corrupt and unuseable. This happens mainly if the filesystem on which the rpm db resides is suddenly inaccessible (full, read-only, reboot, or so on).

This recipe will show you the two ways in which you can attempt to restore your RPM database.

Getting ready

Verify that your system is backed up in some way.

How to do it…

We'll start with the easiest option and the one with the highest success rate in these steps:

  1. Start by creating a backup of your corrupt rpm db, as follows:

    ~]# cd; tar zcvf rpm-db.tar.gz /var/lib/rpm/*
    
  2. Remove stale lock files if they exist through the following command:

    ~]# rm -f /var/lib/rpm/__db*
    
  3. Now, verify the integrity of the Packages database via the following:

    ~]# /usr/lib/rpm/rpmdb_verify /var/lib/rpm/Packages; echo $?
    

    If the previous step prints 0, proceed to Step 7.

  4. Rename the Packages file (don't delete it, we'll need it!),...