Bug 1036116

Summary: dnf install failed with exception
Product: [Fedora] Fedora Reporter: Jaroslav Škarvada <jskarvad>
Component: dnfAssignee: Zdeněk Pavlas <zpavlas>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: akozumpl, dcharlespyle, jskarvad, jwrigley7, jzeleny, lslebodn, packaging-team-maint, pnemade, rholy, zpavlas
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: dnf-0.4.9-1.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-12-14 02:45:33 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 Jaroslav Škarvada 2013-11-29 13:31:49 UTC
Description of problem:
This happened with rpmfusion, but it shouldn't do that. The problem is that it didn't import the keys. I guess this can happen with other repos as well. Yum finished the transaction OK and asked for the keys to import. The problem appeared on cleanly provisioned machine.

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

How reproducible:
Always

Steps to Reproduce:
1. yum install "http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-rawhide.noarch.rpm"
2. yum install "http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-rawhide.noarch.rpm"
3. yum install dnf
4. dnf install akmod-VirtualBox VirtualBox

Actual results:
Exception (see Additional info)

Expected results:
No exception and finished installation

Additional info:
# dnf install akmod-VirtualBox VirtualBox
Resolving dependencies
--> Starting dependency resolution
---> Package akmod-VirtualBox.i686 4.3.2-1.fc20 will be instalován
---> Package VirtualBox.i686 4.3.2-1.fc20 will be instalován
---> Package kmodtool.noarch 1-22.fc19 will be instalován
---> Package akmods.noarch 0.5.1-3.fc19 will be instalován
---> Package VirtualBox-kmodsrc.i686 4.3.2-1.fc20 will be instalován
---> Package gsoap.i686 2.8.12-4.fc20 will be instalován
---> Package libvpx.i686 1.2.0-2.fc20 will be instalován
---> Package SDL.i686 1.2.15-11.fc20 will be instalován
---> Package bzip2.i686 1.0.6-9.fc20 will be instalován
---> Package rpm-build.i686 4.11.1-7.fc20 will be instalován
---> Package rpmdevtools.noarch 8.4-2.fc20 will be instalován
---> Package elfutils.i686 0.157-1.fc20 will be instalován
---> Package gdb.i686 7.6.50.20130731-16.fc20 will be instalován
---> Package redhat-rpm-config.noarch 9.1.0-54.fc20 will be instalován
---> Package fakeroot.i686 1.18.4-2.fc20 will be instalován
---> Package dwz.i686 0.11-2.fc20 will be instalován
---> Package perl-srpm-macros.noarch 1-10.fc20 will be instalován
---> Package fakeroot-libs.i686 1.18.4-2.fc20 will be instalován
---> Package xemacs-filesystem.noarch 21.5.34-4.fc20 will be instalován
--> Finished dependency resolution
Dependencies resolved.

======================================================================================================================================================================
 Package                                 Arch                        Verze                                          Repozitář                                    Vel.
======================================================================================================================================================================
Instalování:
 akmod-VirtualBox                        i686                        4.3.2-1.fc20                                   rpmfusion-free-rawhide                       16 k
 VirtualBox                              i686                        4.3.2-1.fc20                                   rpmfusion-free-rawhide                       29 M
 kmodtool                                noarch                      1-22.fc19                                      rpmfusion-free-rawhide                       13 k
 akmods                                  noarch                      0.5.1-3.fc19                                   rpmfusion-free-rawhide                       19 k
 VirtualBox-kmodsrc                      i686                        4.3.2-1.fc20                                   rpmfusion-free-rawhide                      625 k
 gsoap                                   i686                        2.8.12-4.fc20                                  fedora                                      236 k
 libvpx                                  i686                        1.2.0-2.fc20                                   fedora                                      210 k
 SDL                                     i686                        1.2.15-11.fc20                                 fedora                                      216 k
 bzip2                                   i686                        1.0.6-9.fc20                                   fedora                                       52 k
 rpm-build                               i686                        4.11.1-7.fc20                                  fedora                                      140 k
 rpmdevtools                             noarch                      8.4-2.fc20                                     fedora                                       96 k
 elfutils                                i686                        0.157-1.fc20                                   fedora                                      263 k
 gdb                                     i686                        7.6.50.20130731-16.fc20                        fedora                                      2.4 M
 redhat-rpm-config                       noarch                      9.1.0-54.fc20                                  fedora                                       73 k
 fakeroot                                i686                        1.18.4-2.fc20                                  fedora                                       83 k
 dwz                                     i686                        0.11-2.fc20                                    fedora                                       96 k
 perl-srpm-macros                        noarch                      1-10.fc20                                      fedora                                      4.9 k
 fakeroot-libs                           i686                        1.18.4-2.fc20                                  fedora                                       23 k
 xemacs-filesystem                       noarch                      21.5.34-4.fc20                                 updates-testing                              15 k

Shrnutí transakce
======================================================================================================================================================================
Instalovat  19 Balíček

Celková velikost ke stahování: 34 M
Nainstalovaná velikost: 34 M
V pořádku [a/N]: y
Stahování balíčků:
(1/19): akmod-VirtualBox-4.3.2-1.fc20.i686.rpm                                                                                         30 kB/s |  16 kB     00:00    
(2/19): kmodtool-1-22.fc19.noarch.rpm                                                                                                  25 kB/s |  13 kB     00:00    
(3/19): akmods-0.5.1-3.fc19.noarch.rpm                                                                                                 70 kB/s |  19 kB     00:00    
(4/19): gsoap-2.8.12-4.fc20.i686.rpm                                                                                                  2.3 MB/s | 236 kB     00:00    
(5/19): libvpx-1.2.0-2.fc20.i686.rpm                                                                                                  3.3 MB/s | 210 kB     00:00    
(6/19): SDL-1.2.15-11.fc20.i686.rpm                                                                                                   5.3 MB/s | 216 kB     00:00    
(7/19): bzip2-1.0.6-9.fc20.i686.rpm                                                                                                   680 kB/s |  52 kB     00:00    
(8/19): rpm-build-4.11.1-7.fc20.i686.rpm                                                                                              2.2 MB/s | 140 kB     00:00    
(9/19): rpmdevtools-8.4-2.fc20.noarch.rpm                                                                                             4.7 MB/s |  96 kB     00:00    
(10/19): elfutils-0.157-1.fc20.i686.rpm                                                                                               3.7 MB/s | 263 kB     00:00    
(11/19): gdb-7.6.50.20130731-16.fc20.i686.rpm                                                                                          17 MB/s | 2.4 MB     00:00    
(12/19): redhat-rpm-config-9.1.0-54.fc20.noarch.rpm                                                                                   2.7 MB/s |  73 kB     00:00    
(13/19): fakeroot-1.18.4-2.fc20.i686.rpm                                                                                              1.9 MB/s |  83 kB     00:00    
(14/19): dwz-0.11-2.fc20.i686.rpm                                                                                                     1.8 MB/s |  96 kB     00:00    
(15/19): perl-srpm-macros-1-10.fc20.noarch.rpm                                                                                        239 kB/s | 4.9 kB     00:00    
(16/19): fakeroot-libs-1.18.4-2.fc20.i686.rpm                                                                                         554 kB/s |  23 kB     00:00    
(17/19): xemacs-filesystem-21.5.34-4.fc20.noarch.rpm                                                                                  297 kB/s |  15 kB     00:00    
(18/19): VirtualBox-kmodsrc-4.3.2-1.fc20.i686.rpm                                                                                     286 kB/s | 625 kB     00:02    
(19/19): VirtualBox-4.3.2-1.fc20.i686.rpm                                                                                             2.1 MB/s |  29 MB     00:13    
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Celkem                                                                                                                                1.7 MB/s |  34 MB     00:19     
varování: /var/cache/dnf/i386/20/rpmfusion-free-rawhide/packages/akmod-VirtualBox-4.3.2-1.fc20.i686.rpm: Hlavička V3 RSA/SHA256 Signature, key ID ae688223: NOKEY
Získávání klíče z file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-fedora-latest
Traceback (most recent call last):
  File "/usr/bin/dnf", line 35, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 279, in user_main
    errcode = main(args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 64, in main
    return _main(base, args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 192, in _main
    return_code, resultmsgs = base.do_transaction()
  File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 198, in do_transaction
    if self.gpgsigcheck(downloadpkgs) != 0:
  File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 233, in gpgsigcheck
    self.getKeyForPackage(po, fn)
  File "/usr/lib/python2.7/site-packages/dnf/base.py", line 2263, in getKeyForPackage
    keys = self._retrievePublicKey(keyurl, repo)
  File "/usr/lib/python2.7/site-packages/dnf/base.py", line 2159, in _retrievePublicKey
    rawkey = dnf.util.urlopen(keyurl, repo).read()
ValueError: I/O operation on closed file

Comment 1 Zdeněk Pavlas 2013-11-29 13:51:24 UTC
Seems that dnf.util.urlopen() returned a closed file.  This might be related to recent TemporaryFile => NamedTemporaryFile changes..  I'll take a look.

Comment 2 Zdeněk Pavlas 2013-11-29 13:52:30 UTC
Does the error appear on subsequent runs, too?  Is /etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-fedora-latest present, readable and sane (non-empty)?

Comment 3 Jaroslav Škarvada 2013-11-29 13:55:03 UTC
(In reply to Zdeněk Pavlas from comment #2)
> Does the error appear on subsequent runs, too?  Is
> /etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-fedora-latest present, readable
> and sane (non-empty)?

It seems so, I tried the dnf install command twice and both failed.

Comment 4 Jaroslav Škarvada 2013-11-29 13:56:30 UTC
Yum worked correctly, so /etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-fedora-latest is probably OK. The machine is now installing, I can retry later.

Comment 5 Zdeněk Pavlas 2013-11-29 14:19:06 UTC
That's a really weird bug..

>>> tempfile.NamedTemporaryFile().read()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: I/O operation on closed file

but

>>> f = tempfile.NamedTemporaryFile(); print repr(f.read()); del f
''

A bound method references the object with "self", so it should *not* be GC'd and closed, but there's probably too much magic somewhere.  Workaround is simple, but it's definitely a Python bug.

Fixed in commit 4b24f0b

Comment 6 Zdeněk Pavlas 2013-11-29 14:20:05 UTC
https://github.com/zde/dnf/commit/4b24f0b

Comment 7 Zdeněk Pavlas 2013-11-29 15:03:18 UTC
FYI http://bugs.python.org/issue18879

Comment 8 Ales Kozumplik 2013-12-02 07:23:30 UTC
*** Bug 1036232 has been marked as a duplicate of this bug. ***

Comment 9 Fedora Update System 2013-12-03 16:40:17 UTC
dnf-0.4.9-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/dnf-0.4.9-1.fc20

Comment 10 Fedora Update System 2013-12-03 18:21:02 UTC
Package dnf-0.4.9-1.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing dnf-0.4.9-1.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-22638/dnf-0.4.9-1.fc20
then log in and leave karma (feedback).

Comment 11 Radek Holy 2013-12-11 15:36:25 UTC
*** Bug 1040477 has been marked as a duplicate of this bug. ***

Comment 12 Fedora Update System 2013-12-14 02:45:33 UTC
dnf-0.4.9-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 13 D. Charles Pyle 2015-06-09 07:13:18 UTC
This same kind of problem persists in dnf in Fedora 22.  Still does not install keys.  Also does not handle exceptions very well without either crashing or failing out.  Unfortunately, I cannot get details from the yumex client as a good number of them are off the screen and cannot be selected for copying and pasting.

Comment 14 D. Charles Pyle 2015-06-09 07:20:57 UTC
After exhausting all options, I finally ran dnf at the command line and I was able to import the new keys as well as complete the updates successfully.  After that, however, yumex (dnf) ignored the fact that all the updates already were installed and attempted to redownload and reinstall them all over again, only to warn me that they all were already installed.  Again, the list and dialog containing the list went off the screen and could not be selected.