LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions
User Name
Password
Linux - Distributions This forum is for Distribution specific questions.
Red Hat, Slackware, Debian, Novell, LFS, Mandriva, Ubuntu, Fedora - the list goes on and on... Note: An (*) indicates there is no official participation from that distribution here at LQ.

Notices


Reply
  Search this Thread
Old 01-14-2014, 11:19 PM   #1
mahesh1222
LQ Newbie
 
Registered: Jul 2012
Posts: 9

Rep: Reputation: Disabled
Yum Not working in CentOS 6.4


Hi Guys,

This is Maheswar,Since few days i could not able to update or install any package/RPM in CentOS6.4 through YUM.

When i execute the yum clean all or yum update it is throwing an error.

except KeyboardInterrupt, e: kind of error.

Please find the attached yum.conf file and /usr/bin/yum file and CentOS-Base.repo file under /etc/yum.repos.d/

Appreciate the help.

Thanks & Regards,
Maheswar Reddy GundreCentOSBase.txt

usr-bin-yum.txt

yum.txt
 
Old 01-15-2014, 12:07 AM   #2
SAbhi
Member
 
Registered: Aug 2009
Location: Bangaluru, India
Distribution: CentOS 6.5, SuSE SLED/ SLES 10.2 SP2 /11.2, Fedora 11/16
Posts: 665

Rep: Reputation: Disabled
no file attached can you paste the file contents here encapsulated in "
Code:
" "
"
 
Old 01-15-2014, 12:11 AM   #3
mahesh1222
LQ Newbie
 
Registered: Jul 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by SAbhi View Post
no file attached can you paste the file contents here encapsulated in "
Code:
" "
"
yum.repos.d/CentOS-Base.repo:
-----------------------------

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

/usr/bin/yum
-------------

#!/usr/bin/python
import sys
try:
import yum
except ImportError:
print >> sys.stderr, """\
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

%s

Please install a package which provides this module, or
verify that the module is installed correctly.

It's possible that the above module doesn't match the
current version of Python, which is:
%s

If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq

""" % (sys.exc_value, sys.version)
sys.exit(1)

sys.path.insert(0, '/usr/share/yum-cli')
try:
import yummain
yummain.user_main(sys.argv[1:], exit_code=True)
except KeyboardInterrupt, e:
print >> sys.stderr, "\n\nExiting on user cancel."
sys.exit(0)

/etc/yum.conf
------------

[main]
cachedir=/var/cache/yum
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=0
plugins=1
installonly_limit=5
pkgpolicy=newest
tolerant=1
metadata_expire=1800
timeout=7

#bugtracker_url=http://bugs.centos.org/set_project.php?project_id=16&ref=http://bugs.centos.org/bug_report_page.php?category=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
 
Old 01-15-2014, 12:15 AM   #4
SAbhi
Member
 
Registered: Aug 2009
Location: Bangaluru, India
Distribution: CentOS 6.5, SuSE SLED/ SLES 10.2 SP2 /11.2, Fedora 11/16
Posts: 665

Rep: Reputation: Disabled
uncomment baseurl in all.
yum clean all
check if its working and if you are connected to internet.
 
Old 01-15-2014, 12:21 AM   #5
mahesh1222
LQ Newbie
 
Registered: Jul 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
Hi SAbhi,

Thanks for replying to my post.

I uncommented the baseurl.

And checked in the browser and ping to the url on centos, i got the reply.

And then tried yum clean all and getting the below error.

[root@localhost clamav]# yum clean all
File "/usr/bin/yum", line 30
except KeyboardInterrupt, e:
^
SyntaxError: invalid syntax

Thanks

Mahesh
 
Old 01-15-2014, 12:43 AM   #6
SAbhi
Member
 
Registered: Aug 2009
Location: Bangaluru, India
Distribution: CentOS 6.5, SuSE SLED/ SLES 10.2 SP2 /11.2, Fedora 11/16
Posts: 665

Rep: Reputation: Disabled
oh this gave me a lesson yum is written in python, so i got this url on the forum check if this is of any help:

http://www.linuxquestions.org/questi...um-4175419559/
 
Old 01-15-2014, 01:12 AM   #7
mahesh1222
LQ Newbie
 
Registered: Jul 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
Hi,

Still getting same error.
 
Old 01-15-2014, 01:27 AM   #8
mahesh1222
LQ Newbie
 
Registered: Jul 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
Hi,

Thanks for posting the link and with that did the below changes

Did some chages in /usr/bin/yum

#!/usr/bin/python
import sys
try:
import yum
except ImportError:
print >> sys.stderr, """\
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

%s

Please install a package which provides this module, or
verify that the module is installed correctly.

It's possible that the above module doesn't match the
current version of Python, which is:
%s

If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq

#""" % (sys.exc_value, sys.version)
""" % (sys.exc_info()[0], sys.version), file=sys.stderr)
sys.exit(1)

sys.path.insert(0, '/usr/share/yum-cli')
try:
import yummain
yummain.user_main(sys.argv[1:], exit_code=True)
#except KeyboardInterrupt, e:
#print >> sys.stderr, "\n\nExiting on user cancel."
#sys.exit(0)
except KeyboardInterrupt, e:
print("\n\nExiting on user cancel.", file=sys.stderr)
sys.exit(0)"""

then executing yum clean all , immediately it is exiting from the command and showing the
[root@localhost bin]# yum clean all
[root@localhost bin]#

Plz let me know.

Thanks,
Mahesh
 
Old 01-15-2014, 02:16 AM   #9
SAbhi
Member
 
Registered: Aug 2009
Location: Bangaluru, India
Distribution: CentOS 6.5, SuSE SLED/ SLES 10.2 SP2 /11.2, Fedora 11/16
Posts: 665

Rep: Reputation: Disabled
what was changed ? just mention what you changed,
yum clean all is not required after that.. since the change is made outside of yum dir..
well try running some install or query and see what it says now..
sorry but this is new error for me so i am not so sure.. i would try best to help though.
 
Old 01-15-2014, 02:43 AM   #10
mahesh1222
LQ Newbie
 
Registered: Jul 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
Hi,

Below are the changes i did from the link which you sent.

--- yum (original)
+++ yum (refactored)
@@ -3,7 +3,7 @@
try:
import yum
except ImportError:
- print >> sys.stderr, """\
+ print("""\
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

@@ -20,13 +20,13 @@
the yum faq at:
http://yum.baseurl.org/wiki/Faq

-""" % (sys.exc_value, sys.version)
+""" % (sys.exc_info()[1], sys.version), file=sys.stderr)
sys.exit(1)

sys.path.insert(0, '/usr/share/yum-cli')
try:
import yummain
yummain.user_main(sys.argv[1:], exit_code=True)
-except KeyboardInterrupt, e:
- print >> sys.stderr, "\n\nExiting on user cancel."
+except KeyboardInterrupt as e:
+ print("\n\nExiting on user cancel.", file=sys.stderr)
sys.exit(1)

Thanks
Mahesh
 
Old 01-15-2014, 03:09 AM   #11
SAbhi
Member
 
Registered: Aug 2009
Location: Bangaluru, India
Distribution: CentOS 6.5, SuSE SLED/ SLES 10.2 SP2 /11.2, Fedora 11/16
Posts: 665

Rep: Reputation: Disabled
it looks like what they told is to change the version python was using in shebang.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
yum not working on centos 5 vivendi Linux - Newbie 6 11-17-2011 04:51 AM
how to update rhel 5 using centos yum updater without conflict with yum redhat plugin udayvikram Linux - Software 2 03-30-2010 08:15 AM
how to update rhel 5 using centos yum updater without conflict with yum redhat plugin udayvikram Linux - Newbie 1 03-29-2010 12:56 PM
yum update on CentOS 5.3 upgraded my system to CentOS 5.4 diskoe Red Hat 1 10-29-2009 04:41 PM
update centos 4 rc1 to centos 4 trou yum? maxut cAos 2 03-04-2005 02:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions

All times are GMT -5. The time now is 07:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration