大网数据广告活动
服务器运维问答

Why isn't repository priority working in yum/dnf in Centos 8?

· 52CE 我爱测

I'm trying to install a MariaDB RPM provided by MariaDB, not Centos. Since DNF natively supports priority, that should be as simple as creating a .repo file similar to: [MariaDB] name=The MariaDB 10.4 repository baseurl=http://yu…

问题原文

原帖链接 · Steve Sether · CC BY-SA 4.0

I'm trying to install a MariaDB RPM provided by MariaDB, not Centos. Since DNF natively supports priority, that should be as simple as creating a .repo file similar to:

[MariaDB]
name=The MariaDB 10.4 repository
baseurl=http://yum.mariadb.org/10.4/centos8-amd64
enabled=1
gpgcheck=1
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
priority=1

However, when I list available packages, I DO get packages from the newly entered MariaDB repo, but the priority=1 seems to be ignored and packages from CentOS AppStream with similar (but different case) names are over-riding it.

sudo yum list |grep -i mariadb-server
MariaDB-server-debuginfo.x86_64                      10.4.12-1.el8                                     MariaDB         
mariadb-server.x86_64                                3:10.3.17-1.module_el8.1.0+257+48736ea6           AppStream       
mariadb-server-galera.x86_64                         3:10.3.17-1.module_el8.1.0+257+48736ea6           AppStream       
mariadb-server-utils.x86_64                          3:10.3.17-1.module_el8.1.0+257+48736ea6           AppStream 

However, if I disable the AppStream repo in my yum command, it works as it should (ignoring the missing dependencies from AppStream):

sudo yum list --disablerepo=AppStream |grep -i mariadb-server
Modular dependency problems:

 Problem 1: conflicting requests
  - nothing provides module(perl:5.26) needed by module perl-DBD-MySQL:4.046:8010020191114030811:073fa5fe-0.x86_64
 Problem 2: conflicting requests
  - nothing provides module(perl:5.26) needed by module perl-DBI:1.641:8010020191113222731:16b3ab4d-0.x86_64
MariaDB-server.x86_64                              10.4.12-1.el8                              MariaDB         
MariaDB-server-debuginfo.x86_64                    10.4.12-1.el8                              MariaDB       

Am I doing something wrong, or is this simply just a bug in DNF, possibly from the different cases used by Centos (mariadb-server) and MariaDB (MariaDB-server).

I can get this to work manually of course, but I want to setup puppet to install it automatically, which I can't seem to get working.

已采纳解答

原帖链接 · Danila Vershinin · CC BY-SA 4.0

Case sensitivity should not matter so much here, because both packages virtually provide mariadb-server capability (same case).

The major reason why DNF wants to install MariaDB from AppStream is that it has a preference for modular packages. Which means, that if specific packages (names) or virtual provides are part of a module, and there are packages with the same names available from other repositories and they are not part of the module, then DNF will always want to install packages from the modular repository.

A useful command here, to find whether a specific package is part of a module is:

sudo dnf module provides mariadb-server

This finds any modules which have mariadb-server package.

In AppStream repo, MariaDB packages are with the mariadb module.

By disabling the AppStream we put a blind fold on DNF so it doesn't see what it likes. But the better way is to teach it to like non-modular packages by adding module_hotfixes=1 to the repository of interest, e.g.:

[MariaDB]
name=The MariaDB 10.4 repository
baseurl=http://yum.mariadb.org/10.4/centos8-amd64
enabled=1
gpgcheck=1
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
priority=1
module_hotfixes=1

Note that priority config should be retained, because technically 3:10.3.17 (higher Epoch: 3) version still wins over 10.4.12 (Epoch: none, same as 0:10.4.12).

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-05-12)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。