Bug 1375447

Summary: dnf failed with 'AssertionError: Unknown reason: 4'
Product: [Fedora] Fedora Reporter: Thierry Vignaud <tvignaud>
Component: dnfAssignee: rpm-software-management
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 24CC: jsilhan, mluscon, packaging-team-maint, pnemade, rpm-software-management, tvignaud, vmukhame
Target Milestone: ---Flags: tvignaud: needinfo-
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-09-13 07:51:09 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
DNF failure backtrace on update
none
DNF failure backtrace on downgrade none

Description Thierry Vignaud 2016-09-13 07:25:46 UTC
Created attachment 1200371 [details]
DNF failure backtrace on update

Description of problem:

Dnf kept failing with "AssertionError: Unknown reason: 4":

$ sudo dnf update
(...)
  File "/usr/lib/python3.5/site-packages/dnf/base.py", line 451, in _goal2transaction
    ts.add_install(pkg, obs, goal.get_reason(pkg))
  File "/usr/lib/python3.5/site-packages/dnf/goal.py", line 43, in get_reason
    assert False, 'Unknown reason: %d' % code
AssertionError: Unknown reason: 4


After adding a print trace, there's 2 packages that causes this.

It works fine if excluding the 2 packages that break dnf:
dnf update -x oci-register-machine -x oci-systemd-hook

The error do not happen once OS is updated.
It happens that the 2 packages above are recommended by docker.

I guess those 2 packages are 2 new recommends from the docker package

The error can be reproduced with downgrade:

# LC_ALL=C dnf downgrade docker --allowerasing
(...)
  File "/usr/lib/python3.5/site-packages/dnf/base.py", line 452, in _goal2transaction
    ts.add_install(pkg, obs, goal.get_reason(pkg))
  File "/usr/lib/python3.5/site-packages/dnf/goal.py", line 43, in get_reason
    assert False, 'Unknown reason: %d' % code
AssertionError: Unknown reason: 4

The full backtraces are attached.


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

How reproducible:
Awlays


Steps to Reproduce:
1. try to update a system where docker was installed
2. or install docker w/o oci* then try to downgrade docker
3.

Actual results:
dnf fails, it's no more possible to update

Expected results:
Dnf should ignore the packages it cannot handle and just reports warnings but must continue updating the *other* packages

Extra information:
docker-1.10.3-50.gita612434.fc24.x86_64

Comment 1 Thierry Vignaud 2016-09-13 07:26:25 UTC
Created attachment 1200373 [details]
DNF failure backtrace on downgrade

Comment 2 Igor Gnatenko 2016-09-13 07:28:37 UTC
What version of DNF/RPM/libhif/hawkey you have?

Comment 3 Thierry Vignaud 2016-09-13 07:31:41 UTC
Note that the line number in base.py has shifted in the 2nd backtrace b/c I'd added a "print(pkg)" line

Comment 4 Thierry Vignaud 2016-09-13 07:32:35 UTC
(In reply to Igor Gnatenko from comment #2)
> What version of DNF/RPM/libhif/hawkey you have?

$ rpm -q rpm dnf hawkey libhif 
rpm-4.13.0-0.rc1.27.fc24.x86_64
dnf-1.1.10-1.fc24.noarch
hawkey-0.6.3-6.fc24.x86_64
libhif-0.2.3-1.fc24.x86_64

Comment 5 Thierry Vignaud 2016-09-13 07:37:04 UTC
And according to the following command, they were not part of the update with -x, so both backtraces were with those versions:
# rpm -q --qf '%{installtime} %{name}\n' rpm dnf hawkey  libhif |sort
1466468385 rpm
1469370794 libhif
1471815727 dnf
1473241481 hawkey

Comment 6 Thierry Vignaud 2016-09-13 07:51:09 UTC
It was due to having a newer (unreleased) hawkey