Bug 234442 - RPM Updates Corrupt RPM Database
RPM Updates Corrupt RPM Database
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: rpm (Show other bugs)
4.4
x86_64 Linux
medium Severity medium
: ---
: ---
Assigned To: Panu Matilainen
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-03-29 05:23 EDT by Matt Thompson
Modified: 2007-11-16 20:14 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-08-20 07:19:58 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
strace -vv from rpmdb_verify on the Packages file (745.66 KB, text/plain)
2007-04-02 04:31 EDT, Matt Thompson
no flags Details

  None (edit)
Description Matt Thompson 2007-03-29 05:23:56 EDT
Description of problem:

When an rpm is installed via up2date (or rpm directly), the rpm database becomes
corrupt.  This became visible after performing the following update:

up2date -uf kernel kernel-devel kernel-doc kernel-smp kernel-smp-devel

This up2date update completed but returned these errors:

error: db4 error(-30988) from dbcursor->c_get: DB_PAGE_NOTFOUND: Requested page
not found
error: db4 error(-30988) from dbcursor->c_get: DB_PAGE_NOTFOUND: Requested page
not found
error: db4 error(-30988) from dbcursor->c_get: DB_PAGE_NOTFOUND: Requested page
not found 

The kernel-utils package was updated prior to these and updated without any
visible issues.

Version-Release number of selected component (if applicable):

Red Hat Enterprise Linux ES release 4 (Nahant Update 4)
up2date-4.4.69-25
rpm-4.3.3-18_nonptl
rpm-python-4.3.3-18_nonptl
rpm-libs-4.3.3-18_nonptl
rpm-build-4.3.3-18_nonptl
rpm-devel-4.3.3-18_nonptl

How reproducible:

This can be reproduced consistantly.

Steps to Reproduce:
1. # cd /var/lib/rpm; rm -rf __db*; rpm --rebuilddb
2. # /usr/lib/rpm/rpmdb_verify Packages (this returns no errors)
3. # up2date <pkg> (where <pkg> is an uninstalled package)
  
Actual results:

After having a package installed, /usr/lib/rpm/rpmdb_verify Packages returns:

db_verify: unable to initialize mutex: Function not implemented
db_verify: Packages: Function not implemented
db_verify: DB->verify: Packages: Function not implemented

... and removing __db* and doing an rpm --rebuilddb seems to correct the issue.

Expected results:

/var/lib/rpm/Packages to remain uncorrupted after a package has been installed.

Additional info:

I have also tested the following but this did not help:

# mv Packages Packages.orig
# /usr/lib/rpm/rpmdb_dump Packages.orig | /usr/lib/rpm/rpmdb_load Packages
# /usr/lib/rpm/rpmdb_verify Packages

Also, since this problem started, I have installed packages via up2date, done an
rpm -qi <pkg> to verify the package was installed only to find that rpm believed
the package did not exist.  Upon doing an rpm -qa and then an rpm -qi <pkg>, it
then listed it as being installed.

Thank you for your assistance!
Comment 1 Jeff Johnson 2007-03-29 08:11:27 EDT
Your system is not supporting posix shared mutexes for some reason. Without locking,
you're likely to see cache inconsistencies as above.

Try reverting the kernel upgrade and see whether the problem is in that kernel.

Comment 2 Matt Thompson 2007-03-30 05:41:08 EDT
Hello Jeff,

Thanks for the reply.  I tried booting off the original kernel
(2.6.9-22.0.2.ELsmp) but this does not seem to have solved the issue.

I removed /var/lib/rpm/__db*, did an rpm --rebuilddb, verified that rpmdb_verify
did not return any errors on the Packages file, and then attempted to install a
package via up2date.  The up2date process returned:

error: db4 error(-30988) from dbcursor->c_get: DB_PAGE_NOTFOUND: Requested page
not found
error: db4 error(-30988) from dbcursor->c_get: DB_PAGE_NOTFOUND: Requested page
not found

... and I now see this when running rpmdb_verify on Packages:

db_verify: unable to initialize mutex: Function not implemented
db_verify: /var/lib/rpm/Packages: Function not implemented
db_verify: DB->verify: /var/lib/rpm/Packages: Function not implemented

Any further suggestions would be appreciated.

Thank you!

-Matt
Comment 3 Jeff Johnson 2007-04-01 07:04:44 EDT
Could you run a strace with -vv and attach the output here?

I can probably pinpoint what function is not implemented from that.
Comment 4 Matt Thompson 2007-04-02 04:31:26 EDT
Created attachment 151406 [details]
strace -vv from rpmdb_verify on the Packages file

Hi Jeff,

I've attached strace -vv output on an rpmdb_verify Packages.

Thanks,
Matt
Comment 5 Jeff Johnson 2007-04-02 16:05:42 EDT
Did the strace'd rpmdb_verify display the symptom?
    db_verify: unable to initialize mutex: Function not implemented

If so, I'm not seeing in the strace.

I'm also not seeing any NPTL calls.

Here's why, you're using the old, non-NPTL, libpthread:

...
close(3)                                = 0
open("/lib64/libpthread.so.0", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000S\0\0"..., 832) = 832
fstat(3, {st_dev=makedev(8, 5), st_ino=5670736, st_mode=S_IFREG|0755, st_nlink=1, st_uid=0, 
st_gid=0, st_blksize=4096, 
...

The old libpthread does not support the POSIX optional pthread_mutexattr_setpshared()
routine, that's the function that db_verify is whining about.

So that explains what you are seeing.

CHeck your glibc install to make sure that it has +NPTL enabled is what you need to fix.

Again , you won't be happy running rpm (which expects +NPTL) on a -NPTL system, you
can expect frequent occurences of cache inconsistency because of (at least) lack of
interprocess pthread_mutex* locking.

That's what the function pthread_mutexattr_setpshared() provides.
Comment 6 Matt Thompson 2007-04-03 12:00:28 EDT
Hi Jeff,

After reading your last update I ran "getconf GNU_LIBPTHREAD_VERSION" on this
machine and noticed that it was in fact using linuxthreads-0.10 and not NPTL
2.3.4.  Using the information found on http://dag.wieers.com/howto/compatibility
I was able to use NPTL and when I tested installing / removing RPMs via up2date
this did not result the Packages file getting corrupted.  I have since searched
through /etc and found "export LD_ASSUME_KERNEL=2.4.1" hard-coded in
/etc/profile so can now explain why this is happening.

Thanks again for your assistance.  This issue can be resolved.

Regards,
Matt Thompson
Comment 7 Panu Matilainen 2007-08-20 07:19:58 EDT
Closing NOTABUG as per comment #6 (custom, global LD_ASSUME_KERNEL setting
disabling NPTL which rpm requires to function)

Note You need to log in before you can comment on or make changes to this bug.