Bug 1381947

Summary: dnf install a and dnf install b-which-requires-a end up with different version of a
Product: [Fedora] Fedora Reporter: Jan Pazdziora <jpazdziora>
Component: libsolvAssignee: rpm-software-management
Status: CLOSED CANTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 27CC: dmach, ignatenko, jmracek, jpazdziora, mls, packaging-team-maint, rpm-software-management, vmukhame
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-06-18 19:50:21 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:
Attachments:
Description Flags
debugdata of dnf install sssd
none
debugdata of dnf install want-sssd none

Description Jan Pazdziora 2016-10-05 12:07:28 UTC
Description of problem:

On Fedora base image, there is sssd-client package in certain version (1.13.4):

# docker run --rm -ti fedora:24 rpm -q sssd-client
sssd-client-1.13.4-3.fc24.x86_64

When running

   dnf install sssd

which resolves either to sssd-1.14.1 from updates repo or to sssd-1.13.4 from the GA repo, will upgrade sssd-client to 1.14.1 version.

However, running

   dnf install package-which-requires-sssd

will install the old version of sssd, without upgrading sssd-client.

Version-Release number of selected component (if applicable):

dnf-1.1.9-2.fc24.noarch

How reproducible:

Deterministic.

Steps to Reproduce:
1. $ docker run --rm -ti fedora:24 bash
2. # rpm -q sssd-client
sssd-client-1.13.4-3.fc24.x86_64
3. # # dnf install sssd
Fedora 24 - x86_64 - Updates                     42 MB/s |  16 MB     00:00    
Fedora 24 - x86_64                               59 MB/s |  47 MB     00:00    
Last metadata expiration check: 0:00:21 ago on Wed Oct  5 12:01:45 2016.
Dependencies resolved.
================================================================================
 Package                 Arch       Version                   Repository   Size
================================================================================
Installing:
 GeoIP                   x86_64     1.6.9-2.fc24              fedora      119 k
 GeoIP-GeoLite-data      noarch     2016.07-1.fc24            updates     404 k
 adcli                   x86_64     0.8.0-2.fc24              fedora       93 k
 avahi-libs              x86_64     0.6.32-4.fc24             updates      61 k
 bind-libs               x86_64     32:9.10.4-2.P3.fc24       updates     151 k
 bind-libs-lite          x86_64     32:9.10.4-2.P3.fc24       updates     1.0 M
 bind-license            noarch     32:9.10.4-2.P3.fc24       updates      88 k
 bind-utils              x86_64     32:9.10.4-2.P3.fc24       updates     407 k
 c-ares                  x86_64     1.11.0-1.fc24             fedora       88 k
 cups-libs               x86_64     1:2.1.4-2.fc24            updates     398 k
 cyrus-sasl-gssapi       x86_64     2.1.26-26.2.fc24          fedora       46 k
 http-parser             x86_64     2.7.1-2.fc24              updates      34 k
 jansson                 x86_64     2.9-1.fc24                updates      40 k
 libbasicobjects         x86_64     0.1.1-29.fc24             updates      29 k
 libcollection           x86_64     0.7.0-29.fc24             updates      45 k
 libdhash                x86_64     0.4.3-29.fc24             updates      32 k
 libini_config           x86_64     1.3.0-29.fc24             updates      66 k
 libipa_hbac             x86_64     1.14.1-3.fc24             updates      76 k
 libldb                  x86_64     1.1.26-1.fc24             fedora      133 k
 libnfsidmap             x86_64     0.26-6.rc4.fc24           updates      51 k
 libnl3                  x86_64     3.2.28-3.fc24             updates     273 k
 libpath_utils           x86_64     0.2.1-29.fc24             updates      32 k
 libref_array            x86_64     0.1.5-29.fc24             updates      30 k
 libsmbclient            x86_64     2:4.4.6-1.fc24            updates     122 k
 libsss_autofs           x86_64     1.14.1-3.fc24             updates      78 k
 libsss_sudo             x86_64     1.14.1-3.fc24             updates      76 k
 libtalloc               x86_64     2.1.6-1.fc24              fedora       45 k
 libtdb                  x86_64     1.3.9-1.fc24              fedora       50 k
 libtevent               x86_64     0.9.28-1.fc24             fedora       37 k
 libwbclient             x86_64     2:4.4.6-1.fc24            updates      96 k
 python3-sssdconfig      noarch     1.14.1-3.fc24             updates     102 k
 samba-client-libs       x86_64     2:4.4.6-1.fc24            updates     4.6 M
 samba-common            noarch     2:4.4.6-1.fc24            updates     188 k
 sssd                    x86_64     1.14.1-3.fc24             updates      68 k
 sssd-ad                 x86_64     1.14.1-3.fc24             updates     188 k
 sssd-common             x86_64     1.14.1-3.fc24             updates     1.2 M
 sssd-common-pac         x86_64     1.14.1-3.fc24             updates     113 k
 sssd-ipa                x86_64     1.14.1-3.fc24             updates     260 k
 sssd-krb5               x86_64     1.14.1-3.fc24             updates     107 k
 sssd-krb5-common        x86_64     1.14.1-3.fc24             updates     135 k
 sssd-ldap               x86_64     1.14.1-3.fc24             updates     174 k
 sssd-nfs-idmap          x86_64     1.14.1-3.fc24             updates      69 k
 sssd-proxy              x86_64     1.14.1-3.fc24             updates     102 k
 systemd-compat-libs     x86_64     229-8.fc24                fedora      151 k
Upgrading:
 libsss_idmap            x86_64     1.14.1-3.fc24             updates      80 k
 sssd-client             x86_64     1.14.1-3.fc24             updates     132 k

Transaction Summary
================================================================================
Install  44 Packages
Upgrade   2 Packages

Total download size: 12 M
Is this ok [y/N]: n
Operation aborted.
4. Have rpm built from

Summary: Require sssd to test dnf install behaviour
Name: want-sssd
License: GPLv2+
Version: 1.0
Release: 1%{?dist}
Group: Applications/System
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildArch: noarch

Requires: sssd

%description

Require sssd to test dnf install behaviour

%files

5. # dnf install want-sssd-1.0-1.fc24.noarch.rpm

Actual results:

Last metadata expiration check: 0:00:33 ago on Wed Oct  5 12:01:45 2016.
Dependencies resolved.
================================================================================
 Package                Arch      Version                 Repository       Size
================================================================================
Installing:
 GeoIP                  x86_64    1.6.9-2.fc24            fedora          119 k
 GeoIP-GeoLite-data     noarch    2016.07-1.fc24          updates         404 k
 avahi-libs             x86_64    0.6.32-4.fc24           updates          61 k
 bind-libs              x86_64    32:9.10.4-2.P3.fc24     updates         151 k
 bind-libs-lite         x86_64    32:9.10.4-2.P3.fc24     updates         1.0 M
 bind-license           noarch    32:9.10.4-2.P3.fc24     updates          88 k
 bind-utils             x86_64    32:9.10.4-2.P3.fc24     updates         407 k
 c-ares                 x86_64    1.11.0-1.fc24           fedora           88 k
 cups-libs              x86_64    1:2.1.4-2.fc24          updates         398 k
 cyrus-sasl-gssapi      x86_64    2.1.26-26.2.fc24        fedora           46 k
 libbasicobjects        x86_64    0.1.1-29.fc24           updates          29 k
 libcollection          x86_64    0.7.0-29.fc24           updates          45 k
 libdhash               x86_64    0.4.3-29.fc24           updates          32 k
 libini_config          x86_64    1.3.0-29.fc24           updates          66 k
 libipa_hbac            x86_64    1.13.4-3.fc24           fedora           74 k
 libldb                 x86_64    1.1.26-1.fc24           fedora          133 k
 libnfsidmap            x86_64    0.26-6.rc4.fc24         updates          51 k
 libnl3                 x86_64    3.2.28-3.fc24           updates         273 k
 libpath_utils          x86_64    0.2.1-29.fc24           updates          32 k
 libref_array           x86_64    0.1.5-29.fc24           updates          30 k
 libsmbclient           x86_64    2:4.4.6-1.fc24          updates         122 k
 libsss_autofs          x86_64    1.13.4-3.fc24           fedora           78 k
 libsss_sudo            x86_64    1.13.4-3.fc24           fedora           77 k
 libtalloc              x86_64    2.1.6-1.fc24            fedora           45 k
 libtdb                 x86_64    1.3.9-1.fc24            fedora           50 k
 libtevent              x86_64    0.9.28-1.fc24           fedora           37 k
 libwbclient            x86_64    2:4.4.6-1.fc24          updates          96 k
 python3-sssdconfig     noarch    1.13.4-3.fc24           fedora          102 k
 samba-client-libs      x86_64    2:4.4.6-1.fc24          updates         4.6 M
 samba-common           noarch    2:4.4.6-1.fc24          updates         188 k
 sssd                   x86_64    1.13.4-3.fc24           fedora           68 k
 sssd-ad                x86_64    1.13.4-3.fc24           fedora          180 k
 sssd-common            x86_64    1.13.4-3.fc24           fedora          1.1 M
 sssd-common-pac        x86_64    1.13.4-3.fc24           fedora          114 k
 sssd-ipa               x86_64    1.13.4-3.fc24           fedora          249 k
 sssd-krb5              x86_64    1.13.4-3.fc24           fedora          106 k
 sssd-krb5-common       x86_64    1.13.4-3.fc24           fedora          134 k
 sssd-ldap              x86_64    1.13.4-3.fc24           fedora          174 k
 sssd-proxy             x86_64    1.13.4-3.fc24           fedora          101 k
 systemd-compat-libs    x86_64    229-8.fc24              fedora          151 k
 want-sssd              noarch    1.0-1.fc24              @commandline    5.6 k

Transaction Summary
================================================================================
Install  41 Packages

Total size: 11 M
Total download size: 11 M
Installed size: 32 M
Is this ok [y/N]: n
Operation aborted.

Expected results:

I'd expect the result to be the same in both cases, ideally dnf either defaulting or having an option to prefer the latest version in any case.

Additional info:

Comment 2 Jan Pazdziora 2016-10-05 12:09:15 UTC
Running

dnf install --best --allowerasing want-sssd-1.0-1.fc24.noarch.rpm

installs the old version of sssd as well.

Comment 3 Igor Gnatenko 2016-10-05 12:09:53 UTC
I think install prefers install-without-upgrade. Please run both commands with "--debugsolver" and attach "debugdata" directories.

Comment 4 Jan Pazdziora 2016-10-05 12:17:39 UTC
Running

dnf install --setopt=updates.priority=1 --setopt=fedora.priority=1000000 want-sssd-1.0-1.fc24.noarch.rpm

does not work either -- old version of sssd is installed.

Comment 5 Jan Pazdziora 2016-10-05 12:23:22 UTC
Created attachment 1207585 [details]
debugdata of dnf install sssd

debugdata of dnf install sssd

Comment 6 Jan Pazdziora 2016-10-05 12:24:09 UTC
Created attachment 1207586 [details]
debugdata of dnf install want-sssd

debugdata of dnf install want-sssd

Comment 7 Igor Gnatenko 2016-10-05 12:32:07 UTC
Let's see what's going on..

Comment 8 Jan Pazdziora 2016-10-05 12:33:35 UTC
Also,

dnf install want-sssd-1.0-1.fc24.noarch.rpm sssd

selects install of the latest available sssd and upgrade of sssd-client. So merely mentioning package makes dnf want to install it in the latest version.

Comment 9 Igor Gnatenko 2016-10-05 12:55:50 UTC
hmm...

propagate for decision 63284 level 1
    want-sssd-1.0-1.fc24.noarch [63284] Install.level1
  watch triggered Rule #1:
    !want-sssd-1.0-1.fc24.noarch [63284] (w1) Install.level1
    sssd-1.13.4-3.fc24.x86_64 [40128] (w2)
    sssd-1.14.1-3.fc24.x86_64 [60110]
    next rules: 0 0
    -> move w1 to sssd-1.14.1-3.fc24.x86_64


...

keeping libsss_idmap-1.13.4-3.fc24.x86_64


I think it's libsolv's behavior to try to not update unless needed. Michael, can you provide hint for us, please? ;)

Comment 10 Jan Pazdziora 2016-10-05 13:08:54 UTC
Why doesn't libsolv "not update unless needed" for "dnf install sssd" either?

Comment 11 Igor Gnatenko 2016-10-05 13:10:09 UTC
(In reply to Jan Pazdziora from comment #10)
> Why doesn't libsolv "not update unless needed" for "dnf install sssd" either?

because you ask to install "newest" sssd which REQUIRES new sssd-client.

Comment 12 Jan Pazdziora 2016-10-05 13:26:53 UTC
How come

    dnf install sssd

asks for newest sssd?

Man page says

       dnf [options] install <spec>...
              DNF makes sure that the given packages  and  their  dependencies
              are  installed  on  the  system.

It does not say that <spec> and <package-spec> without exact version mean newest version of the package.

Alternatively, why doesn't

    Requires: sssd

mean to install newest sssd?

Comment 13 Michael Schröder 2016-10-05 14:23:03 UTC
Because that is what most users expect (at least in my opinion).
libsolv tries to install the best version of the packages specified in the jobs, as that are the packages that are going to be used. This is not done for "dependency" packages, where the focus is on keeping the number of updates low.

Actually you can change the behavior with a solver flag: SOLVER_FLAG_FOCUS_INSTALLED will tell libsolv it should not focus on the best versions for the specified packages.

Comment 14 Jan Pazdziora 2016-10-06 11:03:02 UTC
(In reply to Michael Schröder from comment #13)
> This is not done for "dependency" packages, where the focus is on keeping the > number of updates low.
> 
> Actually you can change the behavior with a solver flag:
> SOLVER_FLAG_FOCUS_INSTALLED will tell libsolv it should not focus on the
> best versions for the specified packages.

Is there a way to force installation of latest package versions for dependent packages, even if it means upgrading existing installed packages?

Is there a way to set the flag(s) for dnf operations, via command line option or environment variables?

Comment 15 Michael Schröder 2016-10-10 11:04:48 UTC
> Is there a way to force installation of latest package versions for dependent
> packages, even if it means upgrading existing installed packages?

No, at least not until today. Commit a5b506bae70d1fc56f9c9f25364f14418f2d8873 adds support for SOLVER_FLAG_FOCUS_BEST.

Comment 16 Honza Silhan 2016-10-17 14:36:58 UTC
It should install the highest available installable version at least when "dnf ... --best" is set. WRT yum-DNF compatibility `--best` would be set by default when executed from /usr/bin/yum.

Thanks Michael for support in libsolv.

Comment 17 Michael Schröder 2016-10-18 09:22:55 UTC
(--best is somewhat different, it 1) only works on jobs and 2) enforces installation of the newest packages. There's no such thing for dependencies)

Comment 18 Jaroslav Mracek 2017-03-30 12:09:24 UTC
I think that problem here is a behavior rather then a bug. Present solver setting prefer reduce number of installed dependency to minimal, therefore it do not prefer to install latest sssd, due to additional weak dependency that results in additional packages in transaction.

Comment 19 Igor Gnatenko 2017-07-01 17:16:31 UTC
(In reply to Jaroslav Mracek from comment #18)
> I think that problem here is a behavior rather then a bug. Present solver
> setting prefer reduce number of installed dependency to minimal, therefore
> it do not prefer to install latest sssd, due to additional weak dependency
> that results in additional packages in transaction.

But that's how yum was behaving... So probably we want to use it from dnf-yum wrapper.

Comment 20 Fedora End Of Life 2017-07-25 23:21:56 UTC
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '24'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 21 Jan Kurik 2017-08-15 06:57:10 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 27 development cycle.
Changing version to '27'.

Comment 22 Jaroslav Mracek 2018-06-18 19:50:21 UTC
I create some initial test, but I think that we cannot change the behavior even for yum prefix. I am really sorry but we cannot do much here.