Bug 883463

Summary: yum traceback, 'RPMDBAdditionalData' object has no attribute 'yumdb_cache', when /var/lib/yum is not writable.
Product: Red Hat Enterprise Linux 6 Reporter: Richard W.M. Jones <rjones>
Component: yumAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED ERRATA QA Contact: Karel Srot <ksrot>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.4CC: ffesti, james.antill, jzeleny, ksrot, mads, maxamillion, pmatilai, rjones, robinlee.sysu, tcallawa, tim.lauridsen, vmukhame
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:0591769b9451961585360da7b96201c73d0a5b69
Fixed In Version: yum-3.2.29-50.el6 Doc Type: Bug Fix
Doc Text:
Cause: run 'yum list' as a non-privileged user when /var/lib/yum/yumdb is not writable Consequence: yum crashes Fix: handle this situation gracefully Result: no crash
Story Points: ---
Clone Of: 730793 Environment:
Last Closed: 2014-10-14 04:36:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 730793    
Bug Blocks:    

Description Richard W.M. Jones 2012-12-04 16:38:08 UTC
I hit the following stack trace on RHEL 6.4:

Traceback (most recent call last):
  File "<string>", line 39, in <module>
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 3173, in _bestPackageFromList
    bestlist = self._compare_providers(pkglist, None)
  File "/usr/lib/python2.6/site-packages/yum/depsolve.py", line 1219, in _compare_providers
    rpmdbpkgs = self.rpmdb.searchNevra(name=pkg.name)
  File "/usr/lib/python2.6/site-packages/yum/rpmsack.py", line 1197, in searchNevra
    return self._search(name, epoch, ver, rel, arch)
  File "/usr/lib/python2.6/site-packages/yum/rpmsack.py", line 1282, in _search
    po = self._makePackageObject(hdr, mi.instance())
  File "/usr/lib/python2.6/site-packages/yum/rpmsack.py", line 1305, in _makePackageObject
    po = RPMInstalledPackage(hdr, index, self)
  File "/usr/lib/python2.6/site-packages/yum/rpmsack.py", line 44, in __init__
    YumInstalledPackage.__init__(self, rpmhdr, yumdb=rpmdb.yumdb)
  File "/usr/lib/python2.6/site-packages/yum/packages.py", line 1709, in __init__
    self.yumdb_info = yumdb.get_package(self)
  File "/usr/lib/python2.6/site-packages/yum/rpmsack.py", line 1644, in get_package
    yumdb_cache=self.yumdb_cache)
AttributeError: 'RPMDBAdditionalData' object has no attribute 'yumdb_cache'

If I'm not mistaken, this appears to be a variant of bug 730793.
The fix for this seems very simple and self-contained, and is already
part of the yum 3.2 branch.

+++ This bug was initially created as a clone of Bug #730793 +++

abrt version: 2.0.5
cmdline:        /usr/bin/python /usr/bin/yum list db4*
comment:        Trying to run a yum list as an ordinary user
executable:     /usr/bin/yum
kernel:         3.0.1-3.fc16.x86_64
reason:         rpmsack.py:1618:get_package:AttributeError: 'RPMDBAdditionalData' object has no attribute 'yumdb_cache'
smolt_data:     Unable to save UUID to /etc/smolt/hw-uuid.  Please run once as root.
time:           Mon Aug 15 19:24:03 2011
uid:            1000
username:       liveuser

backtrace:
:rpmsack.py:1618:get_package:AttributeError: 'RPMDBAdditionalData' object has no attribute 'yumdb_cache'
:
:Traceback (most recent call last):
:  File "/usr/bin/yum", line 29, in <module>
:    yummain.user_main(sys.argv[1:], exit_code=True)
:  File "/usr/share/yum-cli/yummain.py", line 309, in user_main
:    errcode = main(args)
:  File "/usr/share/yum-cli/yummain.py", line 140, in main
:    result, resultmsgs = base.doCommands()
:  File "/usr/share/yum-cli/cli.py", line 462, in doCommands
:    return self.yum_cli_commands[self.basecmd].doCommand(self, self.basecmd, self.extcmds)
:  File "/usr/share/yum-cli/yumcommands.py", line 537, in doCommand
:    ypl = base.returnPkgLists(extcmds, installed_available=highlight)
:  File "/usr/share/yum-cli/cli.py", line 1125, in returnPkgLists
:    ignore_case=True)
:  File "/usr/lib/python2.7/site-packages/yum/__init__.py", line 2299, in doPackageLists
:    ignore_case=ic):
:  File "/usr/lib/python2.7/site-packages/yum/rpmsack.py", line 630, in returnPackages
:    self._makePackageObject(hdr, idx)
:  File "/usr/lib/python2.7/site-packages/yum/rpmsack.py", line 1279, in _makePackageObject
:    po = RPMInstalledPackage(hdr, index, self)
:  File "/usr/lib/python2.7/site-packages/yum/rpmsack.py", line 75, in __init__
:    YumInstalledPackage.__init__(self, rpmhdr, yumdb=rpmdb.yumdb)
:  File "/usr/lib/python2.7/site-packages/yum/packages.py", line 1763, in __init__
:    self.yumdb_info = yumdb.get_package(self)
:  File "/usr/lib/python2.7/site-packages/yum/rpmsack.py", line 1618, in get_package
:    yumdb_cache=self.yumdb_cache)
:AttributeError: 'RPMDBAdditionalData' object has no attribute 'yumdb_cache'
:
:Local variables in innermost frame:
:pkgid: None
:self: <yum.rpmsack.RPMDBAdditionalData object at 0x28b9fd0>
:pkgtup: None
:po: <RPMInstalledPackage : db4-4.8.30-3.fc15.x86_64 (0x7f792df475d0)>
:thisdir: '/var/lib/yum/yumdb/d/410f98e91ac24da8556e19f9d2c7ce62ab1bd767-db4-4.8.30-3.fc15-x86_64'

--- Additional comment from Mads Kiilerich on 2011-08-15 15:37:02 EDT ---

This happened while /var/lib/rpm needed recovery. Yum should however not fail this bad. Ordinary yum commands run by root failed nicely.

--- Additional comment from Zdeněk Pavlas on 2011-08-17 02:44:27 EDT ---

Fixed in upstream, closing.

--- Additional comment from Richard W.M. Jones on 2012-12-04 11:32:52 EST ---

The fix for this bug was:

commit 2f480e8dd6757cbe48037a5507c0c19cc97b2e71
Author: Zdeněk Pavlas <zpavlas>
Date:   Tue Aug 16 13:13:12 2011 +0200

    Small fix in RPMDBAdditionalData init. BZ 730793
    
    Initialize RPMDBAdditionalData object even when makedirs /var/lib/yum/yumdb

Comment 1 Richard W.M. Jones 2012-12-04 18:50:52 UTC
OK I have now verified that this really is a bug which
affects libguestfs builds in RHEL 6.4.

Comment 2 RHEL Program Management 2012-12-14 08:11:48 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 3 James Antill 2013-04-22 18:11:09 UTC
Simplish backport for 6.5, to repeat:

commit 2f480e8dd6757cbe48037a5507c0c19cc97b2e71
Author: Zdeněk Pavlas <zpavlas>
Date:   Tue Aug 16 13:13:12 2011 +0200

Comment 6 RHEL Program Management 2013-10-14 00:11:58 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.

Comment 14 Robin Lee 2014-09-23 03:25:54 UTC
This issue does not occur if /var/lib/yum/yumdb exists, even the directory is not writable by current user.

Comment 16 errata-xmlrpc 2014-10-14 04:36:14 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1410.html