Bug 1479795 - python2-urllib3 fails when dnf is updating
python2-urllib3 fails when dnf is updating
Product: Fedora
Classification: Fedora
Component: python-urllib3 (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Fedora Infrastructure SIG
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2017-08-09 08:17 EDT by Moises Bites
Modified: 2017-11-21 09:16 EST (History)
16 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2017-11-21 09:16:35 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Moises Bites 2017-08-09 08:17:48 EDT
Description of problem:
After upgrade Fedora from 25 o 26 version, the python2-urllib3 is not updating from dnf command.

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

How reproducible:

> sudo dnf update -y --best --allowerasing --refresh
Error unpacking rpm package python2-urllib3-1.20-1.fc26.noarch
erro: a descompactação do arquivo falhou  no arquivo /usr/lib/python2.7/site-packages/urllib3/packages/ssl_match_hostname: cpio: rename

> sudo dnf install python2-requests
Error unpacking rpm package python2-urllib3-1.20-1.fc26.noarch
erro: a descompactação do arquivo falhou  no arquivo /usr/lib/python2.7/site-packages/urllib3/packages/ssl_match_hostname: cpio: rename
  Instalando          : python-chardet-2.3.0-3.fc26.noarch
Comment 1 Jeremy Cline 2017-08-10 09:57:05 EDT
Hi Moises,

It looks like you used ``sudo pip`` to install some Python packages. You'll need to remove those packages and then dnf reinstall them to get them back to a known state for RPM before you can update.
Comment 2 Michal Bocek 2017-11-21 07:11:44 EST
I've experienced a similar error when trying to update the package regularly using dnf. I ran the command on f27 system, right after the upgrade from f26.

$ sudo dnf update python2-urllib3
Running transaction
  Preparing        :                                                                                                          1/1 
  Upgrading        : python2-urllib3-1.22-2.fc27.noarch                                                                       1/2 
Error unpacking rpm package python2-urllib3-1.22-2.fc27.noarch
Error unpacking rpm package python2-urllib3-1.22-2.fc27.noarch
error: unpacking of archive failed on file /usr/lib/python2.7/site-packages/urllib3/packages/ssl_match_hostname: cpio: File from package already exists as a directory in system
python2-urllib3-1.22-2.fc27.noarch was supposed to be installed but is not!
  Verifying        : python2-urllib3-1.22-2.fc27.noarch                                                                       1/2 
python2-urllib3-1.20-1.fc26.noarch was supposed to be removed but is not!
  Verifying        : python2-urllib3-1.20-1.fc26.noarch                                                                       2/2 

  python2-urllib3.noarch 1.22-2.fc27                                                                                              

Error: Transaction failed

Additional info:
The [0] file used to be a directory with version 1.20-1.fc26, but with 1.22-2.fc27 it has changed to a symlink. RPM cannot handle this. To avoid that, follow the instructions here [1].

[0] /usr/lib/python2.7/site-packages/urllib3/packages/ssl_match_hostname
[1] https://fedoraproject.org/wiki/Packaging:Directory_Replacement
Comment 3 Jeremy Cline 2017-11-21 09:16:35 EST
Hi Michal,

The file was not a directory in 1.20-1.fc26[0] nor is it a directory in 1.22-2.fc27[1]. It is a directory in upstream[2] since upstream vendors that package.

You have the upstream package installed. ``sudo pip install`` is _not_ safe and you should not ever do it because it writes to the same directory as RPM. You'll need to get rid of the offending directory and re-install the package.

[0] http://koji.fedoraproject.org/koji/search?terms=python-urllib3-1.20-1.fc26&type=build&match=glob
[1] http://koji.fedoraproject.org/koji/search?terms=python-urllib3-1.22-2.fc27&type=build&match=glob
[2] https://github.com/shazow/urllib3/tree/1.22/urllib3/packages

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