Yum cannot handle situation where the yum history is removed manually

Solution Unverified - Updated -

Issue

When the command yum history is called by an unprivileged user after the yum history removal, the following message occurs:

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 285, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 105, in main
    base.getOptionsConfig(args)
  File "/usr/share/yum-cli/cli.py", line 310, in getOptionsConfig
    self.parseCommands() # before we return check over the base command + args
  File "/usr/share/yum-cli/cli.py", line 350, in parseCommands
    self.yum_cli_commands[self.basecmd].doCheck(self, self.basecmd, self.extcmds)
  File "/usr/share/yum-cli/yumcommands.py", line 1460, in doCheck
    elif not os.access(base.history._db_file, os.R_OK):
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 924, in <lambda>
    history = property(fget=lambda self: self._getHistory(),
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 889, in _getHistory
    releasever=self.conf.yumvar['releasever'])
  File "/usr/lib/python2.6/site-packages/yum/history.py", line 700, in __init__
    self._create_db_file()
  File "/usr/lib/python2.6/site-packages/yum/history.py", line 1645, in _create_db_file
    cur.execute(op)
AttributeError: 'NoneType' object has no attribute 'execute'

Environment

  • Red Hat Enterprise Linux (RHEL) 6

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