Bug 593436 - yum update fails with AttributeError
yum update fails with AttributeError
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: yum (Show other bugs)
12
All Linux
low Severity medium
: ---
: ---
Assigned To: Seth Vidal
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-05-18 15:02 EDT by Joel Uckelman
Modified: 2014-01-21 18:15 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-05-19 15:05:18 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Joel Uckelman 2010-05-18 15:02:03 EDT
Description of problem:

# sudo yum update
Loaded plugins: downloadonly, fastestmirror, presto, refresh-packagekit
Loading mirror speeds from cached hostfile
 * fedora: mirrors.linux.edu.lv
 * livna: rpm.livna.org
 * rpmfusion-free: download1.rpmfusion.org
 * rpmfusion-free-updates: download1.rpmfusion.org
 * rpmfusion-nonfree: download1.rpmfusion.org
 * rpmfusion-nonfree-updates: download1.rpmfusion.org
 * updates: ftp.stw-bonn.de
Setting up Update Process
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 254, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 109, in main
    result, resultmsgs = base.doCommands()
  File "/usr/share/yum-cli/cli.py", line 356, in doCommands
    return self.yum_cli_commands[self.basecmd].doCommand(self, self.basecmd, self.extcmds)
  File "/usr/share/yum-cli/yumcommands.py", line 204, in doCommand
    return base.updatePkgs(extcmds)
  File "/usr/share/yum-cli/cli.py", line 625, in updatePkgs
    self.update()
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 3179, in update
    tx_return.extend(self.update(po=self.getPackageObject(new)))
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 3328, in update
    available_pkg, updated_pkg)
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 3135, in _add_up_txmbr
    if ('reason' in ipkg.yumdb_info and ipkg.yumdb_info.reason == 'dep'):
  File "/usr/lib/python2.6/site-packages/yum/rpmsack.py", line 1386, in __getattr__
    return self._read(attr)
  File "/usr/lib/python2.6/site-packages/yum/rpmsack.py", line 1364, in _read
    raise AttributeError, "%s has no attribute %s" % (self, attr)
AttributeError: <yum.rpmsack.RPMDBAdditionalDataPackage object at 0x3d46610> has no attribute reason



Version-Release number of selected component (if applicable):

yum-3.2.27-3.fc12.noarch


How reproducible:

Always

Steps to Reproduce:
1. sudo yum update
  
Actual results:

Stack trace.

Expected results:

Updates should be applied.


Additional info:
Comment 1 James Antill 2010-05-18 23:39:46 EDT
 As far as I can see, this is "impossible":

 if ('reason' in ipkg.yumdb_info and ipkg.yumdb_info.reason == 'dep'):
  File "/usr/lib/python2.6/site-packages/yum/rpmsack.py", line 1386, in
__getattr__
    return self._read(attr)
  File "/usr/lib/python2.6/site-packages/yum/rpmsack.py", line 1364, in _read
    raise AttributeError, "%s has no attribute %s" % (self, attr)

...so it'd be nice if reality complied.
Comment 2 Panu Matilainen 2010-05-19 03:50:32 EDT
AFAICT this can happen if something removed the attribute file after it was read into cache. Unless of course that's what you're referring to as "impossible" :)
Comment 3 James Antill 2010-05-19 09:52:31 EDT
 The problem is that the "'reason' in ipkg.yumdb_info" should only return true if reason can be loaded and is now in the cache ... but then milliseconds later the "ipkg.yumdb_info.reason" fails, which means it's not in the cache and can't be loaded.

 I guess we could use .get() instead, but it'd be nice to know why the impossible is happening :).
Comment 4 Joel Uckelman 2010-05-19 12:22:25 EDT
I can reproduce the problem every time, so if there's any further information I can provide, I'd be happy to do so. I'd also like to know why it's happening. (It started only a few days ago.)
Comment 5 James Antill 2010-05-19 13:05:17 EDT
Ok, cool ... didn't realize that :).

Does it happen with all update operations, or only when you update some packages?

Can you alter these lines in /usr/lib/python2.6/site-packages/yum/rpmsack.py (at line 1364):


 old:

        fn = self._mydir + '/' + attr
        if not os.path.exists(fn):
            raise AttributeError, "%s has no attribute %s" % (self, attr)

 new:

        fn = self._mydir + '/' + attr
        print "DBG:", fn
        if not os.path.exists(fn):
            raise AttributeError, "%s has no attribute %s" % (self, attr)

...then when it prints out can you run:

ls -ls <path-from-above>
Comment 6 Joel Uckelman 2010-05-19 14:38:54 EDT
(In reply to comment #5)
> 
> Does it happen with all update operations, or only when you update some
> packages?
> 

I tried, e.g., 'yum update setup' and got the same stack trace.

> Can you alter these lines in /usr/lib/python2.6/site-packages/yum/rpmsack.py
> (at line 1364):
> 
> 
>  old:
> 
>         fn = self._mydir + '/' + attr
>         if not os.path.exists(fn):
>             raise AttributeError, "%s has no attribute %s" % (self, attr)
> 
>  new:
> 
>         fn = self._mydir + '/' + attr
>         print "DBG:", fn
>         if not os.path.exists(fn):
>             raise AttributeError, "%s has no attribute %s" % (self, attr)
> 
> ...then when it prints out can you run:
> 
> ls -ls <path-from-above>    

# ls -ls /var/lib/yum/yumdb/n/13186d04498f1313e89785c8fd1f108f04aefd65-nss-softokn-freebl-3.12.4-17.fc12-x86_64/reason
ls: cannot access /var/lib/yum/yumdb/n/13186d04498f1313e89785c8fd1f108f04aefd65-nss-softokn-freebl-3.12.4-17.fc12-x86_64/reason: Input/output error

WTF?


# ls -l /var/lib/yum/yumdb/n/13186d04498f1313e89785c8fd1f108f04aefd65-nss-softokn-freebl-3.12.4-17.fc12-x86_64/
ls: cannot access /var/lib/yum/yumdb/n/13186d04498f1313e89785c8fd1f108f04aefd65-nss-softokn-freebl-3.12.4-17.fc12-x86_64/command_line: Input/output error
ls: cannot access /var/lib/yum/yumdb/n/13186d04498f1313e89785c8fd1f108f04aefd65-nss-softokn-freebl-3.12.4-17.fc12-x86_64/releasever: Input/output error
ls: cannot access /var/lib/yum/yumdb/n/13186d04498f1313e89785c8fd1f108f04aefd65-nss-softokn-freebl-3.12.4-17.fc12-x86_64/checksum_type: Input/output error
ls: cannot access /var/lib/yum/yumdb/n/13186d04498f1313e89785c8fd1f108f04aefd65-nss-softokn-freebl-3.12.4-17.fc12-x86_64/from_repo_revision: Input/output error
ls: cannot access /var/lib/yum/yumdb/n/13186d04498f1313e89785c8fd1f108f04aefd65-nss-softokn-freebl-3.12.4-17.fc12-x86_64/from_repo: Input/output error
ls: cannot access /var/lib/yum/yumdb/n/13186d04498f1313e89785c8fd1f108f04aefd65-nss-softokn-freebl-3.12.4-17.fc12-x86_64/reason: Input/output error
ls: cannot access /var/lib/yum/yumdb/n/13186d04498f1313e89785c8fd1f108f04aefd65-nss-softokn-freebl-3.12.4-17.fc12-x86_64/checksum_data: Input/output error
total 24
drwxr-xr-x.  2 root root  4096 2010-05-09 00:51 ./
drwxr-xr-x. 77 root root 16384 2010-05-14 18:27 ../
-??????????  ? ?    ?        ?                ? checksum_data
-??????????  ? ?    ?        ?                ? checksum_type
-??????????  ? ?    ?        ?                ? command_line
-??????????  ? ?    ?        ?                ? from_repo
-??????????  ? ?    ?        ?                ? from_repo_revision
-rw-r--r--.  1 root root    10 2010-05-09 00:51 from_repo_timestamp
-??????????  ? ?    ?        ?                ? reason
-??????????  ? ?    ?        ?                ? releasever

Ok, that's disturbking.
Comment 7 seth vidal 2010-05-19 14:47:47 EDT
umm. maybe it's time to run an fsck on this disk.
Comment 8 James Antill 2010-05-19 15:05:18 EDT
Ok, yeh ... I've submitted a "fix" to yum which will make this fail in a much better way (atm. we basically do readdir() on the test part, so that can work even though open() doesn't).

But, as Seth said, your FS is really not happy.
Comment 9 Joel Uckelman 2010-05-19 15:52:51 EDT
(In reply to comment #7)
> umm. maybe it's time to run an fsck on this disk.    

Indeed. That's a hell of a way to discover it.

After doing fsck twice, yum update works. No clue what happend to my FS. Thanks for pointing me in the right direction, and for the improved error message.

Note You need to log in before you can comment on or make changes to this bug.