Bug 766547

Summary: error: rpmts_HdrFromFdno: MD5 digest: BAD Expected
Product: Red Hat Satellite 5 Reporter: Šimon Lukašík <slukasik>
Component: Satellite SynchronizationAssignee: Tomáš Kašpárek <tkasparek>
Status: CLOSED EOL QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 541CC: ahumbe, kcleveng, mwalker, tlestach
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-02-18 15:18:53 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 462714    

Description Šimon Lukašík 2011-12-12 10:26:16 UTC
Description of problem:
When a running satellite-sync process gets killed during the download
of rpms, some of the packages might not be downloaded completely.

As a result, there are incomplete rpm packages in /var/satellite.

A subsequent `satellite-sync --no-packages` will crash, when comparing
checksum of the package in /var/satellite with the data from
the source storage.

Without spacewalk-data-fsck, a user has no way to find a corrupt file.

Version-Release number of selected component (if applicable):
RHN Satellite 5.4.1
spacewalk-backend-tools-1.2.13-58.el6sat.noarch

How reproducible:
deterministic

Steps to Reproduce:
1. # satellite-sync -c some-channel (
2. Kill it during rpm downloading phase
3. # satellite-sync -c some-channel --no-rpms

Actual results:
Diffing:    ######################################## - complete
08:25:00
08:25:00 Downloading package metadata
08:25:00    Retrieving / parsing *relevant* package metadata: rhel-ppc64-server-6 (NONE RELEVANT)
08:25:00    Retrieving / parsing *relevant* package metadata: rhel-s390x-server-6 (NONE RELEVANT)
08:25:01
08:25:01 Importing package metadata
08:25:01    Importing *relevant* package metadata: rhel-ppc64-server-6 (5933)
08:25:01    * WARNING: this may be a slow process.
            ________________________________________
Importing:  ###error: rpmts_HdrFromFdno: MD5 digest: BAD Expected(19b7783602fc4775dd65924eb2c016b7) != (2a84eafd483ca8981f5d95c82fa6b8a7)
+++ sending log as an email +++

SYNC ERROR: unhandled exception occurred:

(Check logs/email for potentially more detail)

error('error reading package header',)
error reading package header


Expected results:
Either:
 - Avoid storing corrupted files in /var/satelite
 - Repack the exception to name filepath to the corrupted rpm
 - Remove corrupted files during subsequent satellite-sync

Additional info:

Comment 1 Šimon Lukašík 2011-12-12 10:28:56 UTC
Following is a snippet from traceback mail.


05:01:54
SYNC ERROR: unhandled exception occurred:

Exception reported from smqa-r210-04.lab.eng.brq.redhat.com
Time: Sun Dec 11 05:01:54 2011   
Exception type <class '_rpm.error'>

Exception Handler Information
Traceback (most recent call last):
  File "/usr/bin/satellite-sync", line 143, in main
    return satsync.Runner().main()
  File "/usr/share/rhn/satellite_tools/satsync.py", line 226, in main
    ret = method()
  File "/usr/share/rhn/satellite_tools/satsync.py", line 343, in _step_packages
    self._affected_channels = self.syncer.import_packages()
  File "/usr/share/rhn/satellite_tools/satsync.py", line 1785, in import_packages
    sync_handlers.import_packages(batch, sources)
  File "/usr/share/rhn/satellite_tools/sync_handlers.py", line 433, in import_packages
    importer.run()
  File "/usr/share/rhn/server/importlib/importLib.py", line 651, in run
    self.submit()
  File "/usr/share/rhn/server/importlib/packageImport.py", line 323, in submit
    self._import_signatures()
  File "/usr/share/rhn/server/importlib/packageImport.py", line 511, in _import_signatures
    header = rhn_rpm.get_package_header(filename=full_path)
  File "/usr/lib/python2.6/site-packages/spacewalk/common/rhn_rpm.py", line 293, in get_package_header
    hdr = ts.hdrFromFdno(file_desc)
  File "/usr/lib/python2.6/site-packages/spacewalk/common/rhn_rpm.py", line 110, in hdrFromFdno
    return self.ts.hdrFromFdno(fd)
  File "/usr/lib64/python2.6/site-packages/rpm/transaction.py", line 154, in hdrFromFdno
    raise rpm.error("error reading package header")
error: error reading package header

Comment 2 Michael Mráka 2011-12-16 10:32:36 UTC
*** Bug 759406 has been marked as a duplicate of this bug. ***

Comment 7 Tomas Lestach 2016-02-18 15:18:53 UTC
We have re-reviewed this bug, as part of an ongoing effort to improve Satellite/Proxy feature and bug updates, review and backlog.
We're closing this Bugzilla due to the Satellite 5 version this bug was reported against having been EOL (End-of-Life) [1]. Comment 5 also mentions a usable workaround.
Please re-open if the issue still exists in the latest Satellite 5 version.

Tomas and Xixi
[1] Satellite Life Cycle page: https://access.redhat.com/support/policy/updates/satellite