I am running a centos 6.6 distro and I am facing an issue with yum. While updating or installing any packages I get some errors, for example

yum install nmap

Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
epel/metalink                                                                                                                                   | 4.4 kB     00:00     
epel-source/metalink                                                                                                                            | 4.4 kB     00:00     
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 294, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 146, in main
    result, resultmsgs = base.doCommands()
  File "/usr/share/yum-cli/cli.py", line 438, in doCommands
    return self.yum_cli_commands[self.basecmd].doCommand(self, self.basecmd, self.extcmds)
  File "/usr/share/yum-cli/yumcommands.py", line 210, in doCommand
    return base.installPkgs(extcmds)
  File "/usr/share/yum-cli/cli.py", line 699, in installPkgs
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 3513, in install
    mypkgs = self.pkgSack.returnPackages(patterns=pats,
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 906, in <lambda>
    pkgSack = property(fget=lambda self: self._getSacks(),
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 686, in _getSacks
  File "/usr/lib/python2.6/site-packages/yum/repos.py", line 290, in populateSack
  File "/usr/lib/python2.6/site-packages/yum/repos.py", line 105, in doSetup
  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/fastestmirror.py", line 197, in postreposetup_hook
    if downgrade_ftp and _len_non_ftp(repo.urls) == 1:
  File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 701, in <lambda>
    urls = property(fget=lambda self: self._geturls(),
  File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 698, in _geturls
  File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 644, in _baseurlSetup
  File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 741, in <lambda>
    metalink_data = property(fget=lambda self: self._getMetalink(),
  File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 729, in _getMetalink
    shutil.move(result, self.metalink_filename)
  File "/usr/lib/python2.6/shutil.py", line 250, in move
    raise Error, "Destination path '%s' already exists" % real_dst
shutil.Error: Destination path '/var/cache/yum/i386/6/epel-source/metalink.xml/metalink.xml.tmp' already exists

tailf /var/log/messages

Mar 20 15:53:58 system2 abrt: detected unhandled Python exception in '/usr/bin/yum'
Mar 20 15:53:58 system2 abrtd: New client connected
Mar 20 15:53:58 system2 abrtd: Directory 'pyhook-2015-03-20-15:53:58-8635' creation detected
Mar 20 15:53:58 system2 abrt-server[8636]: Saved Python crash dump of pid 8635 to /var/spool/abrt/pyhook-2015-03-20-15:53:58-8635

free -m

             total       used       free     shared    buffers     cached
Mem:          1883       1834         49        140         21        242
-/+ buffers/cache:       1570        313
Swap:         4031        486       3545
  • Try yum clean all. Looks like there is an issue with the cache. – Devon Mar 20 '15 at 18:39
  • Yes, I tried that command, but still showing the same error. – vipin kumar Mar 21 '15 at 4:22
  • Does the directory /var/cache/yum/i386/6/epel-source/metalink.xml/metalink.xml.tmp still exist after you clean the cache? Try manually removing that path and see if something is blocking it. – Devon Mar 21 '15 at 4:57
  • After cleaning the cache, that file still persisted, so I renamed it to some other and tried it again. But this time I am getting some other errors.. like "sqlite3.DatabaseError: database disk image is malformed" – vipin kumar Mar 21 '15 at 7:02

The second error (from the comments): database malformed error should be corrected by yum history new

sudo yum clean all
sudo yum history new

I would just remove the entire cache directory ( /var/cache/yum/i386 ) for the first error since yum clean isn't removing the directory causing the error. Yum will redownload what it needs.

| improve this answer | |

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.