CentOS 8 Package is excluded" in DNF

Section: Linux

The problem

While trying to build a new CentOS 8 server, I found that CentOS doesn't support Python 2.7 for mod_wsgi, that Mercurial only become Python 3 compatible with v5.2, and that CentOS only packaged v4.8.

The solution (for now) was to rebuild Mercurial on my Open Build Service account. But I was then unable to install Mercurial because "dnf" (the replacement for Yum) wouldn't list the package.

The steps

First I tried to upgrade with sudo dnf update mercurial, but got "no updates available".

Next I tried to check what packages it knew about with sudo dnf list mercurial

Last metadata expiration check: 0:15:02 ago on Tue 31 Dec 2019 14:49:56 GMT Available Packages mercurial.x86_64 4.8.2-1.module_el8.0.0+40+715dddeb AppStream mercurial.src 5.2.1-284.1 ibboard

So it knows about the system package and my source package, but not my binary package.

Then I found out about the "repository-packages" sub-command and ran sudo dnf repository-packages ibboard list. This gave me:

Last metadata expiration check: 0:05:31 ago on Tue 31 Dec 2019 14:49:56 GMT Installed Packages mod_xsendfile.x86_64 0.12-11.2 @ibboard Available Packages mercurial.src 5.2.1-284.1 ibboard mercurial-lang.noarch 5.2.1-284.1 ibboard mod_xsendfile.src 0.12-11.2 ibboard mod_xsendfile.x86_64 0.12-11.2 ibboard mod_xsendfile-debuginfo.x86_64 0.12-11.2 ibboard mod_xsendfile-debugsource.x86_64 0.12-11.2 ibboard

It could see the source package and the translations, but not the main binary package. Which is odd.

I tried to force it to install by installing the language pack (which requires a specific version) using sudo dnf install mercurial-lang. This gave:

Last metadata expiration check: 0:16:54 ago on Tue 31 Dec 2019 14:49:56 GMT Error: Problem: package mercurial-lang-5.2.1-284.1.noarch requires mercurial = 5.2.1, but none of the providers can be installed - conflicting requests - package mercurial-5.2.1-284.1.x86_64 is excluded (try to add '--skip-broken' to skip uninstallable packages)

This is helpful in that it tells me that the main Mercurial package cannot be installed, but it says nothing about why, and doesn't explain why it won't even show up in the repository packages list!

Remi Collet (of Remi's Repo) suggested that a similar problem with his packages might be a priorities issue, but that didn't solve it.

Eventually, I ran dnf with "--debugsolver" and looked at its output. I then found a line saying job install provides module(mercurial:4.8:8000020190628020724), which looked promising. dnf module list | grep mercurial showed that there was a Mercurial module. I'm not familiar with the new Fedora/CentOS "module" approach, but could that be overriding my custom packages?

The solution - modules

Running dnf module disable mercurial; dnf install mercurial disabled the CentOS Mercurial module and let it see my package of the same name!

There may be a better way, and ideally I'd use a properly maintained CentOS package (and understand how modules work) but in the meantime, disabling the module to be able to install my module works well enough!