Linux accidentally unloaded the rpm command, how to recover?

Source: Internet
Author: User

Today in the build MySQL Cluster service, before installing MySQL Cluster service, uninstall the original MySQL software package, accidentally the RPM command also unloaded, this miserable, nothing can be done. In Google has turned a lot of pages, even the official website also looked, did not solve my problem, according to my years of experience in Linux and Linux system RPM package installation characteristics of the sensitivity, I came up with a bit of the method, please note: Original! To do the cluster, two machines are used here, the following is the topology diagram:

xiaolyu77 (192.168.31.77rpm command-unloaded machine)-----------> Reference xiaolyu76 (192.168.31.76 normal machine).

1. The problem arises:[email protected] ~]# rpm-e--nodeps rpm-e mysql-libs-5.1.73-7.el6.x86_64
[email protected] ~]# RPM-IVH mysql-cluster-server-gpl-7.3.7-1.el6.x86_64.rpm
-bash:/bin/rpm:no such file or directory

It was a mistake to force the RPM command to unload with RPM. You can see that the RPM command does not already exist.

2. Check where the RPM command is installed:1. Faulty machine view rpm command

[Email protected] ~]# Whereis rpm
RPM:/etc/rpm/usr/lib/rpm

2. Normal machine View rpm command

[Email protected] ~]# Whereis rpm
RPM:/bin/rpm/etc/rpm/usr/lib/rpm/usr/share/man/man8/rpm.8.gz
[Email protected] ~]#

3. Solution

From 2, you can see that the RPM command on the 77 machine is uninstalled, and even the man manual is not there.

Idea: Think of the installation of the software to install the uninstall method is directly under the installation path of the file directly deleted, then we can be missing what? Obviously, you can. It's not the same in turn.

1. Incomplete Whereis missing files

[Email protected] ~]# scp/bin/rpm [email protected]:/bin/

[Email protected] ~]# scp/usr/share/man/man8/rpm.8.gz [email protected]:/usr/share/man/man8/

2. Missing files in the complete installation directory

Through the Whereis command we see/ur/lib/rpm this file or folder, which is actually the installation path of the RPM command. Now compare the files in this directory under both machines for consistency:

Status of files under normal machine/usr/lib/rpm directory:

77 Machine RPM Unloaded machines:

It is obvious that there are some files on the 77 machine that are not found by comparison, especially 9 soft connection files:

1. First create these soft connection files on the 77 machine

[[email protected] rpm]# ln-s. /.. /bin/db_deadlock rpmdb_deadlock
[[email protected] rpm]# ln-s. /.. /bin/db_archive rpmdb_archive
[[email protected] rpm]# ln-s. /.. /bin/db_load rpmdb_load
[[email protected] rpm]# ln-s. /.. /bin/db_dump rpmdb_dump
[[email protected] rpm]# ln-s. /.. /bin/db_upgrade rpmdb_upgrade
[[email protected] rpm]# ln-s. /.. /bin/db_stat rpmdb_stat
[[email protected] rpm]# ln-s. /.. /bin/db_recover rpmdb_recover
[[email protected] rpm]# ln-s. /.. /bin/db_printlog rpmdb_printlog
[[email protected] rpm]# ln-s. /.. /bin/db_verify rpmdb_verify

Verify that:

[Email protected] rpm]# rpm

2. Copy the RPMRC file from the 76 environment:

[Email protected] rpm]# SCP RPMRC [email protected]:/usr/lib/rpm/

Re-test: The discovery seems successful:

[Email protected] rpm]# rpm

[Email protected] ~]# RPM-QA
Error:no DBPath has been set
Error:cannot Open Packages database in/%{_dbpath}
Error:no DBPath has been set
Error:cannot Open Packages database in/%{_dbpath}

3. This problem occurs: we can copy the macros to the past:

[Email protected] rpm]# SCP macros [email protected]:/usr/lib/rpm/

4. Execute the updatedb command

[Email protected] ~]# UpdateDB

5. Reboot reboot: ok! To check:

[Email protected] rpm]# Rpm-qa | grep rpm

The perfect solution to the problem is to record it!

This is the author of the original blog, reproduced please be sure to indicate this blog address: http://www.cnblogs.com/jasmine-Jobs/p/5986600.html

Linux accidentally unloaded the rpm command, how to recover?

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.