Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2088422

Summary: dnf install should report an error when it cannot resolve the dependencies of a package to install, even when strict=False and best=True
Product: Red Hat Enterprise Linux 9 Reporter: Andrew Schorr <ajschorr>
Component: dnfAssignee: Jan Kolarik <jkolarik>
Status: CLOSED ERRATA QA Contact: Tomáš Bajer <tbajer>
Severity: unspecified Docs Contact:
Priority: medium    
Version: CentOS StreamCC: bstinson, james.antill, jkolarik, jwboyer, mbanas, mblaha, tbajer
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: dnf-4.14.0-1.el9 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-09 08:18:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Andrew Schorr 2022-05-19 12:39:36 UTC
Description of problem:
When I run "dnf install opendkim", it says nothing to do without mentioning that it's unable to install the package due to missing dependencies.

Version-Release number of selected component (if applicable):
dnf-4.12.0-1.el9.noarch


How reproducible:
always


Steps to Reproduce:
1. dnf install opendkim
2.
3.

Actual results:
[root@ti129 ~]# dnf install opendkim && echo YES
Last metadata expiration check: 0:38:53 ago on Thu 19 May 2022 07:58:34 AM EDT.
Dependencies resolved.
Nothing to do.
Complete!
YES


Expected results:
Some kind of error message indicating that it cannot install the package due to missing dependencies. Such a message is produced when one runs "dnf download --resolve".



Additional info:
[root@ti129 ~]# dnf download --resolve opendkim
Last metadata expiration check: 0:40:50 ago on Thu 19 May 2022 07:58:34 AM EDT.
Error in resolve of packages:
    opendkim-2.11.0-0.28.el9.x86_64

 Problem: conflicting requests
  - nothing provides libmilter.so.1.0()(64bit) needed by opendkim-2.11.0-0.28.el9.x86_64
  - nothing provides libmemcached.so.11()(64bit) needed by opendkim-2.11.0-0.28.el9.x86_64

Comment 1 Marek Blaha 2022-05-25 10:30:22 UTC
Hm, this is strange. Either opendkim package is already installed - but in that case you should see a message like

# dnf install opendkim
Last metadata expiration check: 0:04:03 ago on Wed 25 May 2022 06:07:57 AM EDT.
Package opendkim-0:2.11.0-0.28.el9.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!

Or in case some of the requirements are not available, you should get exactly the message you wanted. Here is an example from centos stream 9 machine:

# dnf install opendkim
Last metadata expiration check: 0:06:57 ago on Wed 25 May 2022 06:07:57 AM EDT.
Error: 
 Problem: conflicting requests
  - nothing provides libmilter.so.1.0()(64bit) needed by opendkim-2.11.0-0.28.el9.x86_64
  - nothing provides libmemcached.so.11()(64bit) needed by opendkim-2.11.0-0.28.el9.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

I cannot reproduce the issue on CentosStream 9 though.

Can you check what repositories you have enabled (dnf repolist), whether opendkim is already installed (rpm -q opendkim) and from what repo the opendkim package is found (dnf repoquery opendkim --qf="%{name}-%{evr} %{repoid}")?

Comment 2 Andrew Schorr 2022-05-25 12:53:39 UTC
Ah. I see. The problem is because I added "strict=False" to /etc/dnf/dnf.conf.

Without strict=False:

[root@localhost ~]# dnf install opendkim
Extra Packages for Enterprise Linux 9 - x86_64                                                  2.5 MB/s | 6.1 MB     00:02    
Extra Packages for Enterprise Linux 9 - Next - x86_64                                           1.1 MB/s | 1.1 MB     00:00    
Error: 
 Problem: conflicting requests
  - nothing provides libmilter.so.1.0()(64bit) needed by opendkim-2.11.0-0.28.el9.x86_64
  - nothing provides libmemcached.so.11()(64bit) needed by opendkim-2.11.0-0.28.el9.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

But with strict=False:

[root@localhost ~]# dnf install opendkim
Last metadata expiration check: 0:01:34 ago on Wed 25 May 2022 07:48:39 AM CDT.
Dependencies resolved.
Nothing to do.
Complete!

From the dnf.conf man page:

       strict boolean

              If  disabled,  all  unavailable  packages  or  packages  with broken dependencies given to DNF command will be
              skipped without raising the error causing the whole operation to fail. Currently  works  for  install  command
              only. The default is True.

That is the behavior that I want (I don't want the operation to be aborted), but I would still like
to see the reasons for why it chooses not to install some of the packages. My vote would be to continue
to issue error messages even if strict=False is set, but simply don't abort the operation in that case.

Thanks,
Andy

Comment 3 Jaroslav Mracek 2022-05-26 07:54:35 UTC
I tried `dnf install zig -x lld-libs --setopt=strict=False` and it worked like expected (installin something with missing dependency). I believe that the investigation will require debugsolver data (use `--debugsolver`).

Comment 4 Marek Blaha 2022-05-26 09:18:10 UTC
There is one more config option that changes the behaviour - `best`:

with best=false (Fedora default):
# dnf install zlib-devel --exclude=pkgconf --setopt=strict=false --setopt=best=false
Last metadata expiration check: 0:07:26 ago on Thu 26 May 2022 05:07:46 AM EDT.
Dependencies resolved.

 Problem: package zlib-devel-1.2.11-33.el9.x86_64 requires /usr/bin/pkg-config, but none of the providers can be installed
  - package pkgconf-pkg-config-1.7.3-9.el9.x86_64 requires pkgconf(x86-64) = 1.7.3-9.el9, but none of the providers can be installed
  - cannot install the best candidate for the job
  - package pkgconf-1.7.3-9.el9.x86_64 is filtered out by exclude filtering
=======================================================================================================================
 Package                           Architecture          Version                        Repository                Size
=======================================================================================================================
Skipping packages with broken dependencies:
 pkgconf-pkg-config                x86_64                1.7.3-9.el9                    baseos                    11 k
 zlib-devel                        x86_64                1.2.11-33.el9                  appstream                 45 k

Transaction Summary
=======================================================================================================================
Skip  2 Packages

Nothing to do.
Complete!


with best=true (RHEL default, applied also on Centos Stream 9 where the bug is reported):
# dnf install zlib-devel --exclude=pkgconf --setopt=strict=false --setopt=best=true
Last metadata expiration check: 0:07:33 ago on Thu 26 May 2022 05:07:46 AM EDT.
Dependencies resolved.
Nothing to do.
Complete!

Comment 5 Andrew Schorr 2022-05-26 12:55:13 UTC
Ah yes, that is correct. I hadn't considered playing with best=True because that's part of the default dnf.conf file.

Comment 6 Jaroslav Mracek 2022-07-22 15:22:29 UTC
I guess that the problem is in condition in `output.py` in line 1183:

```
        if not self.conf.best and self.base._goal.actions & forward_actions:
```
I guess that the condition is supposed to also test `self.conf.strict` whether is it `False`.

Comment 8 Jan Kolarik 2022-09-02 07:57:06 UTC
Following PRs were queued to fix this:

fix:   https://github.com/rpm-software-management/dnf/pull/1847
tests: https://github.com/rpm-software-management/ci-dnf-stack/pull/1151

Comment 16 errata-xmlrpc 2023-05-09 08:18:18 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (dnf bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:2490