How to Fix rpmrebuild Error: gzip Unexpected End of File and rpm2archive Failure

Posted by

While using rpmrebuild to inspect or rebuild RPM packages, I am encountering the following issue:

(GenRpmQf) remove tag line ENHANCESFLAGS
(GenRpmQf) remove tag line ENHANCESNAME
(GenRpmQf) remove tag line ENHANCESVERSION
(GenRpmQf) remove tag line SUGGESTSFLAGS
(GenRpmQf) remove tag line SUGGESTSNAME
(GenRpmQf) remove tag line SUGGESTSVERSION

gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now
/usr/lib/rpmrebuild/rpmrebuild.sh: ERROR: (RpmUnpack) rpm2archive
/usr/lib/rpmrebuild/rpmrebuild.sh: ERROR: (CreateBuildRoot) RpmUnpack
/usr/lib/rpmrebuild/rpmrebuild.sh: ERROR: CreateBuildRoot

The issue occurs when using Rocky 9. To resolve it, I modified the rpmrebuild.sh script

vi /usr/lib/rpmrebuild/rpmrebuild.sh

Add – (stripe) after line rpm2archive (line 143). So, it looks like the following:

rpm2archive - <${RPMREBUILD_PAQUET} | tar -xz -C $BUILDROOT || Error "(RpmUnpack) rpm2archive" || return

After modifying that line, I was able to inspect or rebuild RPM packages again.

Good Luck 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.