Running yum and sosreport fails with error: "struct.error: unpack requires a string argument of length 4"

Solution Unverified - Updated -

Issue

  • yum fails with:
# yum
Traceback (most recent call last):
  File "/usr/bin/yum", line 28, in <module>
    import yummain
  File "/usr/share/yum-cli/yummain.py", line 34, in <module>
    import cli
  File "/usr/share/yum-cli/cli.py", line 29, in <module>
    from optparse import OptionParser,OptionGroup,SUPPRESS_HELP
  File "/usr/lib64/python2.6/optparse.py", line 418, in <module>
    _builtin_cvt = { "int" : (_parse_int, _("integer")),
  File "/usr/lib64/python2.6/gettext.py", line 568, in gettext
    return dgettext(_current_domain, message)
  File "/usr/lib64/python2.6/gettext.py", line 532, in dgettext
    codeset=_localecodesets.get(domain))
  File "/usr/lib64/python2.6/gettext.py", line 480, in translation
    t = _translations.setdefault(key, class_(open(mofile, 'rb')))
  File "/usr/lib64/python2.6/gettext.py", line 180, in __init__
    self._parse(fp)
  File "/usr/lib64/python2.6/gettext.py", line 273, in _parse
    magic = unpack('<I', buf[:4])[0]
struct.error: unpack requires a string argument of length 4
  • sosreport fails with:
# sosreport
Traceback (most recent call last):
  File "/usr/sbin/sosreport", line 20, in <module>
    from sos.sosreport import main
  File "/usr/lib/python2.6/site-packages/sos/sosreport.py", line 30, in <module>
    from optparse import OptionParser, Option
  File "/usr/lib64/python2.6/optparse.py", line 418, in <module>
    _builtin_cvt = { "int" : (_parse_int, _("integer")),
  File "/usr/lib64/python2.6/gettext.py", line 568, in gettext
    return dgettext(_current_domain, message)
  File "/usr/lib64/python2.6/gettext.py", line 532, in dgettext
    codeset=_localecodesets.get(domain))
  File "/usr/lib64/python2.6/gettext.py", line 480, in translation
    t = _translations.setdefault(key, class_(open(mofile, 'rb')))
  File "/usr/lib64/python2.6/gettext.py", line 180, in __init__
    self._parse(fp)
  File "/usr/lib64/python2.6/gettext.py", line 273, in _parse
    magic = unpack('<I', buf[:4])[0]
struct.error: unpack requires a string argument of length 4

Environment

  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 7
  • yum
  • sosreport
  • python-libs

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content