0

This is an instance launched using Amazon AMI.

when I run yum with anything (search,install, etc), this is what I am getting:

yum search yum
error: bad option 'archcolor' at (null):93
Loaded plugins: fastestmirror, priorities, update-motd
Loading mirror speeds from cached hostfile
 * amzn-main: packages.us-east-1.amazonaws.com
error: dbiOpen: dbapi 1 not available
error: cannot open Packages database in /var/lib/rpm
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 355, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 174, in main
    result, resultmsgs = base.doCommands()
  File "/usr/share/yum-cli/cli.py", line 569, in doCommands
    return self.yum_cli_commands[self.basecmd].doCommand(self, self.basecmd, self.extcmds)
  File "/usr/share/yum-cli/yumcommands.py", line 1682, in doCommand
    return base.search(extcmds)
  File "/usr/share/yum-cli/cli.py", line 1436, in search
    for (po, keys, matched_value) in matching:
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 3139, in searchGenerator
    lowered=True)
  File "/usr/lib/python2.6/site-packages/yum/rpmsack.py", line 1274, in searchPrimaryFieldsMultipleStrings
    for hdr, idx in self._get_packages():
  File "/usr/lib/python2.6/site-packages/yum/rpmsack.py", line 1301, in _get_packages
    mi = ts.dbMatch(*args, **kwds)
  File "/usr/lib/python2.6/site-packages/rpmUtils/transaction.py", line 58, in dbMatch
    mi = self.ts.dbMatch(*args, **kwds)
_rpm.error: rpmdb open failed

Tried google but found nothing that could help. Tried getting the rpm package for all yum from another similar machine and force installing those packages. that also didn't help. I also tried removing the rpm db files and rebuilding the rpm database which didn't help either.

~# cat /etc/issue
Amazon Linux AMI release 2011.09
Kernel \r on an \m
~# uname -a
Linux ip-10-0-2-98 2.6.35.14-97.44.amzn1.x86_64 #1 SMP Mon Oct 24 16:03:08 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

Has anyone faced this before? Is there anything I can do to fix this problem? Thanks in advance.

  • 1
    This sort of thing is all too common with Amazon Linux, which is one of several reasons I don't recommend using it. Your best bet is to start over with a fresh AMI, whether Amazon Linux or something else. – Michael Hampton Mar 4 '14 at 11:34
  • I think that's the most logical thing to do. replace rather spending so much time fixing it. – AbhinavK Mar 4 '14 at 17:13
  • many of us who use AWS will have some way stored in a file somewhere to be able to reproduce everything we did. it might simply be the user data script. when we find a problem, we tweak it to be better, terminate the instance that ran the bad script, and launch a new one with the better one. – Skaperen Jul 30 '19 at 1:38
0

Seems like the RPM database is trashed or corrupt. Try the following to rebuild the database from the packages already installed on your server: rpm --rebuilddb

Also check if the database files are present in /var/lib/rpm.

| improve this answer | |
  • I already tried that which didn't help. going to replace the instance. – AbhinavK Mar 4 '14 at 17:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.