LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-28-2012, 02:15 PM   #1
CelticFiddler
LQ Newbie
 
Registered: Aug 2012
Location: Plano, TX
Distribution: Debian 6
Posts: 11

Rep: Reputation: Disabled
How to install Python2.4 on CentOS 6 when yum is broken?


I couldn't find a CentOS-specific forum, and I didn't know if the RHEL folks would resent me posting there, so I settled on the Newbie forum. If this isn't in the right place, I hope the moderator(s) will move it to the correct place and let me know.

I somehow managed to break yum. I think it might have been when trying to install the SVN plugin in Eclipse. So far, my attempts to fix the problem have made it worse.

When I started, I was getting:

[root@centos-vm-hh ~]# yum update
Plugin "refresh-packagekit" can't be imported
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/metalink | 11 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 276, in user_main
errcode = main(args)
File "/usr/share/yum-cli/yummain.py", line 129, in main
result, resultmsgs = base.doCommands()
File "/usr/share/yum-cli/cli.py", line 434, in doCommands
self._getTs(needTsRemove)
File "/usr/lib/python2.6/site-packages/yum/depsolve.py", line 99, in _getTs
self._getTsInfo(remove_only)
File "/usr/lib/python2.6/site-packages/yum/depsolve.py", line 110, in _getTsInfo
pkgSack = self.pkgSack
File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 883, in <lambda>
pkgSack = property(fget=lambda self: self._getSacks(),
File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 668, in _getSacks
self.repos.populateSack(which=repos)
File "/usr/lib/python2.6/site-packages/yum/repos.py", line 265, in populateSack
self.doSetup()
File "/usr/lib/python2.6/site-packages/yum/repos.py", line 92, in doSetup
self.ayum.plugins.run('postreposetup')
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 706, in <lambda>
urls = property(fget=lambda self: self._geturls(),
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 703, in _geturls
self._baseurlSetup()
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 649, in _baseurlSetup
mirrorurls.extend(list(self.metalink_data.urls()))
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 746, in <lambda>
metalink_data = property(fget=lambda self: self._getMetalink(),
File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 733, in _getMetalink
self._metalink = metalink.MetaLinkRepoMD(result)
File "/usr/lib/python2.6/site-packages/yum/metalink.py", line 186, in __init__
root = xmlparse(filename)
File "/usr/lib/python2.6/site-packages/yum/misc.py", line 1174, in cElementTree_xmlparse
_cElementTree_import()
File "/usr/lib/python2.6/site-packages/yum/misc.py", line 1164, in _cElementTree_import
import cElementTree
ImportError: No module named cElementTree

After my initial attempts to fix this, I am now getting:

[root@centos-vm-hh ~]# yum clean all
-bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory
[root@centos-vm-hh ~]# yum update
-bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory

I think I need to install python 2.4, and I think it needs to be in a specific place. There are probably many other things I need to know about this, since every place I go to find out anything about CentOS or even Linux in general appears to be written in geek by somebody who assumes that any reader is already fluent in the language. I did some Unix programming about 20 years ago, but either I have completely forgotten everything, or everything has changed. Or both.

Any rate, I would sincerely appreciate it if somebody would show me how to get yum working again.

TIA
 
Old 08-28-2012, 05:40 PM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2016, Slack14.1 Deb Jessie, + 50+ other Linux OS, for test only.
Posts: 16,276

Rep: Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154
Welcome to LQ.

I guess you will have to reinstall the yum related packages manually.
The command 'cat /etc/redhat-release' will confirm, if it's CentOS 6.
I.e. CentOS 6 has no python2.4, but python-2.6.6 !

Packages :
python python-libs yum-fastestmirror python-urlgrabber yum-metadata-parser
python-elementtree python-sqlite python-iniparse rpm-python rpm yum
http://www.linuxquestions.org/questi...ctor-933911/#6
→ post # 6. ( How to install with # rpm -Uvh --force <package> ).

Links, CentOS 6
http://mirror.centos.org/centos/6.3/os/
Updates http://mirror.centos.org/centos/6.3/updates/

.

Last edited by knudfl; 08-29-2012 at 04:15 AM.
 
Old 08-28-2012, 05:50 PM   #3
Renante
LQ Newbie
 
Registered: Aug 2012
Location: Ottawa ON, Canada
Distribution: Red Hat Enterprise Linux 6.3 Server
Posts: 13

Rep: Reputation: 2
Try to download yum manually from your browser then open terminal on the download location and type: rpm -Uvh packagename.rpm
Then install Python using yum
 
Old 08-28-2012, 05:57 PM   #4
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,260

Rep: Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948
Quote:
Originally Posted by Renante View Post
Try to download yum manually from your browser then open terminal on the download location and type: rpm -Uvh packagename.rpm
Then install Python using yum
yum requires python to work. Without python, yum won't run.
 
Old 08-28-2012, 05:59 PM   #5
Renante
LQ Newbie
 
Registered: Aug 2012
Location: Ottawa ON, Canada
Distribution: Red Hat Enterprise Linux 6.3 Server
Posts: 13

Rep: Reputation: 2
you can download and use fedora rpm here: http://www.python.org/getit/releases/2.4/rpms/
then use sudo rpm -ivh packagename.rpm to install
 
Old 08-28-2012, 06:11 PM   #6
Renante
LQ Newbie
 
Registered: Aug 2012
Location: Ottawa ON, Canada
Distribution: Red Hat Enterprise Linux 6.3 Server
Posts: 13

Rep: Reputation: 2
Quote:
Originally Posted by suicidaleggroll View Post
yum requires python to work. Without python, yum won't run.
I mean download yum using browser: http://yum.baseurl.org/
then use $ sudo rpm -Uvh packagename.rpm
Now that I look at it, no rpm package available thus: you need to download that using browser, then run make or make your own rpm.
You can also download yum rpm here: http://rpmfind.net/linux/rpm2html/search.php?query=yum
 
Old 08-28-2012, 06:41 PM   #7
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,260

Rep: Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948
Quote:
Originally Posted by Renante View Post
I mean download yum using browser: http://yum.baseurl.org/
then use $ sudo rpm -Uvh packagename.rpm
Now that I look at it, no rpm package available thus: you need to download that using browser, then run make or make your own rpm.
You can also download yum rpm here: http://rpmfind.net/linux/rpm2html/search.php?query=yum
I was responding to this part of your post:
Quote:
Originally Posted by Renante View Post
Then install Python using yum
If python isn't already installed and working, he can't use yum, even if yum is installed. Therefore he can't use yum to install python. This is evidenced by his error message:
Quote:
[root@centos-vm-hh ~]# yum update
-bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory
Yum appears to be working fine, it's python that's the problem.
 
Old 08-29-2012, 01:15 AM   #8
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 16,830

Rep: Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409
yum and Python GO HAND IN HAND
the VERSION of python in the Cent update/base repo IS REQUIRED
you CAN NOT CHANGE IT!!!!

now you can install a SECOND or third version of python next to the REQUIRED version

you MUST and i do mean MUST use the rpm's that are in the cent repo !!!!!
CentOs 6.3 is it
so manually reinstall the python rpms
the mirrors ARE on the cent site
http://www.centos.org/modules/tinyco...ndex.php?id=30
a FAST USA mirror ( Arctic Region Supercomputing Center)
http://mirrors.arsc.edu/centos/
cent os 6.3 ( guessing the 64 bit )
http://mirrors.arsc.edu/centos/6.3/os/x86_64/Packages/
--- python-2.6.6-29.el6_2.2.i686.rpm
--- python-2.6.6-29.el6_2.2.x86_64.rpm

now if you NEED a OLD python 2.4 for a old program you can install python24 along side 2.6

Last edited by John VV; 08-29-2012 at 01:17 AM.
 
Old 08-29-2012, 06:09 AM   #9
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,241

Rep: Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325
I'd take the Centos DVD media and boot, from it as if doing an install, but choose the 'Update this Install' option (there's an option named something like that).
Because its running from the DVD, it won't matter that the HDD version is 'broken'.
Of course, if you haven't anything important on there, just do a re-install.
 
1 members found this post helpful.
Old 08-29-2012, 11:15 AM   #10
CelticFiddler
LQ Newbie
 
Registered: Aug 2012
Location: Plano, TX
Distribution: Debian 6
Posts: 11

Original Poster
Rep: Reputation: Disabled
I have downloaded and installed python 2.6.6, and now the problem appears to be different.

[root@centos-vm-hh tmp]# which python
/usr/local/bin/python
[root@centos-vm-hh tmp]# `which python` --version
Python 2.6.6
[root@centos-vm-hh tmp]# python
Python 2.6.6 (r266:84292, Aug 29 2012, 07:53:00)
[GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
[root@centos-vm-hh tmp]# yum update
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

No module named yum

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:
2.6.6 (r266:84292, Aug 29 2012, 07:53:00)
[GCC 4.4.6 20110731 (Red Hat 4.4.6-3)]

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


So, I went looking for yum:

[root@centos-vm-hh tmp]# find / -name yum 2>/dev/null
/var/cache/yum
/var/lib/yum
/usr/bin/yum
/usr/share/PackageKit/helpers/yum
/usr/lib/python2.6/site-packages/yum
/etc/logrotate.d/yum
/etc/yum
/home/howard/Downloads/yum-3.4.3/yum

[root@centos-vm-hh tmp]# find / -name yum.py 2>/dev/null
/usr/lib/python2.4/site-packages/sos/plugins/yum.py
/usr/lib/python2.6/site-packages/sos/plugins/yum.py
/home/howard/Downloads/yum-3.4.3/bin/yum.py
[root@centos-vm-hh tmp]#

What am I doing wrong?
 
Old 08-29-2012, 11:18 AM   #11
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 3,836

Rep: Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360
Knee jerk reaction is to say "Fix Yum."
 
Old 08-29-2012, 11:56 AM   #12
CelticFiddler
LQ Newbie
 
Registered: Aug 2012
Location: Plano, TX
Distribution: Debian 6
Posts: 11

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by szboardstretcher View Post
Knee jerk reaction is to say "Fix Yum."
Unhelpful. If I knew how to do that, I would not have made my last post.
 
Old 08-29-2012, 12:06 PM   #13
CelticFiddler
LQ Newbie
 
Registered: Aug 2012
Location: Plano, TX
Distribution: Debian 6
Posts: 11

Original Poster
Rep: Reputation: Disabled
I have located some packages that look like they might be useful:
[ ] PackageKit-yum-0.5.8-20.el6.x86_64.rpm 24-Jun-2012 22:16 156K
[ ] PackageKit-yum-plugin-0.5.8-20.el6.x86_64.rpm 24-Jun-2012 22:17 92K

Do I need to install one of these, or is there some other place I need to be looking?

I also tried:

[root@centos-vm-hh Downloads]# rpm -ivh yum-3.4.3-5.fc16.src.rpm
warning: yum-3.4.3-5.fc16.src.rpm: Header V3 RSA/SHA256 Signature, key ID a82ba4b7: NOKEY
1:yum warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
########################################### [100%]
[root@centos-vm-hh Downloads]#

This did not appear to have any effect on the problem at hand:

[root@centos-vm-hh Downloads]# yum update
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

No module named yum

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:
2.6.6 (r266:84292, Aug 29 2012, 07:53:00)
[GCC 4.4.6 20110731 (Red Hat 4.4.6-3)]

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

Last edited by CelticFiddler; 08-29-2012 at 12:11 PM. Reason: Add new info
 
Old 08-29-2012, 12:50 PM   #14
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2016, Slack14.1 Deb Jessie, + 50+ other Linux OS, for test only.
Posts: 16,276

Rep: Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154
# 13
Quote:
[root@centos-vm-hh Downloads]# rpm -ivh yum-3.4.3-5.fc16.src.rpm
Not a binary package. SRC.RPMS are source code.
And not for CentOS 6. No Fedora 16 packages will do.

Please use the links to CentOS 6.3, and do not use 'rpm -ivh '.
-ivh is used when you want 2 versions at the same time.
The right command is : rpm -Uvh --force
.. to get the non working packages replaced.
Package list : Also see post # 2.

Link x86_64 http://mirror.centos.org/centos/6.3/os/x86_64/Packages/
Updates x86_64 http://mirror.centos.org/centos/6.3/...6_64/Packages/

.
 
Old 08-29-2012, 01:40 PM   #15
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 16,830

Rep: Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409
at this point
you are mixing all sorts of things
fedora 16 and cent6.3
using SOURCE"src.rpm" packages
and manually overwrote python2.6 with 2.4 ( partially overwrote i should say)

it might be ,at this point, easier to reinstall
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 on Centos 6.0 broken... IronTed Linux - General 3 04-26-2012 11:17 AM
centos broken yum after installing new python mad_penguin Linux - Newbie 2 11-17-2011 06:36 PM
[SOLVED] Trying to install 'Gmail Backup' but it requires python2.5 - I have python2.8... Robert.Thompson Slackware 6 05-10-2011 09:23 AM
Broken Yum while updating centos from 4.6 to 5.2 hoodedmanwithsythe Linux - Software 2 09-20-2008 03:59 AM
yum broke after installing python2.3.3 on FC2 powah Linux - Software 3 12-06-2005 07:29 PM


All times are GMT -5. The time now is 08:24 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration