Yum is interrupted and now gives conflicts

I have a Centos 6.7 server, which I wanted to update. So I did

yum update

However, this was on a live server (not very smart of me, I know). The server ran out of resources and the yum update got interrupted. I can now no longer run yum update. I have tried yum clean all, but can't seem to start yum.

This is what I get:

# yum update
Loaded plugins: downloadonly, fastestmirror
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 300, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 115, in main
    base.getOptionsConfig(args)
  File "/usr/share/yum-cli/cli.py", line 229, in getOptionsConfig
    self.conf
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 911, in <lambda>
    conf = property(fget=lambda self: self._getConfig(),
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 335, in _getConfig
    startupconf.pluginconfpath,disabled_plugins,enabled_plugins)
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 564, in doPluginSetup
    plugin_types, confpath, disabled_plugins, enabled_plugins)
  File "/usr/lib/python2.6/site-packages/yum/plugins.py", line 167, in __init__
    self.run('config')
  File "/usr/lib/python2.6/site-packages/yum/plugins.py", line 184, in run
    func(conduitcls(self, self.base, conf, **kwargs))
  File "/usr/lib/yum-plugins/downloadonly.py", line 30, in config_hook
    default=False, help="don't update, just download")
  File "/usr/lib64/python2.6/optparse.py", line 1020, in add_option
    self._check_conflict(option)
  File "/usr/lib64/python2.6/optparse.py", line 995, in _check_conflict
    option)
optparse.OptionConflictError: option --downloadonly: conflicting option string(s): --downloadonly

There seems to be an error with Python, but I'm not sure how to fix it.


Solution 1:

I was asked to look at a system doing this yesterday too. In my case there were 2 versions of yum installed

yum-3.2.29-60.el6.centos.noarch
yum-3.2.29-69.el6.centos.noarch

but removing the newer version (rpm -e) didn't solve the problem. I also had to remove yum-plugin-downloadonly-1.1.30-30.el6.noarch and it's dependent package yum-cron-3.2.29-69.el6.centos.noarch.

Once that was done I was able to run yum again and ran yum-complete-transaction.

Solution 2:

Try to updating while temporary disabling the downloadonly plugin, using the command:

yum update --disableplugin=downloadonly

Solution 3:

I was able to solve this by running:

yum install yum-utils 
yum-complete-transaction