Well, the short answer is no. The long answer is yes, but it’s a pain.

I had a fairly basic setup with 32bit Centos 5.4, inserted the 64bit and went through the “upgrade” procedure. The whole thing took about 5 minutes, and it rebooted just fine (I had to select the 2.6.16-164.el5 option from grub (not the old PAE ones I was using)). but the first command:

yum install

failed with the following error:

There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

/usr/lib/python2.4/site-packages/rpm/_rpmmodule.so: wrong ELF class: ELFCLASS32

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.4.3 (#1, Sep 3 2009, 15:37:37)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)]

If you cannot solve this problem yourself, please go to
the yum faq at:
http://wiki.linux.duke.edu/YumFaq

 

Then I noted that hpssd had failed on startup for a similar reason.
“uname -a” presents a promising answer:

-bash-3.2$ uname -a
Linux libero 2.6.18-164.el5 #1 SMP Thu Sep 3 03:28:30 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
-bash-3.2$

So I think the problem is just with python. After a bit more bashing, there is certainly something wrong because when I try to enforce a install, I get a wrong architecture warning:

[root@libero CentOS]# rpm -ivh ./rpm-4.4.2.3-18.el5.x86_64.rpm ./rpm-libs-4.4.2.3-18.el5.x86_64.rpm ./rpm-python-4.4.2.3-18.el5.x86_64.rpm   ./perl-5.8.8-27.el5.x86_64.rpm ./sqlite-3.3.6-5.x86_64.rpm ./elfutils-libelf-0.137-3.el5.x86_64.rpm --force
Preparing...                ########################################### [100%]
package elfutils-libelf-0.137-3.el5.x86_64 is intended for a x86_64 architecture
package sqlite-3.3.6-5.x86_64 is intended for a x86_64 architecture
package perl-5.8.8-27.el5.x86_64 is intended for a x86_64 architecture
package rpm-libs-4.4.2.3-18.el5.x86_64 is intended for a x86_64 architecture
package rpm-4.4.2.3-18.el5.x86_64 is intended for a x86_64 architecture
package rpm-python-4.4.2.3-18.el5.x86_64 is intended for a x86_64 architecture

I’d be interested to hear in your experience, I know it’s possible thanks to the following link:

[root@libero CentOS]# rpm --eval '%{_arch}'
i386
[root@libero CentOS]#

okay, lets see if we can fix that:

[root@libero CentOS]# rpm -e rpm.i386 rpm-python
error: Failed dependencies:
rpm = 4.4.2.3-18.el5 is needed by (installed) rpm-libs-4.4.2.3-18.el5.i386
rpm is needed by (installed) man-1.6d-1.1.i386
rpm >= 0:4.4.2 is needed by (installed) yum-3.2.22-20.el5.centos.noarch
rpm is needed by (installed) qt4-4.2.1-1.i386
/bin/rpm is needed by (installed) policycoreutils-1.33.12-14.6.el5.i386
rpm-python is needed by (installed) system-config-users-1.2.51-4.el5.noarch
rpm-python is needed by (installed) yum-3.2.22-20.el5.centos.noarch
rpm-python is needed by (installed) system-config-network-tui-1.3.99.18-1.el5.noarch
[root@libero CentOS]# rpm --nodeps -e rpm.i386 rpm-python
[root@libero CentOS]# rpm -ivh ./rpm-4.4.2.3-18.el5.x86_64.rpm
bash: /bin/rpm: No such file or directory
[root@libero CentOS]#

ha ha ha .. no surprise there. I tried just upgrading again, and that didn’t work. So I booted into rescue mode (put in cd, type “linux rescue” at the boot: prompt.
I mounted the drive, copied the runtime to the hard drive, and then copied a number of items back into their appropriate places

mkdir -p /mnt/sysimage/media/cdrom
mount /dev/scd0 /mnt/sysimage/media/cdrom
rsync -a /mnt/runtime /mnt/sysimage/runtime
chroot /mnt/sysimage
cp /runtime/usr/bin/rpm /usr/bin
cp /runtime/usr/lib64/librpm* /usr/lib64
cp /runtime/usr/lib64/libsqlite* /usr/lib64
cp /runtime/usr/lib64/libelf* /usr/lib64

At this point I rebooted.

# as root
mount /dev/csd0 /media/cdrom
cp -r /runtime/usr/lib/rpm /usr/lib/
/runtime/usr/bin/rpm --rebuilddb
#edit /etc/rpm/platform to be x86_64-redhat-linux
[root@libero cdrom]# cd /media/cdrom/CentOS/
[root@libero CentOS]# /runtime/usr/bin/rpm -ivh ./rpm-4.4.2.3-18.el5.x86_64.rpm  rpm-libs-4.4.2.3-18.el5.x86_64.rpm elfutils-libelf-0.137-3.el5.x86_64.rpm  ./sqlite-3.3.6-5.x86_64.rpm
Preparing...                ########################################### [100%]
1:sqlite                 ########################################### [ 25%]
2:elfutils-libelf        ########################################### [ 50%]
3:rpm-libs               ########################################### [ 75%]
4:rpm                    ########################################### [100%]
[root@libero CentOS]#

I thought it prudent to rebuild the rpm database again

[root@libero CentOS]# rpm --rebuilddb
[root@libero CentOS]#

I change the rpm output to show the architecture…

[root@libero CentOS]# cat /etc/rpm/macros
%_query_all_fmt      %%{name}-%%{version}-%%{release}.%%{arch}
%_query_fmt      %%{name}-%%{version}-%%{release}.%%{arch}

okay .. lets see how we go:

[root@libero CentOS]# 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 rpm

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.4.3 (#1, Sep 3 2009, 15:37:37)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)]

If you cannot solve this problem yourself, please go to
the yum faq at:
http://wiki.linux.duke.edu/YumFaq

[root@libero CentOS]# rpm -qa | grep python
gnome-python2-canvas-2.16.0-1.fc6.i386
python-numeric-23.7-2.2.2.i386
python-2.4.3-27.el5.i386
gnome-python2-gnomeprint-2.16.0-3.el5.i386
gnome-python2-libegg-2.14.2-6.el5.i386
gnome-python2-bonobo-2.16.0-1.fc6.i386
gnome-python2-gconf-2.16.0-1.fc6.i386
gnome-python2-gnomevfs-2.16.0-1.fc6.i386
python-elementtree-1.2.6-5.i386
gnome-python2-desktop-2.16.0-3.el5.i386
gnome-python2-extras-2.14.2-6.el5.i386
libxml2-python-2.6.26-2.1.2.8.i386
python-sqlite-1.1.7-1.2.1.i386
python-2.4.3-27.el5.x86_64
notify-python-0.1.0-3.fc6.i386
python-ldap-2.2.0-2.1.i386
libselinux-python-1.33.4-5.5.el5.i386
python-urlgrabber-3.1.0-5.el5.noarch
gnome-python2-applet-2.16.0-3.el5.i386
gnome-python2-gtksourceview-2.16.0-3.el5.i386
gnome-python2-2.16.0-1.fc6.i386
audit-libs-python-1.7.13-2.el5.i386
python-iniparse-0.2.3-4.el5.noarch
gamin-python-0.1.7-8.el5.i386
dbus-python-0.70-9.el5_4.i386

Certainly at this point, I’m running x86 (at least the rpm and kernel are).

rpm --erase rpm-libs-4.4.2.3-18.el5.i386
[root@libero CentOS]# yum install gcc
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

No module named rpm

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.4.3 (#1, Sep 3 2009, 15:37:37)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)]

If you cannot solve this problem yourself, please go to
the yum faq at:
http://wiki.linux.duke.edu/YumFaq

[root@libero CentOS]# yum install gcc
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

No module named rpm

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.4.3 (#1, Sep 3 2009, 15:37:37)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)]

If you cannot solve this problem yourself, please go to
the yum faq at:
http://wiki.linux.duke.edu/YumFaq

And so I attempt to fix it…

[root@libero CentOS]# rpm -ivh ./rpm-python-4.4.2.3-18.el5.x86_64.rpm
Preparing… ########################################### [100%]
1:rpm-python ########################################### [100%]
[root@libero CentOS]#
[root@libero CentOS]# rpm –erase expat –nodeps
[root@libero CentOS]# rpm -ivh ./python-elementtree-1.2.6-5.x86_64.rpm ./python-elementtree-1.2.6-5.x86_64.rpm python-ldap-2.2.0-2.1.x86_64.rpm python-numeric-23.7-2.2.2.x86_64.rpm python-sqlite-1.1.7-1.2.1.x86_64.rpm ./expat-1.95.8-8.2.1.x86_64.rpm
Preparing… ########################################### [100%]
1:expat ########################################### [ 17%]
2:python-elementtree ########################################### [ 33%]
3:python-elementtree ########################################### [ 50%]
4:python-ldap ########################################### [ 67%]
5:python-numeric ########################################### [ 83%]
6:python-sqlite ########################################### [100%]
[root@libero CentOS]# rpm –erase python-2.4.3-27.el5.i386 python-elementtree-1.2.6-5.i386 python-ldap-2.2.0-2.1.i386 python-numeric-23.7-2.2.2.i386 python-sqlite-1.1.7-1.2.1.i386
error: Failed dependencies:
libpython2.4.so.1.0 is needed by (installed) gnome-python2-gnomevfs-2.16.0-1.fc6.i386
libpython2.4.so.1.0 is needed by (installed) rhythmbox-0.11.6-4.el5.i386
libpython2.4.so.1.0 is needed by (installed) libsemanage-1.9.1-4.4.el5.i386
[root@libero CentOS]# rpm –erase python-2.4.3-27.el5.i386 python-elementtree-1.2.6-5.i386 python-ldap-2.2.0-2.1.i386 python-numeric-23.7-2.2.2.i386 python-sqlite-1.1.7-1.2.1.i386 –nodeps
[root@libero CentOS]# rpm -ivh ./sqlite-devel-3.3.6-5.x86_64.rpm
Preparing… ########################################### [100%]
1:sqlite-devel ########################################### [100%]
[root@libero CentOS]# rpm -ivh ./yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm ./libxml2-2.6.26-2.1.2.8.x86_64.rpm
Preparing… ########################################### [100%]
1:libxml2 ########################################### [ 50%]
2:yum-metadata-parser ########################################### [100%]
[root@libero CentOS]# yum update

 

yay .. finally 🙂

I was getting a lot of errors like this:

-bash-3.2$ yum update
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

/usr/lib/python2.4/site-packages/_sqlitecache.so: wrong ELF class: ELFCLASS32

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.4.3 (#1, Sep 3 2009, 15:37:37)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)]

If you cannot solve this problem yourself, please go to
the yum faq at:
http://wiki.linux.duke.edu/YumFaq

-bash-3.2$

For me, that problem was related to some of the yum and python files not being upgraded to 64bit. So I spent a fair bit of time dorking around and upgrading some x86_64 from the cdrom and then deleting (sometimes –nodeps) the i386/i686 ones.

So now the question is, would I recommend this? No! But if you are in a bind, and spending a day or two to sort out the problems is less painful than a fresh install, then it looks like it’ll work to me.

But, after all that, I’m off to reinstall (but it was a fun exercise).

3 Comments

  1. DavidR says:

    I cannot thank you enough for this post. I found myself in the exact same position with a messed up Yum and Python after attempting a 32bit to 64bit upgrade. This really saved my bacon and everything is working again 🙂

  2. chaithany says:

    Thanks saved a DAY.

Leave a Reply