CentOS 中yum 有未完成事务提示清除办法

本文讲的是linux中yum 有未完成事务提示 清除办法, 使用yum安装东西时,如果有强制退出过yum或yum异常结束,再下次使用yum命令时会提示:There are unfinished transactions remaining. You might consider runni


这是一个能发现未完成或被中断的yum事务的程序。

[root@qc-nginx ~]# yum update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.cn99.com
 * updates: mirrors.huaweicloud.com
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help).
The program yum-complete-transaction is found in the yum-utils package.
--> Running transaction check

可以通过以下方法处理:

 

一、安装 yum-complete-transaction

yum -y install yum-utils

二、清除yum缓存 yum clean all

[root@qc-nginx ~]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base extras updates zabbix zabbix-non-supported
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
[root@qc-nginx ~]#

三、执行清理未完成事务 yum-complete-transaction --cleanup-only

[root@qc-nginx ~]# yum-complete-transaction --cleanup-only
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: mirrors.cn99.com
 * extras: mirrors.cn99.com
 * updates: mirrors.huaweicloud.com
base                                                    | 3.6 kB  00:00:00     
extras                                                  | 3.4 kB  00:00:00     
updates                                                 | 3.4 kB  00:00:00     
zabbix                                                  | 2.9 kB  00:00:00     
zabbix-non-supported                                    |  951 B  00:00:00     
(1/5): extras/7/x86_64/primary_db                       | 149 kB  00:00:00     
(2/5): base/7/x86_64/group_gz                           | 166 kB  00:00:00     
(3/5): zabbix/x86_64/primary_db                         |  87 kB  00:00:01     
(4/5): updates/7/x86_64/primary_db                      | 2.7 MB  00:00:02     
(5/5): base/7/x86_64/primary_db                         | 5.9 MB  00:00:05     
zabbix-non-supported/x86_64/primary                     | 1.6 kB  00:00:00     
zabbix-non-supported                                                   4/4
Cleaning up unfinished transaction journals
Cleaning up 2018-06-16.22:14.54
[root@qc-nginx ~]#