On Sat, Feb 14, 2004, Emanuel wrote: > Hi, I'm having some problems with rpm. I recently recompiled the 2.6.2 kernel, > and ever since I cant use any rpm commands. I'm not sure if they are related > but it seems that it happened just after the recompile. I've tried deleting the > database and recreating it using 'rpm --initdb' & 'rpm --rebuilddb', no > success. I get the the following error: > > [root@sloth rpm]# rpm --initdb > rpmdb: write: 0xbfffd660, 8192: Invalid argument > error: db4 error(22) from dbenv->open: Invalid argument > error: cannot open Packages index using db3 - Invalid argument (22) This error occurs under a plain kernel.org kernel, because the O_DIRECT feature is fully broken under at least Linux 2.2 and 2.4, and as it looks still in 2.6. It is sometimes accepted by open(2) without error and later causes a write(2) to fail with EINVAL (see your error above) -- all depending on the underlying filesystem (usually works on tmpfs and fails on ext3). The reason why this problem does not occur with RedHat kernel packages is because RedHat have a kernel patch which immediately masks out O_DIRECT in open(2) calls ;-) The problem actually is in Berkeley-DB which assumes that if O_DIRECT exists, it is really useable. The solution in OpenPKG (because we have to get RPM/BDB running on non-RedHat Linux platforms with stock kernel.org kernels, too) is to use O_DIRECT only on platforms where we know it works correctly. See the last patch hunk at http://cvs.openpkg.org/openpkg-src/openpkg/rpm.patch.bugfix for details. > [root@sloth rpm]# rpm --rebuilddb > rpmdb: unable to join the environment > error: db4 error(11) from dbenv->open: Resource temporarily unavailable > error: cannot open Packages index This error occurs if you don't have any RPM DB pre-installed (as RedHat does for you). In this case you're not able to build or rebuild a database from scratch with --rebuilddb. The way we solved it in OpenPKG is to create zero-sized files and allow RPM and Berkeley-DB to gracefully handle this situation in order to correctly bootstrap the RPM DB from scratch. See the patch hunks starting with the annotations "Because permissions and ownership on Berkeley-DB region files" and "Make sure RPM passes DB_CREATE to Berkeley-DB also if file exists" in http://cvs.openpkg.org/openpkg-src/openpkg/rpm.patch.feature for details. > Did I leave some database out in my kernel? I could use anyones help on this. > ~Emanuel Well, creating a reasonable RPM DB from scratch is a little bit more tricky than just having the above patches applied -- at least if you don't stick with what RedHat already provides you. In cross-platform environments it is even more complicated, so for OpenPKG we added the RPM options --db-{init,rebuild,fixate,cleanup} which do a little bit more than RPM's internal --initdb and --rebuilddb: they can really bootstrap from scratch and also cleanly upgrade from RPM 4.0.2 (because that's what we used in OpenPKG 1.x). See the commands in http://cvs.openpkg.org/openpkg-src/openpkg/rpmdb for details how we actually establish a database. I know that you cannot use this out-of-the-box in your situation, but it gives you at least a clue why the whole situation of fiddling yourself with an RPM DB is more complicated that it looks to you. My general recommendation when it comes to any RPM DB issues is (sorry if you don't want to hear it ;-): either stick with an unaltered RedHat (if you are using RHL, RHEL or FC) or OpenPKG (if you are using other Linux or even FreeBSD or Solaris) environment or do yourself a favor and immediately forget fiddling around with the RPM DB yourself. This topic IMHO is definetely not suitable for the average RPM user. Ralf S. Engelschall rse@xxxxxxxxxxxxxxx www.engelschall.com _______________________________________________ Rpm-list mailing list Rpm-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/rpm-list