RPM , as the most important software management tool of Linux, has an indispensable position, and even yum relies on the existence of rpm to use it properly. , so it's important to master the rpm recovery, so let's look at how to restore the rpm.
uninstalling rpm Packages
[Email protected] ~]$ rpm-e rpm
error:failed dependencies:
RPM = 4.11.3-17.el7 is needed by (installed) rpm-libs-4.11.3-17.el7.x86_64
RPM is needed by (installed) Color-filesystem-1-13.el7.noarch
RPM = 4.11.3-17.el7 is needed by (installed) rpm-python-4.11.3-17.el7.x86_64
RPM >= 0:4.4.2 is needed by (installed) Yum-3.4.3-132.el7.centos.0.1.noarch
RPM >= 4.1.1 is needed by (installed) Createrepo-0.9.9-23.el7.noarch
RPM is needed by (installed) policycoreutils-2.2.5-20.el7.x86_64
RPM >= 4.9.0 is needed by (installed) Redhat-rpm-config-9.1.0-68.el7.centos.noarch
RPM = 4.11.3-17.el7 is needed by (installed) rpm-build-4.11.3-17.el7.x86_64
[email protected] ~]$ Yum remove rpm
Loaded Plugins:fastestmirror, LangPacks
Resolving Dependencies
--Running Transaction check
---> Package rpm.x86_64 0:4.11.3-17.el7 'll be erased
--processing dependency:rpm for Package:color-filesystem-1-13.el7.noarch
--processing dependency:rpm >= 4.1.1 for Package:createrepo-0.9.9-23.el7.noarch
--processing dependency:rpm >= 4.4.2 for Package:yum-3.4.3-132.el7.centos.0.1.noarch
--Processing dependency:rpm = 4.11.3-17.el7 for package:rpm-libs-4.11.3-17.el7.x86_64
--Processing dependency:rpm = 4.11.3-17.el7 for package:rpm-python-4.11.3-17.el7.x86_64
--processing dependency:rpm for package:policycoreutils-2.2.5-20.el7.x86_64
--processing dependency:rpm >= 4.9.0 for Package:redhat-rpm-config-9.1.0-68.el7.centos.noarch
...
--processing Dependency:totem (x86-64) = 1:3.14.3-5.el7 for package:1:totem-nautilus-3.14.3-5.el7.x86_64
--Running Transaction check
---> Package gnome-classic-session.noarch 0:3.14.4-13.el7 'll be erased
---> Package totem-nautilus.x86_64 1:3.14.3-5.el7 'll be erased
--Finished Dependency Resolution
Error:trying to remove "yum", which is protected
[email protected] ~]$ rpm-e rpm--nodeps # Use "--deps" to uninstall
[Email protected] ~]$ RPM-QA
-bash:/usr/bin/rpm:no such file or directory
once again , when you use the RPM tool to view all packages, the error will be reported, which means that the rpm package is uninstalled and cannot be used.
recover rpm packages
RPM Package recovery requires the use of Linux system CD, the first is to load the linux system CD-ROM into the system, the startup item to boot from the CD-ROM " CD-ROMdrive".
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/86/B6/wKioL1fIDqeAuZTeAAA2eY-XaWg304.png-wh_500x0-wm_3 -wmp_4-s_2786714531.png "title=" image 1.png "alt=" wkiol1fidqeauzteaaa2ey-xawg304.png-wh_50 "/>
Select "Troubleshooting"-"Rescue a CentOS system" to enter the rescue mode of the disc in the selection screen below .
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/86/B6/wKiom1fIDreRQHTiAABV55I2bb0195.png-wh_500x0-wm_3 -wmp_4-s_1831302562.png "title=" image 2.png "alt=" wkiom1fidrerqhtiaabv55i2bb0195.png-wh_50 "/>
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/86/B6/wKiom1fIDsLxlM0dAABstfDk5h4393.png-wh_500x0-wm_3 -wmp_4-s_3412728866.png "title=" image 3.png "alt=" wkiom1fidslxlm0daabstfdk5h4393.png-wh_50 "/>
Select the first item "Continue" in the following screen
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/86/B6/wKiom1fIDs2xUwrsAAEi6RzP92o153.png-wh_500x0-wm_3 -wmp_4-s_2544029183.png "title=" image 4.png "alt=" wkiom1fids2xuwrsaaei6rzp92o153.png-wh_50 "/>
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/86/B6/wKioL1fIDtnSDOjcAADkvucG_jo393.png-wh_500x0-wm_3 -wmp_4-s_405621403.png "title=" image 5.png "alt=" wkiol1fidtnsdojcaadkvucg_jo393.png-wh_50 "/>
After entering rescue mode, you can use linux command, use df You can see what the zoning is, and you might notice that this linux The partitioning in the system is not the same, it shows that linux The partition of the system, but the partition of the disc, called the Pseudo-system, using the ls You can view all the directories displayed, where " /mnt/sysimage linux system root directory, go to the directory to see, is not and linux
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/86/B6/wKioL1fIDuTSxNN3AAFRCbZrE7s186.png-wh_500x0-wm_3 -wmp_4-s_2074180881.png "title=" image 6.png "alt=" wkiol1fidutsxnn3aafrcbzre7s186.png-wh_50 "/>
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/86/B6/wKiom1fIDu6TmjA6AABD3TR-Gr0719.png-wh_500x0-wm_3 -wmp_4-s_1192630769.png "title=" image 7.png "alt=" wkiom1fidu6tmja6aabd3tr-gr0719.png-wh_50 "/>
in rescue mode, you can also use the Linux command to operate.
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/86/B6/wKioL1fIDveSzvFhAADjVc1DW3Y827.png-wh_500x0-wm_3 -wmp_4-s_37690157.png "title=" image 8.png "alt=" wkiol1fidveszvfhaadjvc1dw3y827.png-wh_50 "/>
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/86/B6/wKiom1fIDwLxM7svAAEapX6qWI4480.png-wh_500x0-wm_3 -wmp_4-s_3702446099.png "title=" image 9.png "alt=" wkiom1fidwlxm7svaaeapx6qwi4480.png-wh_50 "/>
if on the current command line, execute "rpm-ivh" will report some errors, when installing the software, the current directory is the main, and we need to install the rpm package to Linux normal boot system to go, so need to add a parameter "--root=/mnt/sysimage".
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/86/B6/wKioL1fIDx_Bjt_ZAAIz1dEqvsc457.png-wh_500x0-wm_3 -wmp_4-s_33398158.png "title=" image 10.png "alt=" Wkiol1fidx_bjt_zaaiz1deqvsc457.png-wh_50 "/>
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/86/B6/wKiom1fIDy2Bu6DnAABhc0JOtX8320.png-wh_500x0-wm_3 -wmp_4-s_2630661526.png "title=" image 11.png "alt=" wkiom1fidy2bu6dnaabhc0jotx8320.png-wh_50 "/>
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/86/B6/wKiom1fIDznjA7wDAACZa0R4fE0517.png-wh_500x0-wm_3 -wmp_4-s_4209896757.png "title=" image 12.png "alt=" wkiom1fidznja7wdaacza0r4fe0517.png-wh_50 "/>
after installing the RPM package, reboot the system and discover that the rpm software is back, and that the RPM recovery is complete and the RPM can be used normally. The software is managed.
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/86/B6/wKioL1fID0iij891AADi88n26qI705.png-wh_500x0-wm_3 -wmp_4-s_1093722379.png "title=" image 13.png "alt=" wkiol1fid0iij891aadi88n26qi705.png-wh_50 "/>
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/86/B6/wKioL1fID1aDhC5vAABIsaXXOgU801.png-wh_500x0-wm_3 -wmp_4-s_1701915584.png "title=" image 14.png "alt=" wkiol1fid1adhc5vaabisaxxogu801.png-wh_50 "/>
This article is from the "Linux on the Road" blog, be sure to keep this source http://dreamlinuxc.blog.51cto.com/5733156/1845327
Restore RPM Packages using Linux rescue mode