dnf 看不到本地托管存储库中的包

Packages in locally hosted repository are not seen by dnf

我在本地服务器上托管 2 个存储库(myrepo-main 和 AppStream)。 myrepo-main 托管 mysql 商业 rpms 和一些其他软件包。
除非我禁用 AppStream 存储库,否则大多数 mysql 包都是不可见的。

$ sudo dnf list | grep ^mysql
mysql-commercial-libs-compat.x86_64                  5.7.29-1.1.el7                                    myrepo-main

禁用 AppStream 存储库允许我在存储库中看到 mysql 包。

$ sudo dnf --disablerepo=AppStream --enablerepo=myrepo* list | grep ^mysql
mysql-commercial-client.x86_64                     5.7.29-1.1.el7                          myrepo-main
mysql-commercial-common.x86_64                     5.7.29-1.1.el7                          myrepo-main
mysql-commercial-libs.x86_64                       5.7.29-1.1.el7                          myrepo-main
mysql-commercial-libs-compat.x86_64                5.7.29-1.1.el7                          myrepo-main
mysql-commercial-server.x86_64                     5.7.29-1.1.el7                          myrepo-main

在不禁用 AppStream 存储库的情况下,存储库中的其他包在 myrepo 中可见

$ sudo dnf  list | grep myrepo
jre1.8.x86_64                                        1.8.0_211-fcs                                     @myrepo-main
tomcat.x86_64                                        8.5.41-2                                          @myrepo-main
mysql-commercial-libs-compat.x86_64                  5.7.29-1.1.el7                                    myrepo-main

我已经从客户端的 AppStream 存储库中排除了 mysql 包。

[AppStream]
name=FW-CentOS-$releasever - AppStream
baseurl=http://192.168.20.230/repos/x86/8/AppStream/AppStream
gpgcheck=1
enabled=1
gpgkey=http://192.168.20.230/repos/x86/8/RPM-GPG-KEY-FWRepo
priority=98
exclude=mysql-server,mysql-common,mysql-devel,mysql-errmsg,mysql-libs,mysql-test,mysql,mariadb,mariadb-server

[myrepo-main]
name=MyRepo Main
baseurl=http://192.168.20.230/repos/x86/8/fairwarning/fwpackages/
enabled=1
gpgcheck=1
gpgkey=http://192.168.20.230/repos/x86/8/fairwarning/fwpackages/RPM-GPG-KEY-FWRepo
priority=1

我试过了:

dnf clean all
rm -rf /var/cache/dnf/

我还尝试使用 reposync 创建没有元数据的 AppStream,删除所有 mysql rpms 并使用 createrepo_c 生成元数据。 这让我可以在 myrepo 中看到 mysql 包,但其他包在生成的元数据方面存在问题,无法安装。

我们的 CentOS6 主机有类似的配置,可以正常工作。我怀疑这是 dnf 或 AppStream 的一些功能。

来自the answer of user EOhm

This is needed, from what I understand, because of the new modules system introduced with EL8. The pgdg packages are filtered by default if dnf detects that they provides things that are also in modules but are not packaged as appropriate modules themselves.

所以有多种解法:

  • 如前所述,在 repo 定义中添加 module_hotfixes=true,这允许 DNF 更新或安装也作为模块提供的包(即使尚未安装)
  • 像 OP 一样使用 dnf --disablerepo AppStream,这可能很乏味
  • 禁用导致 dnf module disable xxx 问题的模块(我在这里不知道有问题的模块的名称)