Multiple hanging processes or errors running /etc/cron.daily/rpm

June 27, 2011  |  linux

If you attempt to run an RPM command  and receive an error message that the RPM database is in use, or if you have multiple zombie cron processes probably you’ll need to rebuild the rpm database. Take a look:

[root@db2 root]# ps -ef 
root     31366 31019  0 04:02 ?        00:00:00 /bin/sh /etc/cron.daily/rpm
root     31367 31019  0 04:02 ?        00:00:00 awk -v progname=/etc/cron.daily/rpm progname {?????   print progname ":\n"?????   prog
root     31369 31366  0 04:02 ?        00:00:00 /usr/lib/rpm/rpmq -q --all --qf %{name}-%{version}-%{release}.%{arch}.rpm\n

This means that the nightly jobs started by cron are zombie or sleeping, probably because someone aborted an rpm usage before. To solve this kill all those zombie processes and clean the rpm temporary database files located at /var/lib/rpm.

[root@db2 root]# kill -9 31366
[root@db2 root]# cd /var/lib/rpm
[root@db2 rpm]# ls -lht
-rw-r--r-- 1 root root  24K Jun 27 04:02 __db.001
-rw-r--r-- 1 root root 1,3M Jun 27 04:02 __db.002
-rw-r--r-- 1 root root 440K Jun 27 04:02 __db.003
-rw-r--r-- 1 root root    0 Mai 27 14:43 __db.000
(...)

So let’s delete those temporary rpm database files and recreate the rpm database from the installed package headers.

[root@db2 rpm]# rm -f __db*
[root@db2 rpm]# rpm --rebuilddb

Done…


Leave a Reply