Google Answers Logo
View Question
 
Q: Problem with up2date on Redhat 7.1 ( Answered 5 out of 5 stars,   1 Comment )
Question  
Subject: Problem with up2date on Redhat 7.1
Category: Computers > Operating Systems
Asked by: mcfadzean-ga
List Price: $30.00
Posted: 22 Nov 2002 08:01 PST
Expires: 22 Dec 2002 08:01 PST
Question ID: 112555
I just used up2date to upgrade up2date itself, and now it is broken. I
used rpm to uninstall the up2date package, downloaded the rpm again
from RHN and used rpm to install it. No luck. How can I get up2date
working again?

# up2date -l
Traceback (most recent call last):
  File "/usr/sbin/up2date", line 9, in ?
    import rpm
ImportError: No module named rpm

# python -c "import sys; print sys.version"
2.2 (#1, Mar  8 2002, 11:50:57) 
[GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-85)]

# rpm -qip up2date.rpm 
Name        : up2date                      Relocations: (not
relocateable)
Version     : 2.8.39                            Vendor: Red Hat, Inc.
Release     : 1.7.1                         Build Date: Tue 08 Oct
2002 03:32:47 PM MDT
Install date: (not installed)               Build Host:
daffy.perf.redhat.com
Group       : System Environment/Base       Source RPM:
up2date-2.8.39-1.7.1.src.rpm
Size        : 1179357                          License: GPL
Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
URL         : http://rhn.redhat.com
Summary     : Determines which system packages need to be updated via
RHN.
Description :
The Red Hat Update Agent that automatically queries the Red Hat
Network servers and determines which packages need to be updated on
your machine.

Request for Question Clarification by bikerman-ga on 22 Nov 2002 10:03 PST
Hi!

I am going to do my best to help you get this problem resolved.  I've
been running Redhat 7.1 since it first came out (and Redhat in general
since 5.2), and always like to hear of others running Redhat.

As I'm sure you know, computer-related problems can be hard to answer
definitively because there always seem to be several possible causes
to a problem, and no two problems are 100% alike.  Due to this fact, I
am going to post this Request for Clarification, and then move my
research to the comments section until we actually find a solution to
your problem.  When (and if) your problem is solved, I will post what
we find as an answer in order to get paid.

I see that your version of python is 2.2, and I assume that you
upgraded from 1.5.2 yourself because I don't think that Redhat has
released an updated version of python (it doesn't appear on their FTP
server, anyway).  Please correct me if I'm wrong about that.

The 'rpm' module comes from rpm-python, and is installed in
/usr/lib/python1.5/site-packages/rpmmodule.so on my 7.1 system.  Try
running

$ rpm -ql rpm-python

If you see that rpmmodule.so is installed in a location similar to the
above (one which contains python1.5), then I'd say we've found the
problem (your python 2.2 interpreter can't find the module which is
installed for python 1.5).

Do you still have python 1.5.2 installed on your system?  When I
upgraded python to 2.x, the package I used installed the new python
interpreter as python2, so that it didn't mess up my existing python
1.5.2 installation.  Try running

$  ls -l $(which python)

If it says something like

/usr/bin/python -> /usr/bin/python2

then you probably have a /usr/bin/python1.5, and can probably resolve
the problem by creating a symlink from python to python1.5.  Also try
running

$ ls /usr/bin/python*

If you come up with several different versions of python, we should be
able to use the symlink solution (which I will tell you how to do if
you aren't familiar with creating symlinks).

If I haven't made myself clear, please feel free to say so.

Thanks,

bikerman-ga

Clarification of Question by mcfadzean-ga on 22 Nov 2002 11:43 PST
Yes, the problem was up2date was expecting python 1.5, not 2.2. Rather
than changing any symlinks (which might break other parts of the
system), I just changed the first line of up2date to invoke
/usr/bin/python1.5 and that fixed the problem.

Clarification of Question by mcfadzean-ga on 22 Nov 2002 14:52 PST
Go ahead and post an answer to collect the bux!
Answer  
Subject: Re: Problem with up2date on Redhat 7.1
Answered By: bikerman-ga on 22 Nov 2002 18:07 PST
Rated:5 out of 5 stars
 
Hi again, and thanks for the question.

Since my Request for Clarification answered your question, and you
fixed the problem, what I'm going to do here is summarize the
problem, describe two possible solutions (one of which is the one you
used), and give a few tips on searching for this type of
information.  Since your problem is solved, the summary and
solutions are largely for the benefit of others who may have this
problem in the future.


PROBLEM SUMMARY

Redhat 7.1 (Seawolf) is shipped with Python 1.5.2, and--as of this
writing--Redhat hasn't offered an upgrade for Python.  Upgrading
Python to a newer version (e.g., 2.2) won't create any conflicts
with the Python libraries themselves because they are installed in
a directory which contains the Python version in its name.  For
example, the Python 1.5 libraries are installed under
/usr/lib/python1.5 while the Python 2.2 libs are installed under
/usr/lib/python2.2.

The problem comes with the Python binary.  The original Python RPM
installs the interpreter as /usr/bin/python and /usr/bin/python1.5
(these are both hard links to the same inode--you can run the
'stat' command to verify this).  If your new Python package
overwrites /usr/bin/python, then all of your Python scripts will
be running under the new version of Python.

Redhat's up2date utility is a python script which requires a
module named 'rpm' that comes packaged with the rpm-python RPM.
Since rpm-python installs the module under
/usr/lib/python1.5/site-packages, if your python binary is not
1.5, the interpreter won't be able to locate the 'rpm' module.


SOLUTION

Here are two ways to fix this problem:

1) Create a link so that /usr/bin/python and /usr/bin/python1.5
point to the same file again.

If you don't already have a file called python2 under /usr/bin,
then rename python to python2:

# mv /usr/bin/python /usr/bin/python2

If there is already a python2 (or python2.2, etc) then remove
/usr/bin/python:

# rm /usr/bin/python

Now, create the link (note that this creates a hard link and not a
symbolic link):

# ln /usr/bin/python1.5 /usr/bin/python

The problem with this solution, is that it may break scripts which
rely on your newer version of Python just like up2date is broken
by upgrading Python.

2) Change the "shebang" at the top of /usr/sbin/up2date.

Open /usr/sbin/up2date in your favorite text editor and change the
path on the first line to /usr/bin/python1.5.  (Note that there is
also a /usr/bin/up2date which is a symlink to
/usr/bin/consolehelper--be sure to edit the one under /usr/sbin.)

This solution has disadvantages too:  you must remember to change
the shebang again if you ever upgrade up2date; you may find that
some other system programs are broken as well, so you may have to
apply this fix to more than one script.


Additional Links:

Redhat maintains a number of Redhat-related mailing lists:
https://listman.redhat.com/mailman/listinfo/

Geocrawler maintains archives of LOTS of mailing lists:
http://geocrawler.com/


SEARCH TIPS

The Redhat mailing lists provide a wealth of information, and they
are archived in a number of different places, but most of the
archives are not in a format which is easily searched.  If you do
a simple Google search, you'll probably end up with a lot of
duplicate messages from various list archives.  For example, when
researching this question, I performed some of the following
Google searches:

This search will return duplicate messages from various list
archives:
"no module named rpm"
://www.google.com/search?q=%22no%20module%20named%20rpm%22&sourceid=opera&num=0

This narrows the search to one archive site:
site:listman.redhat.com "no module named rpm"
://www.google.com/search?hl=en&lr=&ie=ISO-8859-1&q=site%3Alistman.redhat.com+%22no+module+named+rpm%22&btnG=Google+Search

You can limit your search of listman.redhat.com to the
seawolf-list archives by using the "inurl" operator:
site:listman.redhat.com inurl:seawolf-list upgrade up2date python rpm
://www.google.com/search?hl=en&lr=&ie=ISO-8859-1&q=site%3Alistman.redhat.com+inurl%3Aseawolf-list+upgrade+up2date+python+rpm&btnG=Google+Search

Of course, you can also eliminate list archive sites to help
narrow the search:
"no module named rpm" -site:listman.redhat.com -site:geocrawler.com
://www.google.com/search?hl=en&lr=&ie=ISO-8859-1&q=%22no+module+named+rpm%22+-site%3Alistman.redhat.com+-site%3Ageocrawler.com+&btnG=Google+Search

These features are also helpful for searching the Geocrawler
archives. 


I hope you've found some useful information in this posting in
addition to the info in my Request for Clarification.

Best wishes,
bikerman-ga
mcfadzean-ga rated this answer:5 out of 5 stars
Excellent answer, fast and accurate.

Comments  
Subject: Re: Problem with up2date on Redhat 7.1
From: bikerman-ga on 22 Nov 2002 13:09 PST
 
Great!  I'm glad we got the problem solved.  So would you be satisfied
with me posting a modified version of my previous posting as an answer
in order to collect the amount you offered to pay?

Thanks,
bikerman-ga

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy