yum error: "File "/usr/bin/yum", line 29, in <module>"

General support questions
Post Reply
BlokeDownThePub
Posts: 12
Joined: 2009/11/12 15:00:04

yum error: "File "/usr/bin/yum", line 29, in <module>"

Post by BlokeDownThePub » 2018/03/03 15:00:34

When I issue yum clean all (or update, clean cache, or list available... ) it gives:

Code: Select all

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 298, 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 300, in _getConfig
    startupconf = config.readStartupConfig(fn, root)
  File "/usr/lib/python2.6/site-packages/yum/config.py", line 896, in readStartupConfig
    startupconf.releasever = _getsysver(startupconf.installroot, startupconf.distroverpkg)
  File "/usr/lib/python2.6/site-packages/yum/config.py", line 1047, in _getsysver
    hdr = idx.next()
StopIteration
It seems to be the same error, same lines whichever specific yum option I choose.

I've tried:

Just rebooting.

rm -rf /var/lib/rpm/__db* followed by rpm --rebuilddb

yum update yum

All to no effect. I saw some suggestions about uninstalling & reinstalling python, but I don't know how to do that without yum and yum is borked...

Systenm is: 2.6.32-696.20.1.el6.x86_64 #1 SMP Fri Jan 26 17:51:45 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux, i.e. a pretty recent 6.9

python --version Python 2.6.6
python3 --version Python 3.4.3

Any ideas, short of a clean reinstall :(

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: yum error: "File "/usr/bin/yum", line 29, in <module>"

Post by TrevorH » 2018/03/03 15:38:18

Since that appears to be complaining about something in the config file, post /etc/yum.conf
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

BlokeDownThePub
Posts: 12
Joined: 2009/11/12 15:00:04

Re: yum error: "File "/usr/bin/yum", line 29, in <module>"

Post by BlokeDownThePub » 2018/03/17 11:15:47

# cat /etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=3
bugtracker_url=http://bugs.centos.org/set_project.php? ... tegory=yum
distroverpkg=centos-release

# This is the default, if you make this bigger yum won't see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
# It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking
# interupting your command line usage, it's much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d

=============

# stat /etc/yum.conf
File: `/etc/yum.conf'
Size: 969 Blocks: 8 IO Block: 4096 regular file
Device: 901h/2305d Inode: 526049 Links: 1
Access: (0755/-rwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2018-03-17 10:52:28.298502767 +0100
Modify: 2017-07-22 00:04:23.313470872 +0200
Change: 2017-07-22 00:04:23.431439317 +0200

Seems odd that this suddenly occurs, the file hasn't changed in 6 months.

User avatar
avij
Retired Moderator
Posts: 3046
Joined: 2010/12/01 19:25:52
Location: Helsinki, Finland
Contact:

Re: yum error: "File "/usr/bin/yum", line 29, in <module>"

Post by avij » 2018/03/17 11:58:41

It also seems to complain about distroverpkg. What do you get with rpm -q centos-release ? Does rpm -qa list the packages you have installed? You don't need to check all of them, but check to make sure it returns a longish list (100+ packages).

Post Reply