Cannot update openssh-server using yum

Latest response

I have never been able to update openssh-server using yum

  yum update openssh-server


It always breaks with the following errors...


  File "/usr/bin/yum", line 29, in ?
    yummain.user_main(sys.argv[1:], exit_code=True)
  File "/usr/share/yum-cli/", line 309, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/", line 178, in main
    result, resultmsgs = base.doCommands()
  File "/usr/share/yum-cli/", line 349, in doCommands
    return self.yum_cli_commands[self.basecmd].doCommand(self, self.basecmd, self.extcmds)
  File "/usr/share/yum-cli/", line 201, in doCommand
    return base.updatePkgs(extcmds)
  File "/usr/share/yum-cli/", line 620, in updatePkgs
    if not self.update(pattern=arg):
  File "/usr/lib/python2.4/site-packages/yum/", line 2865, in update
    (e, m, u) = self.rpmdb.matchPackageNames([kwargs['pattern']])
  File "/usr/lib/python2.4/site-packages/yum/", line 224, in matchPackageNames
IndexError: list index out of range


Anyone have any idea how to fix this?


Looks like the yum metadata cache may have gotten corrupted. Since everything in the yum cache can be re-fetched from servers, this problem can be fixed by typing this command:


yum clean all


In the unlikely event that you still get an "index out of range" error after yum's cached metadata has been cleared, rebuilding the indices to the RPM database may be in order:


rpm --rebuilddb


However, chances are just the "yum clean all" will fix your problem.

Thanx, Rik!


I tried everything everyone else suggested but the rpm --rebuilddb fixed the problem.


Another way to clean cache is :


 rm -fr /var/cache/yum/* 


also you can use


cp -Rp /var/lib/rpm /var/lib/rpm.bck

rm -f /var/lib/rpm/__db*

rpm --rebuilddb




the traceback doesn't look exactly the same or the error message, but it smells very similar to what's described in


have you tried that?



 This is likely an rpmdb problem like:


...although I thought most of those bugs had been fixed with the latest versions of yum in RHEL-5 (what version do you have)?


 As that bug suggests, you can try using "package-cleanup" and/or manually installing missing dependencies ... also "yum upgrade yum" is never a bad idea, if you can.

In that case, you'll need to download the rpms from RHN and install them using;


rpm -Uv <rpm file names>


You may have to do multiple round trips to RHN to get all your dependencies right. But you need to do this only for yum. Once yum is fixed, you can use it to update everything else.


If openssh-server is your only concern for now, you could update openssh-server using rpm in the same way.