Yum:无法安装更新 - “无法运行事务”

Yum:无法安装更新 - “无法运行事务”

我有一个 CentOS Linux 版本 7.9.2009,每天都会出现重复的电子邮件/问题,我不知道如何解决。我每天都会收到一次这封电子邮件:

The following updates will be applied on myserver.xyz:
================================================================================
Package                 Arch   Version                      Repository    Size
================================================================================
Installing:
nodejs-libs             x86_64 1:16.14.0-2.el7              epel          14 M
     replacing  v8.x86_64 1:3.14.5.10-25.el7
Updating:
MariaDB-client          x86_64 10.6.7-1.el7.centos          mariadb-main  14 M
MariaDB-common          x86_64 10.6.7-1.el7.centos          mariadb-main  81 k
MariaDB-compat          x86_64 10.6.7-1.el7.centos          mariadb-main 2.2 M
MariaDB-server          x86_64 10.6.7-1.el7.centos          mariadb-main  25 M
MariaDB-shared          x86_64 10.6.7-1.el7.centos          mariadb-main 113 k
galera-4                x86_64 26.4.11-1.el7.centos         mariadb-main 9.9 M
java-1.8.0-openjdk-headless
                         x86_64 1:1.8.0.322.b06-1.el7_9      updates       33 M
jotta-cli               x86_64 0.13.55213-2                 jotta-cli     10 M
libsmbclient            x86_64 4.10.16-18.el7_9             updates      146 k
libwbclient             x86_64 4.10.16-18.el7_9             updates      116 k
php                     x86_64 8.1.3-1.el7.remi             remi-php81   1.9 M
php-cli                 x86_64 8.1.3-1.el7.remi             remi-php81   5.9 M
php-common              x86_64 8.1.3-1.el7.remi             remi-php81   1.2 M
php-gd                  x86_64 8.1.3-1.el7.remi             remi-php81    97 k
php-ldap                x86_64 8.1.3-1.el7.remi             remi-php81    95 k
php-mysqlnd             x86_64 8.1.3-1.el7.remi             remi-php81   244 k
php-pdo                 x86_64 8.1.3-1.el7.remi             remi-php81   149 k
php-process             x86_64 8.1.3-1.el7.remi             remi-php81    98 k
php-sodium              x86_64 8.1.3-1.el7.remi             remi-php81    93 k
polkit                  x86_64 0.112-26.el7_9.1             updates      170 k
remi-release            noarch 7.9-3.el7.remi               remi-safe     23 k
samba                   x86_64 4.10.16-18.el7_9             updates      720 k
samba-client            x86_64 4.10.16-18.el7_9             updates      646 k
samba-client-libs       x86_64 4.10.16-18.el7_9             updates      5.0 M
samba-common            noarch 4.10.16-18.el7_9             updates      216 k
samba-common-libs       x86_64 4.10.16-18.el7_9             updates      182 k
samba-common-tools      x86_64 4.10.16-18.el7_9             updates      466 k
samba-libs              x86_64 4.10.16-18.el7_9             updates      271 k
v8-devel                x86_64 2:9.4.146.24-1.16.14.0.2.el7 epel         9.5 k
Installing for dependencies:
brotli                  x86_64 1.0.7-5.el7                  epel         318 k
brotli-devel            x86_64 1.0.7-5.el7                  epel          27 k
nodejs                  x86_64 1:16.14.0-2.el7              epel         206 k
nodejs-devel            x86_64 1:16.14.0-2.el7              epel         178 k
openssl11               x86_64 1:1.1.1k-2.el7               epel         692 k
openssl11-libs          x86_64 1:1.1.1k-2.el7               epel         1.5 M

Transaction Summary
================================================================================
Install   1 Package  (+6 Dependent packages)
Upgrade  29 Packages
Updates failed to install with the following error message: 
Could not run transaction.

无法运行交易似乎是唯一的错误,但这并没有透露太多!?

我已经尝试过yum clean all,但第二天仍然出现同样的问题。

该错误可能与同时以电子邮件形式出现的另一个错误相关:

myserver.xyz 上的 Anacron 作业“cron.daily”

/etc/cron.daily/0yum-daily.cron:

Transaction couldn't start:
file /usr/lib64/libbrotlicommon.so.1 from install of brotli-1.0.7-5.el7.x86_64 conflicts with file from package libbrotli-1.0.9-1.codeit.el7.x86_64
file /usr/lib64/libbrotlidec.so.1 from install of brotli-1.0.7-5.el7.x86_64 conflicts with file from package libbrotli-1.0.9-1.codeit.el7.x86_64
file /usr/lib64/libbrotlienc.so.1 from install of brotli-1.0.7-5.el7.x86_64 conflicts with file from package libbrotli-1.0.9-1.codeit.el7.x86_64

yum repolist给出这个输出:

Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.netsite.dk
 * epel: mirror.netsite.dk
 * extras: mirror.netsite.dk
 * remi-php81: mirror.dk.team.blue
 * remi-safe: mirror.dk.team.blue
 * updates: mirror.netsite.dk
repo id                                                   repo name                                                                                               status
base/7/x86_64                                             CentOS-7 - Base                                                                                         10,060+12
epel/x86_64                                               Extra Packages for Enterprise Linux 7 - x86_64                                                             13,733
extras/7/x86_64                                           CentOS-7 - Extras                                                                                             500
jotta-cli                                                 Jottacloud CLI                                                                                                 24
mariadb                                                   MariaDB                                                                                                        88
mariadb-main                                              MariaDB Server                                                                                                 94
mariadb-maxscale                                          MariaDB MaxScale                                                                                                4
mariadb-tools                                             MariaDB Tools                                                                                                  15
remi-php81                                                Remi's PHP 8.1 RPM repository for Enterprise Linux 7 - x86_64                                                 285
remi-safe                                                 Safe Remi's RPM repository for Enterprise Linux 7 - x86_64                                                  4,696
updates/7/x86_64                                          CentOS-7 - Updates                                                                                        3,413+1
repolist: 32,912

yum list installed | grep brotli给出这个输出:

libbrotli.x86_64                    1.0.9-1.codeit.el7             @CodeIT

cat /etc/cron.daily/0yum-daily.cron给出这个输出:

#!/bin/bash

# Only run if this flag is set. The flag is created by the yum-cron init
# script when the service is started -- this allows one to use chkconfig and
# the standard "service stop|start" commands to enable or disable yum-cron.
if [[ ! -f /var/lock/subsys/yum-cron ]]; then
  exit 0
fi

# Action!
exec /usr/sbin/yum-cron

认为(?)这可能是因为brotli使用了@CodeIT存储库,但我没有在yum repolist?中列出这样的存储库。我不记得何时更改了这些存储库,但可能与 PHP 或 MariaDB 有关。

有谁知道这可能是什么以及如何解决它?

### 更新 1 ###

我已更新以质疑所提出的答案。这是我运行时得到的结果yum remove libbrotli-1.0.9-1.codeit.el7.x86_64

[root@myserver ~]# yum remove libbrotli-1.0.9-1.codeit.el7.x86_64
Loaded plugins: fastestmirror, langpacks
Resolving Dependencies
--> Running transaction check
---> Package libbrotli.x86_64 0:1.0.9-1.codeit.el7 will be erased
--> Processing Dependency: libbrotlienc.so.1()(64bit) for package: httpd-2.4.51-1.codeit.el7.x86_64
--> Running transaction check
---> Package httpd.x86_64 0:2.4.51-1.codeit.el7 will be erased
--> Processing Dependency: httpd = 2.4.51-1.codeit.el7 for package: 1:mod_ssl-2.4.51-1.codeit.el7.x86_64
--> Processing Dependency: httpd = 2.4.51-1.codeit.el7 for package: httpd-manual-2.4.51-1.codeit.el7.noarch
--> Processing Dependency: httpd-mmn = 20120211x8664 for package: mod_fcgid-2.3.9-6.el7.x86_64
--> Processing Dependency: httpd-mmn = 20120211x8664 for package: mod_http2-1.15.24-2.codeit.x86_64
--> Processing Dependency: httpd-mmn = 20120211x8664 for package: php-8.1.2-1.el7.remi.x86_64
--> Processing Dependency: httpd-mmn = 20120211x8664 for package: 1:mod_ssl-2.4.51-1.codeit.el7.x86_64
--> Running transaction check
---> Package httpd-manual.noarch 0:2.4.51-1.codeit.el7 will be erased
---> Package mod_fcgid.x86_64 0:2.3.9-6.el7 will be erased
---> Package mod_http2.x86_64 0:1.15.24-2.codeit will be erased
---> Package mod_ssl.x86_64 1:2.4.51-1.codeit.el7 will be erased
--> Processing Dependency: mod_ssl for package: python2-certbot-apache-1.11.0-1.el7.noarch
---> Package php.x86_64 0:8.1.2-1.el7.remi will be erased
--> Running transaction check
---> Package python2-certbot-apache.noarch 0:1.11.0-1.el7 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================================================================================
 Package                                         Arch                            Version                                        Repository                            Size
===========================================================================================================================================================================
Removing:
 libbrotli                                       x86_64                          1.0.9-1.codeit.el7                             @CodeIT                              768 k
Removing for dependencies:
 httpd                                           x86_64                          2.4.51-1.codeit.el7                            @CodeIT                              4.3 M
 httpd-manual                                    noarch                          2.4.51-1.codeit.el7                            @CodeIT                              7.2 M
 mod_fcgid                                       x86_64                          2.3.9-6.el7                                    @base                                228 k
 mod_http2                                       x86_64                          1.15.24-2.codeit                               @CodeIT                              535 k
 mod_ssl                                         x86_64                          1:2.4.51-1.codeit.el7                          @CodeIT                              254 k
 php                                             x86_64                          8.1.2-1.el7.remi                               @remi-php81                          5.7 M
 python2-certbot-apache                          noarch                          1.11.0-1.el7                                   @epel                                578 k

Transaction Summary
===========================================================================================================================================================================
Remove  1 Package (+7 Dependent packages)

我肯定不会删除httpd 2.4.51-1php 8.1.2-1,因为我需要它们。由于它们是最新、最好的版本,那么我认为它们不包含在 RHEL 存储库中?

所以我预计我不会轻易解决这个问题,除非我想回到旧版本?

### 使用我的解决方案更新 2 ###

我不确定这是否是一个通用的解决方案,但它为我解决了这个问题。我可能有一个回购配置错误。

首先,我检查了我的活动存储库yum repolist,我可以看到我丢失了该CodeIT存储库,因此我使用此解决方案重新安装了它如何在 Centos 7 上安装最新的 Apache 服务器 (httpd)

cd /etc/yum.repos.d && wget https://repo.codeit.guru/codeit.el`rpm -q --qf "%{VERSION}" $(rpm -q --whatprovides redhat-release)`.repo

然后我尝试了一个yum update,令我惊讶的是它有效并且可以毫无问题地更新。

然后我注意到我的 PHP 没有更新,所以我还为此重新安装了存储库,从这里可以看出,如何在 CentOS 7|RHEL 7 上安装 PHP 8.1

yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum-config-manager --disable 'remi-php*'
yum-config-manager --enable remi-php81

然后我又做了另一个yum update,突然它把 PHPO 更新到了最新的 8.1 版本:-)

也许其他人可以利用它来获得检查内容的灵感。

答案1

包“brotli-1.0.7-5.el7.x86_64”来自 EPEL 存储库:https://centos.pkgs.org/7/epel-x86_64/brotli-1.0.7-5.el7.x86_64.rpm.html

根据yum update输出,此依赖项由“v8-devel”包引入,该包引入“nodejs-devel”,然后引入“brotli-devel”。

“libbrotli-1.0.9-1.codeit.el7.x86_64”来自 CodeIT 托管的存储库:https://repo.codeit.guru/packages/centos/7/x86_64/

该存储库似乎提供了特殊的 Web 服务器构建 - Apache HTTPD 和 Nginx。

这两个包都提供了冲突的共享库:libbrotlicommon.so.1 libbrotlidec.so.1、libbrotlienc.so.1。yum无法解决此冲突,因此会出错。

据我所知,没有简单的方法可以解决这样的情况。您必须删除现有的软件包才能安装 EPEL。当然,这也会强制删除任何依赖它的软件包。yum remove libbrotli-1.0.9-1.codeit.el7.x86_64将向您显示受影响的软件包(在您确认之前,它实际上不会删除该软件包)。

相关内容