Archive for May, 2010

You can use msgset to set the size of the message queue, but the easiest way is to just set it on the kernel directly.

The default size is 64k. So here I set it to around 1Meg.

As root run:

echo 1000000 > /proc/sys/kernel/msgmnb

(I added to /etc/rc.d/rc.local on CentOS 5.5)

and you can check it with:

cat /proc/sys/kernel/msgmnb

To complete the story, I ran into this problem when I had hundreds of clients simultaneously trying to write to a full queue, and a server trying to read from it. For reasons I didn’t investigate, the server would see the queue as empty, even though it had 11 messages in the queue (use command: ipcs).

So for me, this is a quick work-around as I move to some other queuing system.

wget http://downloads.sourceforge.net/project/fail2ban/fail2ban-stable/fail2ban-0.8.4/fail2ban-0.8.4.tar.bz2?use_mirror=transact
tar xf fail2ban-0.8.4.tar.bz2
cd fail2ban-0.8.4
su
python setup.py install
cp files/redhat-initd /etc/init.d/fail2ban
su -
chkconfig --add fail2ban
chkconfig fail2ban on
vi /etc/fail2ban/jail.conf

And go through the various sections (eg [ssh-iptables]), and change the ones you want to enabled = true
and change the lines like (/etc/fail2ban/jail.conf):

sendmail-whois[name=SSH, dest=you@mail.com, sender=fail2ban@mail.com]
logpath  = /var/log/sshd.log

to your email address, and a sender that works for you, so if you run example.com you might change to:

sendmail-whois[name=SSH, dest=cameron@example.com, sender=fail2ban@example.com]
logpath  = /var/log/secure

(you have to change the logpath to secure.log)
If you use [sasl-iptables], then change the logpath to /var/log/maillog
And then of course start it (or reboot)

service fail2ban start

you can test the rules with

fail2ban-regex /var/log/secure /etc/fail2ban/filter.d/sshd.conf

The defaults worked fine for me, but you might want to look here for some alternate centos sshd rules.

What doesn’t work for me is a rule to ban attacks on my mail server. More on that when I find a good solution.

Links
http://www.sonoracomm.com/support/18-support/228-fail2ban

Okay, so you heard there are some cool new features in gimp-2.7. Well, it’s an unstable version. “But I want layer folders”. Yeah yeah, okay, so this should work for non-developers, but remember 2.7 is unstable.

The following will do a build from “gimp-build” directory which is in your home directory and install into “gimp” in your home directory.

Suggestions for improvements welcome.

This is using Ubuntu 10.04. Different versions may require some additional packages be installed.

cd
export PREFIX=`echo ~/gimp`
export PATH=$PREFIX/bin:$PATH
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig:$PREFIX/share/pkgconfig
sudo apt-get install libtool automake1.10 autoconf git-core gettext \
libglib2.0-0 libglib2.0-dev libgtk2.0-0 libgtk2.0-dev ruby \
intltool libtiff4 libtiff4-dev python-dev python-gtk2-dev \
libexif-dev libmng-dev liblcms1-dev libxpm-dev librsvg2-dev \
libwmf-dev libasound2-dev

mkdir gimp-build
cd gimp-build
git clone git://git.gnome.org/babl
git clone git://git.gnome.org/gegl
git clone git://git.gnome.org/gimp

cd babl
./autogen.sh –prefix=$PREFIX
make
make install

cd ../gegl
./autogen.sh –prefix=$PREFIX
make
make install

cd ../gimp
./autogen.sh –prefix=$PREFIX
make
make install

Now you can run gimp as

~/gimp/bin/gimp-2.7

How to install svn 1.6 for centos 5.5:
First enable the rpmforge repo (repository – a place for “rpm” packages),
then you can just install using yum. Note that after I installed the subversion, I then disabled the repo to keep my install as close to CentOS as I can.

wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

rpm -ivh rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

yum install subversion.x86_64

You can disable the rpmforge repo in /etc/yum.repos.d/rpmforge.repo
and changed enabled = 1 to enabled = 0

script-fu-selection-rounded-rectangle is just broken in gimp 2.6.8. This patch fixes two things. One, it makes it work again (gimp 2.6.8), and two it fixes the out-by one that makes the rounded rectangles and “pill” selections to look bad.

rounded-selection.patch:

--- /home/blah/gimp-2.6.8/plug-ins/script-fu/scripts/selection-round.scm     2009-07-21 06:20:51.000000000 +1000
+++ ./selection-round.scm       2010-05-17 16:27:45.000000000 +1000
@@ -27,6 +27,7 @@
;; 2.02 - changed scale to percentages, usability tweaking.
;; 2.10 - added concave round edges, updated description.
;; 2.11 - tweeked description, changed comments, relinquished any rights.
+;; 2.12 - forced radius to be integer and corrected out-by one. - Cameron

;; Copyright (C) 1997, 1998, Sven Neumann
;; Copyright (C) 2004, Alan Horkan.
@@ -45,12 +46,13 @@
(has-selection (car select-bounds))
(select-x1 (cadr select-bounds))
(select-y1 (caddr select-bounds))
+ ; x2 and y2 are not actually part of the selection
(select-x2 (cadr (cddr select-bounds)))
(select-y2 (caddr (cddr select-bounds)))
(select-width (- select-x2 select-x1))
(select-height (- select-y2 select-y1))
(cut-radius 0)
- (ellipse-radius 0)
+ (cut-diam 0)
)

;; select to the full bounds of the selection,
@@ -60,27 +62,34 @@
CHANNEL-OP-ADD FALSE 0)

(if (> select-width select-height)
- (set! cut-radius (trunc (+ 1 (* radius (/ select-height 2)))))
- (set! cut-radius (trunc (+ 1 (* radius (/ select-width 2)))))
+ (set! cut-radius (* radius (/ select-height 2)))
+ (set! cut-radius (* radius (/ select-width 2)))
)
- (set! ellipse-radius (* cut-radius 2))
+ ; gimp-ellise-select appears to only handle whole numbers.
+ ; note that if it did use floats, then don’t use trunc
+ ; eg, you could set the center to a corner – 1.5 with a radius of 3.
+ ; you could also get slightly better results for !concave
+ ; if you use a semi-circle when radius = 100%.
+ (set! cut-radius (trunc (+ 0.5 cut-radius)))
+ (set! cut-diam (* cut-radius 2))
+ ; we could stop here if radius or diam was 0

;; cut away rounded (concave) corners
- ; top right
+ ; top left
(gimp-ellipse-select image
(- select-x1 cut-radius)
(- select-y1 cut-radius)
- (* cut-radius 2)
- (* cut-radius 2)
+ cut-diam
+ cut-diam
CHANNEL-OP-SUBTRACT
TRUE
FALSE 0)
- ; lower left
+ ; bottom left
(gimp-ellipse-select image
(- select-x1 cut-radius)
(- select-y2 cut-radius)
- (* cut-radius 2)
- (* cut-radius 2)
+ cut-diam
+ cut-diam
CHANNEL-OP-SUBTRACT
TRUE
FALSE 0)
@@ -88,17 +97,17 @@
(gimp-ellipse-select image
(- select-x2 cut-radius)
(- select-y1 cut-radius)
- (* cut-radius 2)
- (* cut-radius 2)
+ cut-diam
+ cut-diam
CHANNEL-OP-SUBTRACT
TRUE
FALSE 0)
- ; bottom left
+ ; bottom right
(gimp-ellipse-select image
(- select-x2 cut-radius)
(- select-y2 cut-radius)
- (* cut-radius 2)
- (* cut-radius 2)
+ cut-diam
+ cut-diam
CHANNEL-OP-SUBTRACT
TRUE
FALSE 0)
@@ -106,35 +115,39 @@
;; add in rounded (convex) corners
(if (= concave FALSE)
(begin
+ ; top left
(gimp-ellipse-select image
select-x1
select-y1
- ellipse-radius
- ellipse-radius
+ cut-diam
+ cut-diam
CHANNEL-OP-ADD
TRUE
FALSE 0)
+ ; bottom left
(gimp-ellipse-select image
select-x1
- (- select-y2 ellipse-radius)
- ellipse-radius
- ellipse-radius
+ (- select-y2 cut-diam)
+ cut-diam
+ cut-diam
CHANNEL-OP-ADD
TRUE
FALSE 0)
+ ; top right
(gimp-ellipse-select image
- (- select-x2 ellipse-radius)
+ (- select-x2 cut-diam)
select-y1
- ellipse-radius
- ellipse-radius
+ cut-diam
+ cut-diam
CHANNEL-OP-ADD
TRUE
FALSE 0)
+ ; bottom right
(gimp-ellipse-select image
- (- select-x2 ellipse-radius)
- (- select-y2 ellipse-radius)
- ellipse-radius
- ellipse-radius
+ (- select-x2 cut-diam)
+ (- select-y2 cut-diam)
+ cut-diam
+ cut-diam
CHANNEL-OP-ADD
TRUE
FALSE 0)
@@ -148,7 +161,7 @@

(define (script-fu-selection-round image drawable radius)
- (script-fu-selection-rounded-rectangle image drawable (* radius 100))
+ (script-fu-selection-rounded-rectangle image drawable (* radius 100) FALSE)
)

The rounded rectangle could be even better if gimp-ellipse-select could handle non-integers (it accepts them, but then just truncates it anyway – at least when feathering is off).

So after the patch, you are left with selection-round.scm (you can replace this with your current one – keep a backup):

;; selection-rounded-rectangle.scm -*-scheme-*-

;; GIMP – The GNU Image Manipulation Program
;; Copyright (C) 1995 Spencer Kimball and Peter Mattis
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

;; CHANGE-LOG:
;; 1.00 – initial release
;; 1.01 – some code cleanup, no real changes
;; 1.02 – made script undoable

;; 2.00 – ALAN’s Branch. changed name, menu, location, and description
;; 2.01 – fixed to work if there was no current selection.
;; 2.02 – changed scale to percentages, usability tweaking.
;; 2.10 – added concave round edges, updated description.
;; 2.11 – tweeked description, changed comments, relinquished any rights.
;; 2.12 – forced radius to be integer and corrected out-by one. – Cameron

;; Copyright (C) 1997, 1998, Sven Neumann
;; Copyright (C) 2004, Alan Horkan.
;; Alan Horkan relinquishes all rights to his changes,
;; full ownership of this script belongs to Sven Neumann.

(define (script-fu-selection-rounded-rectangle image drawable radius concave)
(gimp-image-undo-group-start image)

(if (= (car (gimp-selection-is-empty image)) TRUE) (gimp-selection-all image))
(let* (
(radius (/ radius 100)) ; convert from percentages
(radius (min radius 1.0))
(radius (max radius 0.0))
(select-bounds (gimp-selection-bounds image))
(has-selection (car select-bounds))
(select-x1 (cadr select-bounds))
(select-y1 (caddr select-bounds))
; x2 and y2 are not actually part of the selection
(select-x2 (cadr (cddr select-bounds)))
(select-y2 (caddr (cddr select-bounds)))
(select-width (- select-x2 select-x1))
(select-height (- select-y2 select-y1))
(cut-radius 0)
(cut-diam 0)
)

;; select to the full bounds of the selection,
;; fills in irregular shapes or holes.
(gimp-rect-select image
select-x1 select-y1 select-width select-height
CHANNEL-OP-ADD FALSE 0)

(if (> select-width select-height)
(set! cut-radius (* radius (/ select-height 2)))
(set! cut-radius (* radius (/ select-width 2)))
)
; gimp-ellise-select appears to only handle whole numbers.
; note that if it did use floats, then don’t use trunc
; eg, you could set the center to a corner – 1.5 with a radius of 3.
; you could also get slightly better results for !concave
; if you use a semi-circle when radius = 100%.
(set! cut-radius (trunc (+ 0.5 cut-radius)))
(set! cut-diam (* cut-radius 2))
; we could stop here if radius or diam was 0

;; cut away rounded (concave) corners
; top left
(gimp-ellipse-select image
(- select-x1 cut-radius)
(- select-y1 cut-radius)
cut-diam
cut-diam
CHANNEL-OP-SUBTRACT
TRUE
FALSE 0)
; bottom left
(gimp-ellipse-select image
(- select-x1 cut-radius)
(- select-y2 cut-radius)
cut-diam
cut-diam
CHANNEL-OP-SUBTRACT
TRUE
FALSE 0)
; top right
(gimp-ellipse-select image
(- select-x2 cut-radius)
(- select-y1 cut-radius)
cut-diam
cut-diam
CHANNEL-OP-SUBTRACT
TRUE
FALSE 0)
; bottom right
(gimp-ellipse-select image
(- select-x2 cut-radius)
(- select-y2 cut-radius)
cut-diam
cut-diam
CHANNEL-OP-SUBTRACT
TRUE
FALSE 0)

;; add in rounded (convex) corners
(if (= concave FALSE)
(begin
; top left
(gimp-ellipse-select image
select-x1
select-y1
cut-diam
cut-diam
CHANNEL-OP-ADD
TRUE
FALSE 0)
; bottom left
(gimp-ellipse-select image
select-x1
(- select-y2 cut-diam)
cut-diam
cut-diam
CHANNEL-OP-ADD
TRUE
FALSE 0)
; top right
(gimp-ellipse-select image
(- select-x2 cut-diam)
select-y1
cut-diam
cut-diam
CHANNEL-OP-ADD
TRUE
FALSE 0)
; bottom right
(gimp-ellipse-select image
(- select-x2 cut-diam)
(- select-y2 cut-diam)
cut-diam
cut-diam
CHANNEL-OP-ADD
TRUE
FALSE 0)
)
)

(gimp-image-undo-group-end image)
(gimp-displays-flush)
)
)

(define (script-fu-selection-round image drawable radius)
(script-fu-selection-rounded-rectangle image drawable (* radius 100) FALSE)
)

(script-fu-register “script-fu-selection-rounded-rectangle”
_”Rounded R_ectangle…”
_”Round the corners of the current selection”
“Alan Horkan, Sven Neumann” ; authors
“Sven Neumann” ; copyright
“2004/06/07″
“*”
SF-IMAGE “Image” 0
SF-DRAWABLE “Drawable” 0
SF-ADJUSTMENT _”Radius (%)” ‘(50 0 100 1 10 0 0)
SF-TOGGLE _”Concave” FALSE
)

(script-fu-register “script-fu-selection-round”
“”
“Round the corners of the current selection (deprecated, use Rounded Rectangle)”
“Sven Neumann” ; authors
“Sven Neumann” ; copyright
“1998/02/06″
“*”
SF-IMAGE “Image” 0
SF-DRAWABLE “Drawable” 0
SF-ADJUSTMENT “Relative radius” ‘(1 0 128 0.1 1 1 1)
)

(script-fu-menu-register “script-fu-selection-rounded-rectangle”
/Select/Modify”)

 

CentOS 5.5 is out …

Quick answer is VirtualBox. Free for personal use, and there is a GPL version. I’m trying out the PUEL version (free to check it out, free for personal use, not free for commercial use ($50)).

Step 1. Download and install the linux host. I’m using 64bit CentOS, linux
http://www.virtualbox.org/wiki/Downloads, and the final download location was http://download.virtualbox.org/virtualbox/3.1.4/VirtualBox-3.1-3.1.4_57640_rhel5-1.x86_64.rpm.

rpm -ivh ./VirtualBox-3.1-3.1.4_57640_rhel5-1.x86_64.rpm

next add your users to the vboxusers group. Wow, seems to be no easy one liner to do that (normally just edit /etc/group). Usermod doesn’t take a group name (only the id), so here is a quick hack for you (group “vboxusers” exists after rpm installation above):

usermod -G `grep vboxusers /etc/group | awk -F: '{print $1}'` cameron

Suggest you just edit /etc/group :) .

Now run Applications -> System Tools -> Sun VirtualBox

Click New

Click Next

Enter in a name (I used “windows7″), enter in the Version type (I’m using “Windows 7 (64 bit)”) and hit Next.

Now you need to choose the amount of memory. My machine has 6gig on it, and a quick look on top shows that I’m “only” using 2g. So I set the size to 3gig. My thinking here is that if I have the VM running, I want it to run well, if I need the memory back, I’ll shut down the VM. Click Next.

Now we need to choose a virtual hard disk. I googled around a little to see if I could my existing install, but that doesn’t really seem to be possible. Some information is here: http://www.virtualbox.org/wiki/Migrate_Windows

so I insert my windows 7 cd and hit next. and get a warning about running in 32bit mode… [TODO]

and now a warning about the CD/DVD drive:

There is a reboot during the installation:

Enter your product key. I’m using the one that is already installed on the box. We’ll see how that goes!


Well that went surprisingly well… It’s a shame that you can’t have it run off the same install that I already have (like I will do on my macbook), and perhaps this is not the end of the licensing story.

I need to share my cdrom over the internet, so this is what I did.
I’m using windows7 for the drive (don’t worry, I’m sharing a Centos CD for a remote install).

The quick steps are:

1. Turn off windows firewall.
2. Share the drive
3. Forward ports 135-139, 445 from your router to the machine (tcp and udp).
4. Access the drive as //ip.address.whatever/cdrom

1. Turn off the firewall

Start -> Control Panel -> System and Security -> Windows Firewall.

Then on left, click: Turn Windows Firewall on or off.  And I turned it off for public and home, then click ok. (don’t forget to turn it back on later).

2. Share the drive.
I insert the CentOS 5.4 64 bit CD into the drive.

Hit Windows-E, then right click on the CDROM (D:)

Share with -> Advanced Sharing…

Click Advanced Sharing

Check “Share this folder”

Change Share name to cdrom (or whatever, you don’t need to change it).

click permissions.  Now check that only “Read” is “Allow” for “Everyone”.

Now the share is available is \\my.ip.address\cdrom

Also note that running this over Samba worked even easier, and I recommend doing that instead of sharing from a windows box.

If you are doing a remote CentOS install, you (most probably) should use the network install. That way the remote machine can use a local mirror to get all the RPM’s, rather than going back to your CD to get it. It was an interesting exercise to install CentOS on a machine in the UK, when I’m sitting here in Brisbane, Australia.

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).

I was recently trying to load an image via a URL in gimp. A gimp that I had built myself. It gives an error like:

Opening 'http://...' failed:
Could not open 'http://...' for reading: No such file or directory

It seems my gimp was building with gio/gvfs, but still failing to load the URL, so during build I added
–without-gio and –without-gnomvfs to configure, and then it would build with libcurl (see the output of configure to confirm). Don’t forget to actually install libcurl:

yum install curl-devel

and rebuild (no easy task if you are using CentOS).