CentOS 5 の yum に失敗 (TypeError: unsubscriptable object)


CentOS 5.3 で、yum update が急に TypeError: unsubscriptable object というエラーを出して失敗するようになりました。Windows Update にしても yum にしても、失敗した例はここしばらく見たことが無かったんですが。放置しておくと危険です。

すべての VMware ゲストの CentOS 5.3 で試してみると、用途の異なる CentOS サーバすべてで同様に失敗している模様です。

5月8日~5月9日あたりに流れてきた kernel 系のアップデートは正しく行われていて、

[code language=”bash”]
Installed: kernel-devel-2.6.18-128.1.10.el5.i686
Installed: kernel-2.6.18-128.1.10.el5.i686
Updated: kernel-headers-2.6.18-128.1.10.el5.i386
[/code]

OS の再起動も問題なくできたのですが、その後 TypeError: unsubscriptable object で止まるようになりました。以下が止まったときのログ。

[code language=”bash”]
/etc/cron.daily/yum.cron:

Resolving Dependencies
–> Running transaction check
—> Package audit-libs.i386 0:1.7.7-6.el5_3.3 set to be updated
—> Package sos.noarch 0:1.7-9.16.el5_3.5 set to be updated
—> Package file.i386 0:4.17-15.el5_3.1 set to be updated
Traceback (most recent call last):
File "/usr/bin/yum", line 29, in ?
yummain.user_main(sys.argv[1:], exit_code=True)
File "/usr/share/yum-cli/yummain.py", line 229, in user_main
errcode = main(args)
File "/usr/share/yum-cli/yummain.py", line 104, in main
result, resultmsgs = base.doCommands()
File "/usr/share/yum-cli/cli.py", line 343, in doCommands
return self.yum_cli_commands[self.basecmd].doCommand(self, self.basecmd,
self.extcmds)
File "/usr/share/yum-cli/yumcommands.py", line 645, in doCommand
return base.doShell()
File "/usr/share/yum-cli/cli.py", line 284, in doShell
yumshell.script()
File "/usr/share/yum-cli/shell.py", line 78, in script
self.onecmd(line)
File "/usr/lib/python2.4/cmd.py", line 219, in onecmd
return func(arg)
File "/usr/share/yum-cli/shell.py", line 165, in do_ts
self.do_transaction(line)
File "/usr/share/yum-cli/shell.py", line 191, in do_transaction
return self.do_run(”)
File "/usr/share/yum-cli/shell.py", line 325, in do_run
(code, msgs) = self.base.buildTransaction()
File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 647, in
buildTransaction
(rescode, restring) = self.resolveDeps()
File "/usr/lib/python2.4/site-packages/yum/depsolve.py", line 704, in resolveDeps
for po, dep in self._checkFileRequires():
File "/usr/lib/python2.4/site-packages/yum/depsolve.py", line 939, in
_checkFileRequires
if not self.tsInfo.getOldProvides(filename) and not
self.tsInfo.getNewProvides(filename):
File "/usr/lib/python2.4/site-packages/yum/transactioninfo.py", line 414, in
getNewProvides
for pkg, hits in self.pkgSack.getProvides(name, flag, version).iteritems():
File "/usr/lib/python2.4/site-packages/yum/packageSack.py", line 300, in getProvides
return self._computeAggregateDictResult("getProvides", name, flags, version)
File "/usr/lib/python2.4/site-packages/yum/packageSack.py", line 470, in
_computeAggregateDictResult
sackResult = apply(method, args)
File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 861, in getProvides
return self._search("provides", name, flags, version)
File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 43, in newFunc
return func(*args, **kwargs)
File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 837, in _search
for pkg in self.searchFiles(name, strict=True):
File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 43, in newFunc
return func(*args, **kwargs)
File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 586, in searchFiles
self._sql_pkgKey2po(rep, cur, pkgs)
File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 470, in
_sql_pkgKey2po
pkg = self._packageByKey(repo, ob[‘pkgKey’])
File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 413, in _packageByKey
po = self.pc(repo, cur.fetchone())
File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 68, in __init__
self._read_db_obj(db_obj)
File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 94, in _read_db_obj
setattr(self, item, _share_data(db_obj[item]))
TypeError: unsubscriptable object
[/code]

yum clean metadata で解決

探していたところ、CentOS Bug Tracker に、同じような例を発見。yum clean metadata すれば良いらしく。

[code language=”bash”]
# yum clean metadata
Loaded plugins: downloadonly, fastestmirror, priorities
19 metadata files removed
8 sqlite files removed
0 metadata files removed
#
[/code]

では再度アップデートしてみましょう。

[code language=”bash”]
# yum update

Setting up Update Process
Resolving Dependencies
–> Running transaction check
—> Package file.i386 0:4.17-15.el5_3.1 set to be updated
—> Package audit.i386 0:1.7.7-6.el5_3.3 set to be updated
—> Package sos.noarch 0:1.7-9.16.el5_3.5 set to be updated
—> Package pango.i386 0:1.14.9-5.el5.centos set to be updated
—> Package audit-libs-python.i386 0:1.7.7-6.el5_3.3 set to be updated
—> Package audit-libs.i386 0:1.7.7-6.el5_3.3 set to be updated
filelists.xml.gz | 2.8 MB 00:01

–> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================
Package Arch Version Repository Size
==========================================================================================
Updating:
audit i386 1.7.7-6.el5_3.3 updates 365 k
audit-libs i386 1.7.7-6.el5_3.3 updates 77 k
audit-libs-python i386 1.7.7-6.el5_3.3 updates 77 k
file i386 4.17-15.el5_3.1 updates 316 k
pango i386 1.14.9-5.el5.centos updates 335 k
sos noarch 1.7-9.16.el5_3.5 updates 116 k

Transaction Summary
==========================================================================================
Install 0 Package(s)
Update 6 Package(s)
Remove 0 Package(s)Total download size: 1.3 M
Is this ok [y/N]: y
Downloading Packages:
(1/6): audit-libs-python-1.7.7-6.el5_3.3.i386.rpm | 77 kB 00:00

Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction

Updated: audit.i386 0:1.7.7-6.el5_3.3 audit-libs.i386 0:1.7.7-6.el5_3.3 audit-libs-python.i386 0:1.7.7-6.el5_3.3 file.i386 0:4.17-15.el5_3.1 pango.i386 0:1.14.9-5.el5.centos sos.noarch 0:1.7-9.16.el5_3.5
Complete!
#
[/code]

直りました。

放置しておくと yum update できないままなので、新たな脆弱性が発見されたとき、攻撃の対象になるかもしれません。


3 Comments

  1. 私も同じエラーに遭遇してオロオロしてしまいました。
    おかげでちゃんとインストールできました。

    情報提供、ありがとうございます。

  2. 同じエラーで困ってました。
    yum clean metadata で問題解決し、ほっとしております。

Leave a Reply

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

© 2018 Nire.Com

Theme by Anders NorenUp ↑