3

I ran yum update on my CentOS5 webserver a few days ago. Today I just noticed that I have 3 httpd-* rpms!

How can I end up with three RPMs for httpd (My other servers only have one httpd rpm). I want to make sure that my server has a patched, updated version of /usr/sbin/httpd. How can I tell which one of these packages provides the httpd binary at /usr/sbin/httpd?

[root@node1 ~]# rpm -q httpd
httpd-2.2.3-76.el5.centos
httpd-2.2.3-78.el5.centos
httpd-2.2.3-83.el5.centos

[root@node1 ~]# /usr/sbin/httpd -V |grep version
Server version: Apache/2.2.3

[root@node1 ~]# rpm -q httpd-2.2.3-76.el5.centos --list |grep -w /usr/sbin/httpd
/usr/sbin/httpd
/usr/sbin/httpd.event
/usr/sbin/httpd.worker
[root@node1 ~]# rpm -q httpd-2.2.3-78.el5.centos --list |grep -w /usr/sbin/httpd
/usr/sbin/httpd
/usr/sbin/httpd.event
/usr/sbin/httpd.worker
[root@node1 ~]# rpm -q httpd-2.2.3-83.el5.centos --list |grep -w /usr/sbin/httpd
/usr/sbin/httpd
/usr/sbin/httpd.event
/usr/sbin/httpd.worker
[root@node1 ~]# 

root@node1 ~]# rpm -q --provides httpd |grep -w httpd
config(httpd) = 2.2.3-76.el5.centos
httpd-mmn = 20051115
httpd = 2.2.3-76.el5.centos
config(httpd) = 2.2.3-78.el5.centos
httpd-mmn = 20051115
httpd = 2.2.3-78.el5.centos
config(httpd) = 2.2.3-83.el5.centos
httpd-mmn = 20051115
httpd = 2.2.3-83.el5.centos

Update: Answering Mark Wagner's questions:

[root@node1 ~]# rpm -q -f /usr/sbin/httpd 
httpd-2.2.3-76.el5.centos
httpd-2.2.3-78.el5.centos
httpd-2.2.3-83.el5.centos
[root@node1 ~]# rpm -V httpd-2.2.3-83.el5.centos
S.5.....  c /etc/logrotate.d/httpd
S.5.....  c /etc/rc.d/init.d/httpd
....L...    /var/www

Update2: Attempting to rebuild the RPM database, with no luck

[root@node1 ~]# cd /var/lib
[root@node1 lib]# tar zcvf /var/preserve/rpmdb-`date +"%d%m%Y"`.tar.gz rpm
[root@node1 lib]# cd /var/lib/rpm
[root@node1 rpm]# rm -f __db*
[root@node1 rpm]# /usr/lib/rpm/rpmdb_verify Packages
[root@node1 rpm]# mv Packages Packages.orig
[root@node1 rpm]# /usr/lib/rpm/rpmdb_dump Packages.orig | /usr/lib/rpm/rpmdb_load P
ackages
[root@node1 rpm]# /usr/lib/rpm/rpmdb_verify Packages
[root@node1 rpm]# rpm -qa 1> /dev/null
[root@node1 rpm]# rpm -v --rebuilddb
[root@node1 rpm]# rpm -q httpd
httpd-2.2.3-76.el5.centos
httpd-2.2.3-78.el5.centos
httpd-2.2.3-83.el5.centos
[root@node1 rpm]# 
5
  • 1
    What is the output of rpm -q -f /usr/sbin/httpd and rpm -V httpd-2.2.3-83.el5.centos? Oct 31, 2013 at 19:10
  • 1
    As you can see, these are three diffrent packaging versions of the same patch version of the software. Rpm are always named this way : softwarename-Major.Minor.patch-Packaging_number.rpm
    – mveroone
    Oct 31, 2013 at 19:47
  • 1
    I've also seen corrupt rpm DB's cause this. You may want to attempt to rebuild with rpm --rebuildb Oct 31, 2013 at 19:55
  • More to the point: How exactly did you install these RPMs? Oct 31, 2013 at 22:15
  • @MichaelHampton Originally? 3 years ago I installed using yum install httpd. Ever since then I've been doing yum update. Nov 1, 2013 at 17:46

2 Answers 2

1

I'd rebuild the rpm database as well. I usually just do:

cd /var/lib/rpm
rm __db*
rpm --rebuilddb

but here's the longer, safer, official method:

http://www.rpm.org/wiki/Docs/RpmRecovery

1
  • Thanks Bill, I gave this a try but I still see the same problem. See my output above. Nov 20, 2013 at 20:57
1

This looks like a classic case of interrupted updates. An update is done in two stages: the new files are installed and the new packages added to the database, then any old files are removed and the old package removed from the database. If the update is interrupted between these two steps, you get this sort of inconsistency.

What I would do with this situation is (this will require a brief maintenance window):

  1. Save a copy of your configuration files. RPM will do this anyway with an .rpmsave extension for any files you modified, but it's best to be doubly sure.

  2. Forcibly remove all of the packages:

    rpm -e --allmatches httpd
    
  3. Reinstall the package:

    yum -y install httpd
    
  4. Restore your configuration files.

4
  • It is entirely possible that when I ran yum update 30 times over the last 3 years that the update was interrupted for some reason. Nov 20, 2013 at 21:03
  • If that ever happens again, be sure to run yum-complete-transaction as soon as possible to finish the transaction. Nov 20, 2013 at 21:04
  • I don't recall when the yum update failed, but I do remember seeing a message to occasionally do yum-complete-transaction. I believe this was always for a different set of packages from a third party repo which changed their package names, not httpd. I'll try it next time I can schedule a maintenance window. Nov 20, 2013 at 21:09
  • I also recommend starting up a tmux or screen session before you run updates. That way, if your ssh session drops for some reason, the update will still continue. The message about running yum-complete-transaction generally appears on the next yum run after the failed update. Nov 20, 2013 at 21:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .