Bug 1332538

Summary: pyanaconda.packaging.PayloadError: DNF error: error reading package headerTraceback (most recent call last):
Product: [Fedora] Fedora Reporter: Dale Turner <rxguy>
Component: libdnfAssignee: Michael Mráka <mmraka>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 24CC: anaconda-maint-list, g.kaviyarasu, jmracek, jonathan, jorton, jzeleny, mluscon, mmraka, novyjindrich, packaging-team-maint, pknirsch, pmatilai, pnemade, rpm-software-management, vanmeeuwen+fedora, vmukhame
Target Milestone: ---Keywords: EasyFix, Triaged
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:f81ab29f15841ffd914786d86387ce17ed4a00403b4fc595a811be8ff4a53b0f;
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-08 15:16:51 UTC Type: ---
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
File: anaconda-tb
none
File: anaconda.log
none
File: dnf.log
none
File: dnf.rpm.log
none
File: environ
none
File: lsblk_output
none
File: lvm.log
none
File: nmcli_dev_list
none
File: os_info
none
File: program.log
none
File: storage.log
none
File: syslog
none
File: ifcfg.log
none
File: packaging.log none

Description Dale Turner 2016-05-03 12:36:44 UTC
Description of problem:
Trying to install F24

Version-Release number of selected component:
anaconda-24.13.4-1

The following was filed automatically by anaconda:
anaconda 24.13.4-1 exception report
Traceback (most recent call first):
  File "/usr/lib64/python3.5/site-packages/pyanaconda/packaging/dnfpayload.py", line 803, in install
    raise packaging.PayloadError("DNF error: %s" % msg)
  File "/usr/lib64/python3.5/site-packages/pyanaconda/install.py", line 236, in doInstall
    payload.install()
  File "/usr/lib64/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib64/python3.5/site-packages/pyanaconda/threads.py", line 253, in run
    threading.Thread.run(self, *args, **kwargs)
pyanaconda.packaging.PayloadError: DNF error: error reading package headerTraceback (most recent call last):
  File "/usr/lib64/python3.5/site-packages/pyanaconda/packaging/dnfpayload.py", line 210, in do_transaction
    base.do_transaction(display=display)
  File "/usr/lib/python3.5/site-packages/dnf/base.py", line 564, in do_transaction
    self.transaction.populate_rpm_ts(self.ts)
  File "/usr/lib/python3.5/site-packages/dnf/transaction.py", line 183, in populate_rpm_ts
    hdr = tsi.installed.header
  File "/usr/lib/python3.5/site-packages/dnf/package.py", line 78, in header
    return dnf.rpm.header(self.localPkg())
  File "/usr/lib/python3.5/site-packages/dnf/rpm/__init__.py", line 58, in header
    return ts.hdrFromFdno(fdno)
  File "/usr/lib64/python3.5/site-packages/rpm/transaction.py", line 175, in hdrFromFdno
    raise rpm.error("error reading package header")
_rpm.error: error reading package header


Additional info:
addons:         com_redhat_kdump
cmdline:        /usr/bin/python3  /sbin/anaconda
cmdline_file:   BOOT_IMAGE=/images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-E-dvd-x86_64-24 quiet
executable:     /sbin/anaconda
hashmarkername: anaconda
kernel:         4.5.2-301.fc24.x86_64
product:        Fedora
release:        Cannot get release name.
reproducible:   Not sure how to reproduce the problem
type:           anaconda
version:        24

Comment 1 Dale Turner 2016-05-03 12:36:53 UTC
Created attachment 1153387 [details]
File: anaconda-tb

Comment 2 Dale Turner 2016-05-03 12:36:55 UTC
Created attachment 1153388 [details]
File: anaconda.log

Comment 3 Dale Turner 2016-05-03 12:36:57 UTC
Created attachment 1153389 [details]
File: dnf.log

Comment 4 Dale Turner 2016-05-03 12:36:58 UTC
Created attachment 1153390 [details]
File: dnf.rpm.log

Comment 5 Dale Turner 2016-05-03 12:36:59 UTC
Created attachment 1153391 [details]
File: environ

Comment 6 Dale Turner 2016-05-03 12:37:00 UTC
Created attachment 1153392 [details]
File: lsblk_output

Comment 7 Dale Turner 2016-05-03 12:37:02 UTC
Created attachment 1153393 [details]
File: lvm.log

Comment 8 Dale Turner 2016-05-03 12:37:03 UTC
Created attachment 1153394 [details]
File: nmcli_dev_list

Comment 9 Dale Turner 2016-05-03 12:37:04 UTC
Created attachment 1153395 [details]
File: os_info

Comment 10 Dale Turner 2016-05-03 12:37:06 UTC
Created attachment 1153396 [details]
File: program.log

Comment 11 Dale Turner 2016-05-03 12:37:08 UTC
Created attachment 1153397 [details]
File: storage.log

Comment 12 Dale Turner 2016-05-03 12:37:10 UTC
Created attachment 1153398 [details]
File: syslog

Comment 13 Dale Turner 2016-05-03 12:37:11 UTC
Created attachment 1153399 [details]
File: ifcfg.log

Comment 14 Dale Turner 2016-05-03 12:37:13 UTC
Created attachment 1153400 [details]
File: packaging.log

Comment 15 Dale Turner 2016-05-03 13:08:59 UTC
Similar problem has been detected:

Trying to install F24

addons:         com_redhat_kdump
cmdline:        /usr/bin/python3  /sbin/anaconda
cmdline_file:   BOOT_IMAGE=/images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-E-dvd-x86_64-24 quiet
hashmarkername: anaconda
kernel:         4.5.2-301.fc24.x86_64
package:        anaconda-24.13.4-1
product:        Fedora
reason:         pyanaconda.packaging.PayloadError: DNF error: error reading package headerTraceback (most recent call last):
release:        Cannot get release name.
reproducible:   Not sure how to reproduce the problem
version:        24

Comment 16 Honza Silhan 2016-05-09 11:43:25 UTC
Reassigning to RPM. Probably some package had malformed header.

Comment 17 Panu Matilainen 2016-10-12 12:43:23 UTC
Rpm refusing to read a malformed package is a feature, not bug. Damaged packages do happen, and the software on top of rpm should anticipate them and handle the error cleanly instead of throwing up a traceback.

I'm not sufficiently familiar with dnf or anaconda these days to tell which one should be catching this one, but this:

  File "/usr/lib/python3.5/site-packages/dnf/package.py", line 78, in header
    return dnf.rpm.header(self.localPkg())

...seems to suggest that its dnf who's not expecting a failure. Anaconda will just give up here in any case I think, but dnf could catch the rpm-level exception and riase an exception of its own, at least reporting which package it was that failed. Rpm cannot do that because it just gets a file descriptor.

Comment 18 Michael Mráka 2016-11-02 14:07:44 UTC
Fixed by 
https://github.com/rpm-software-management/libhif/pull/208

Testing reproducer was:
# touch /tmp/empty.rpm
# dnf install /tmp/empty.rpm

Fixed version output:
Last metadata expiration check: 0:00:00 ago on Wed Nov 02 14:53:41 2016 CET.
Can not load RPM file: /tmp/empty.rpm.
Could not open: /tmp/empty.rpm