How to fix RPM commands (accidentally delete RPM commands)

Source: Internet
Author: User

If you use rpm-e -- nodeps RPM to delete the RPM command, use the following methods to fix it:

RPM file download: 1./bin/RPM: binrpm.zip 2./usr/lib/so file: Linux/usr-lib.rar 3./usr/lib/RPM Folder: backusrlibrpm.zip

 

Decompress the file in binrpm.zip to the/bin directory, and enter the RPM command on the Linux terminal.

[Root @ localhost Home] # rpm
Rpm version 4.2
Copyright (c) 1998-2002-red hat, Inc.
This program may be freely redistributed under the terms of the GNU GPL

Usage: rpm [-akfgpqv] [-akfgpqvcdils] [-Example] [-akfgpqvcdilsakfgpqv] [-Example] [-Example] [-Example] [-Example] [-Example] [-Example] [-Example] ?] [-A | -- all] [-f | -- file] [-G | -- Group]
[-P | -- package] [-- specfile] [-- whatrequires] [-- whatprovides]
[-C | -- configfiles] [-d | -- docfiles] [-- dump] [-L | -- list]
[-- Queryformat = queryformat] [-S | -- State] [-- nomd5] [-- nofiles]
[-- Nodeps] [-- NoScript] [-- addsign] [-k | -- checksig] [-- import]
[-- Resign] [-- nodigest] [-- nosignature] [-- initdb] [-- rebuilddb]
[-- Aid] [-- allfiles] [-- allmatches] [-- badreloc]
[-E | -- Erase <package> +] [-- excludedocs] [-- excludepath = <path>]
[-- Force] [-f | -- freshen <packagefile> +] [-H | -- hash] [-- ignorearch]
[-- Ignoreos] [-- ignoresize] [-I | -- install] [-- justdb] [-- nodeps]
[-- Nomd5] [-- noorder] [-- nosuggest] [-- noscripts] [-- notriggers]
[-- Oldpackage] [-- percent] [-- prefix = <dir>] [-- relocate = <old >=< new>]
[-- Repackage] [-- replacefiles] [-- replacepkgs] [-- Test]
[-U | -- upgrade <packagefile> +] [-d | -- Define 'macro expr']
[-E | -- eval 'expr'] [-- macros = <file:...>] [-- nodigest] [-- nosignature]
[-- Rcfile = <file:...>] [-r | -- root Root] [-- querytags] [-- showrc]
[-- Quiet] [-v | -- verbose] [-- version] [-? | -- Help] [-- usage]
[-- Scripts] [-- setperms] [-- setugids] [-- conflicts] [-- obsoletes]
[-- Provides] [-- requires] [-- info] [-- changelog] [-- triggers]
[-- Last] [-- filesbypkg] [-- fileclass] [-- filecolor] [-- fileprovide]
[-- Filerequire] [-- redhatprovides] [-- redhatrequires]
[-- Buildpolicy = <Policy>] [-- with = <option>] [-- without = <option>]
[Root @ localhost Home] #

If the following error occurs: Step 2 is required.

Rpm: Error while loading shared libraries: librpm-4.4.so: cannot open

Shared object file: no such file or directory

Decompress usr-lib.rar to./usr/lib,

Use [root @ localhost Home] # rpm-QA to check whether an RPM is installed. If

Error: cannot open packages database in/var/lib/RPM

No packages

Use [root @ localhost Home] # rpm -- rebuilddb to repair the RPM database (refer to the last part of this article). If

Error: Unrecognized dB option: "db3" ignored.

Error: cannot open packages Index

In the above case, it indicates that the file has not been fully copied. Proceed to step 3.

3. Decompress backusrlibrpm.zip to./usr/lib/and ensure the existence of files such as rpmpopt-4.1, RPMI, rpmv.

An error is reported when you run the RPM installation file again:

Rpmdb: unable to join the environment
Error: db4 error (11) from dbenv-> open: Resource temporarily unavailable
Error: cannot open packages index using db3-resource temporarily unavailable (11)
Error: cannot open packages database in/var/lib/RPM
No packages

Solution 1: run the "Export ld_assume_kernel = 2.2.25" or "Export ld_assume_kernel = 2.2.25" command, or write it to/etc/bashrc.

Solution 2: run the "Export ld_assume_kernel = 2.2.25" or "Export ld_assume_kernel = 2.2.25" command to upgrade RPM to the rpm-4.2-1.i386.rpm

Solution 3: Execute "Export ld_assume_kernel = 2.2.5"

 

//////////////////////////////////////// //////////////////////////////////////// ////////

fixed the RPM database
sometimes, our RPM database may be damaged for some reason. In this way, when you execute rpm-related commands, an error similar to the following will be reported:
rpmdb: Fatal region error detected; run recoveryerror: db4 error (-30982) from dbenv-> open: db_runrecovery: Fatal error, run database recoveryerror: cannot open packages index
the consequence is that you will not be able to use RPM to add or delete, update and query your system's RPM software package, in fact, you only need to follow the steps below to restore your RPM database without re-installing the system
# cd/var/lib # mv rpm. old # mkdir RPM # rpmdb -- initdb # cp rpm. old/packages RPM # rpmdb -- rebuilddb
.
the above is the practice for redhat8 and redhat9. If it is a previous or another version of Linux
follow perform the following steps
# cd/var/lib # mv rpm. old # mkdir RPM # rpm -- initdb # cp rpm. old/packages RPM # rpm -- rebuilddb


another article
repair RPM database
when installing, upgrading, and detaching a package, the RPM dB may be damaged, in this case, you need to use the -- rebuild parameter to fix RPM dB, but sometimes you may encounter this problem:
[root @ tiv125 lib] # rpm-V -- rebuilddb
rpmdb: fatal region error detected; run recovery
error: db4 error (-30982) from dbenv-> open: db_runrecovery: Fatal error, run database recovery
error: cannot open packages index
in this case, you must manually delete _ dB in the/var/lib/RPM directory. * file, such as _ db.001, _ db.002, etc.
Then run rpm-V -- rebuilddb.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.