Bug 1577018 - CentOS: dnf failing to install obsoleted packages when architecture is specified
Summary: CentOS: dnf failing to install obsoleted packages when architecture is specified
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jaroslav Mracek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-05-11 02:34 UTC by Michael DePaulo
Modified: 2018-07-02 15:06 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-05-24 15:04:17 UTC
Type: Bug


Attachments (Terms of Use)

Description Michael DePaulo 2018-05-11 02:34:47 UTC
Description of problem:

The following output is from RHEL 7.5 with the CentOS YUM4 & YUM4 testing repo. Notice that python2-django obsoletes pythond-django.

I've had this trouble with other obsoleted packages too. Even ones in the RHEL7 repos (multiple gnome-shell-extension* 3.8.x packages from RHEL 7.0 & 7.1 getting consolidated into a single gnome-shell-extension* package as of 3.22 in RHEL 7.4.)

[Michael.DePaulo@ldt-4323461 etc]$ dzdo dnf info python-django
Last metadata expiration check: 0:00:33 ago on Thu 10 May 2018 09:25:44 PM EDT.
Available Packages
Name         : python-django
Version      : 1.6.11.6
Release      : 1.el7
Arch         : noarch
Size         : 4.0 M
Source       : python-django-1.6.11.6-1.el7.src.rpm
Repo         : GFDL_EPEL_EPEL7
Summary      : A high-level Python Web framework
URL          : http://www.djangoproject.com/
License      : BSD
Description  : Django is a high-level Python Web framework that encourages rapid
             : development and a clean, pragmatic design. It focuses on automating as
             : much as possible and adhering to the DRY (Don't Repeat Yourself)
             : principle.

[Michael.DePaulo@ldt-4323461 tmp]$ dzdo dnf info python2-django
Last metadata expiration check: 0:18:16 ago on Thu 10 May 2018 10:10:02 PM EDT.
Available Packages
Name         : python2-django
Version      : 1.6.11.7
Release      : 1.el7
Arch         : noarch
Size         : 4.0 M
Source       : python-django16-1.6.11.7-1.el7.src.rpm
Repo         : GFDL_EPEL_EPEL7
Summary      : A high-level Python Web framework
URL          : http://www.djangoproject.com/
License      : BSD
Description  : Django is a high-level Python Web framework that encourages rapid
             : development and a clean, pragmatic design. It focuses on automating as
             : much as possible and adhering to the DRY (Don't Repeat Yourself)
             : principle.

[Michael.DePaulo@ldt-4323461 etc]$ dzdo dnf install python-django
Last metadata expiration check: 0:00:00 ago on Thu 10 May 2018 09:26:33 PM EDT.
Dependencies resolved.
==============================================================================================================================
 Package                                   Arch               Version                       Repository                   Size
==============================================================================================================================
Installing:
 python2-django                            noarch             1.6.11.7-1.el7                GFDL_EPEL_EPEL7             4.0 M
Installing dependencies:
 python-django-bash-completion             noarch             1.6.11.7-1.el7                GFDL_EPEL_EPEL7              17 k

Transaction Summary
==============================================================================================================================
Install  2 Packages

Total download size: 4.0 M
Installed size: 15 M
Is this ok [y/N]: N
Operation aborted.
[Michael.DePaulo@ldt-4323461 etc]$ dzdo dnf install python-django.noarch
Last metadata expiration check: 0:00:00 ago on Thu 10 May 2018 09:31:38 PM EDT.
Error: 
 Problem: conflicting requests
  - nothing provides python-django-bash-completion = 1.6.11.6-1.el7 needed by python-django-1.6.11.6-1.el7.noarch

Red Hat Satellite 6.2.14 is syncing the EPEL7 repo.

I am working around this by stripping out ".noarch" & ".x86_64" from the list of 716 leaf packages that I install.

--------
Behavior with yum instead:

[Michael.DePaulo@ldt-4323461 tmp]$ dzdo yum install python-django.noarch
Loaded plugins: enabled_repos_upload, langpacks, nvidia, package_upload, product-id,
              : search-disabled-repos, subscription-manager
Package python-django is obsoleted by python2-django, trying to install python2-django-1.6.11.7-1.el7.noarch instead
Resolving Dependencies
--> Running transaction check
---> Package python2-django.noarch 0:1.6.11.7-1.el7 will be installed
--> Processing Dependency: python-django-bash-completion = 1.6.11.7-1.el7 for package: python2-django-1.6.11.7-1.el7.noarch
--> Running transaction check
---> Package python-django-bash-completion.noarch 0:1.6.11.7-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================
 Package                          Arch      Version            Repository          Size
========================================================================================
Installing:
 python2-django                   noarch    1.6.11.7-1.el7     GFDL_EPEL_EPEL7    4.0 M
Installing for dependencies:
 python-django-bash-completion    noarch    1.6.11.7-1.el7     GFDL_EPEL_EPEL7     17 k

Transaction Summary
========================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 4.0 M
Installed size: 15 M
Is this ok [y/d/N]: N
Exiting on user command
Your transaction was saved, rerun it with:
 yum load-transaction /tmp/yum_save_tx.2018-05-10.22-26.rkD47c.yumtx
Uploading Enabled Repositories Report
Loaded plugins: langpacks, nvidia, product-id, subscription-manager



--------
Version-Release number of selected component (if applicable):
[Michael.DePaulo@ldt-4323461 etc]$ rpm -qa | grep '^rpm\|^dnf\|^yum4' | sort
dnf-2.7.5-10.el7.noarch
dnf-conf-2.7.5-10.el7.noarch
dnf-plugins-core-2.1.5-4.el7.noarch
rpm-4.11.3-32.el7.x86_64
rpm-build-4.11.3-32.el7.x86_64
rpm-build-libs-4.11.3-32.el7.x86_64
rpmdevtools-8.3-5.el7.noarch
rpm-libs-4.11.3-32.el7.x86_64
rpmlint-1.5-4.el7.noarch
rpm-python-4.11.3-32.el7.x86_64
rpm-sign-4.11.3-32.el7.x86_64
yum4-2.7.5-10.el7.noarch


--------
More info about my worfklow:
We use an Ansible task to install 716 leaf packages with the yum or dnf module from a Satellite 6.2.14 sync of EPEL7. Most x86_64 & noarch have the arch specified explicitly; it makes it easier to generate package lists & compare them against installed systems that way.

This does not fail when using the Ansible yum module instead.

These are my Ansible tasks.
- name: Install YUM4 (DNF) if available
  package:
    name: yum4
  failed_when: false
  register: yum4

- name: Refresh ansible facts for ansible_pkg_mgr
  setup: filter=ansible_pkg_mgr
  when: yum4|changed

# Reportedly this should be installed afterwards
# https://seven.centos.org/2017/10/yum-4-is-available-for-testing/
- name: install dnf-plugins-core, which makes DNF do its caching the 1st time (if available)
  package:
    name: dnf-plugins-core
  failed_when: false

# Install or remove packages from lists in bulk with DNF (YUM4)

- name: Remove Unwanted (remove) Packages
  dnf:
    name: "{{ item }}"
    state: absent
  with_lines:
  - "cat ../AdminScripts/PackageList/remove.txt"
  tags:
  - cleanup

- name: Install Common (everywhere) Packages
  dnf:
    name: "{{ item }}"
    state: present
  with_lines:
  - "cat ../AdminScripts/PackageList/everywhere.txt"
  tags:
  - everywhere
The last task is the one that fails. Output is below with the following output.
I am sure there is a better way of importing a list of packages via other Ansible lookup plugins than the "lines" ("read lines from command") plugin used in those last 2 tasks. I am in the process of rewriting code I inherited. However, I am working around it by adapting the command:
  - 'sed -r "s/.noarch|.x86_64//" ../AdminScripts/PackageList/workstations-only.txt'


This is the Ansible output:
(huge package list)
"module_stderr": "No handlers could be found for logger \"dnf\"\
nTraceback (most recent call last):\n  File \"/tmp/ansible_N7QxaB/ansible_module_dnf.py\", line 534, in <module>\n    main()\n  File \"/tmp/ansible_N7QxaB/ansible_module_dnf.py\", line 530, in main\n    ensure(module, base, params['state'], params['nam
e'], params['autoremove'])\n  File \"/tmp/ansible_N7QxaB/ansible_module_dnf.py\", line 451, in ensure\n    if not base.resolve(allow_erasing=allow_erasing):\n  File \"/usr/lib/python2.7/site-packages/dnf/base.py\", line 786, in resolve\n    raise exc\n
dnf.exceptions.DepsolveError: \n Problem: conflicting requests\n  - nothing provides python-django-bash-completion = 1.6.11.6-1.el7 needed by python-django-1.6.11.6-1.el7.noarch\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 1}

I am using ansible 2.5.0.-2.el7 from EPEL.

Comment 1 Jaroslav Mracek 2018-05-24 15:03:18 UTC
I believe that this is a behavior rather then a bug. DNF applies obsoletes only if provided information represents onlu package name. If user specify additionally version, release or arch, we do not apply obsoletes and user gets exactly what was requested. The behavior is compromise between multiple ideas how obsoletes should be handled.

Comment 2 Michael DePaulo 2018-07-02 15:06:15 UTC
@jmracek If yum4 behaves the same way, isn't that a problem?

[Michael.DePaulo@ldt-4323517 ~]$ dzdo yum4 install python-django.noarch
Last metadata expiration check: 0:00:00 ago on Mon 02 Jul 2018 11:05:04 AM EDT.
Error: 
 Problem: conflicting requests
  - nothing provides python-django-bash-completion = 1.6.11.6-1.el7 needed by python-django-1.6.11.6-1.el7.noarch


Note You need to log in before you can comment on or make changes to this bug.