Link to home
Start Free TrialLog in
Avatar of tomfra
tomfraFlag for Czechia

asked on

Yum fails after upgrading CentOS 5.2 -> CentOS 5.3

After upgrading CentOS 5.2 to CentOS 5.3 via "yum update" on a server, yum no longer works. "yum install package" or "yum update" now results in the following error:

------------------
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 580, in doCommand
    return base.updatePkgs(extcmds)
  File "/usr/share/yum-cli/cli.py", line 565, in updatePkgs
    self.update()
  File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 2481, in update
    updates = self.up.getUpdatesTuples()
  File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 604, in <lambda>
    up = property(fget=lambda self: self._getUpdates(),
  File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 495, in _getUpdates
    self._up.rawobsoletes = self.pkgSack.returnObsoletes(newest=True)
  File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 591, in <lambda>
    pkgSack = property(fget=lambda self: self._getSacks(),
  File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 416, in _getSacks
    if self._pkgSack and thisrepo is None:
  File "/usr/lib/python2.4/site-packages/yum/packageSack.py", line 263, in __len__
    ret += len(sack)
ValueError: __len__() should return >= 0
------------------

I've tried "yum clean all" but that did not help. The server is a hardware node for hosting OpenVZ VPS accounts. No problems noticed except for this yum problem.
ASKER CERTIFIED SOLUTION
Avatar of ravenpl
ravenpl
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tomfra

ASKER

OK, this is strange... your solution helped, but it seems the problem was in the yum.conf file. I backed up the old config file and when I used it with the new yum installation, it failed again.

For some reason, when this line in yum.conf is not commented out, yum gives the mentioned error:

exclude=kernel* syslinux* ovzkernel*

I see nothing wrong with this line and it worked just fine before the upgrade (and there is a very good reason to have the exlude line there). When it's there, it doesn't work. When I comment it out, it works OK. The syntax is correct, have just checked "man yum.conf".

Any ideas?
"ovzkernel*"
No package match, and therefore "ValueError: __len__() should return >= 0" fails - I suppose. You could submit a bug to the yum project.
Avatar of tomfra

ASKER

But there *IS* ovzkernel package (from the OpenVZ repo), when I uncomment the exclude line it actually offers me to install it. Really strange.
Avatar of tomfra

ASKER

OK, a nasty bug in the most recent version of Yum apparently:

Does not work (gives the error):

exclude=kernel* syslinux* ovzkernel*
exclude=ovzkernel* syslinux* kernel*

Works OK:

exclude=kernel* syslinux* ovzkernel

For some reason there cannot be the wilcard * character for the last package name. And yes, I am editing the file through command line (or mc actually) so the line end character should not be a problem, it's in the correct *nix format and this very same yum.conf file had been working just fine with previous versions of Yum.

Really a bug I guess. Anyway, since you helped me solve the problem, I will accept your solution. Thanks for the help!
Avatar of jazzl0ver
jazzl0ver

"yum clean all" helped in my case
Avatar of tomfra

ASKER

The "yum clean all" did not help in my situation, I tried it. In my case it was probably indeed a yummy bug...
yum clean all

fixed mine

the yum update now works... my yum.conf didn't have any wild cards in it. It looked very clean and trim.
The odd part for me is that I generally keep all 5 of my servers uptodate -- so what ever this was it hit all at the same time. My last successful update was 5 weeks ago.