Linux server configuration and management series - resolve dependency violation - yum rollback

How to solve the damage of package dependency

  • Solution of package dependency destruction

1. Background

Today, I'm going to build a DNS server. Why do I report an error when installing bind software? It indicates that the package dependency is broken and cannot be installed. After thinking about it, I found the reason for the error: I used to use Netease's CentOS source, which executed the yum upgrade command once, but later downloaded a system image file, Set up a local yum source , after the local source is replaced, the two software repositories are somewhat incompatible, resulting in the bind breaking the dependency and unable to install.

2. Error reporting

[root@localhost ~]# yum -y install bind
... ...
Error: Package: glibc-2.12-1.192.el6.i686 (local)
           Requires: glibc-common = 2.12-1.192.el6
           Installed: glibc-common-2.12-1.209.el6.x86_64 (@163/6Server)
               glibc-common = 2.12-1.209.el6
           Available: glibc-common-2.12-1.192.el6.x86_64 (local)
               glibc-common = 2.12-1.192.el6
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest
[root@localhost ~]# 

3. Solutions

Roll back to the environment before upgrade, that is to say, return to the original environment where Netease source was not used at first. Then, the problem of dependency destruction can be solved, and then the local warehouse can be used for software installation.

4. Steps

  • a. View the yum installation / upgrade history to determine the rollback point
    [root@localhost ~]# yum history
Loaded plugins: fastestmirror, product-id, refresh-packagekit, search-disabled-repos, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
     4 | master <monsterhu>       | 2017-12-28 14:22 | Install        |    1   
     3 | master <monsterhu>       | 2017-09-14 02:50 | I, U           |  282 EE
     2 | master <monsterhu>       | 2017-09-14 02:39 | Install        |    9  <
     1 | System <unset>           | 2017-09-13 15:21 | Install        |  961 > 
history list
[root@localhost ~]# 
# From the above results, we can see that the third record was installed and upgraded through Netease's CentOS source, so we can roll back to the previous one
  • b. Start rollback
[root@localhost ~]# yum history rollback 2
... ...
 yum-utils                                         noarch               1.1.30-37.el6                                       local                      112 k

Transaction Summary
=============================================================================================================================================================
Remove        3 Package(s)
Downgrade   279 Package(s)

Total download size: 345 M
Is this ok [y/N]: y
  • c. After rollback, you can install bind Family software happily
[root@localhost ~]# yum -y install bind
... ...
Installed:
  bind.x86_64 32:9.8.2-0.47.rc1.el6                                                                                                                          

Complete!
  • d. Precautions
    It is necessary to find out the cause of the problem (the dependency is broken) so as to determine the rollback point id. it must not be wrong. Otherwise, a little rollback will not solve the problem. If there are too many rollback, it will reach the original version, which is equivalent to the new system just installed, then it will be troublesome!

5. Development of the method of Yum rollback

  • Installed unwanted software and wanted to go back to unsettled state
  • When installing a package from yum, it will be installed together with the dependency package, but only the package itself will be uninstalled when uninstalling from yum. At this time, use the rollback method to solve the problem

Tags: yum glibc CentOS DNS

Posted on Tue, 05 May 2020 09:59:21 -0700 by lucasmontan