Seems like we should remember this. It sounds useful.
-- forwarded message -- Path: visp.engelschall.com!lmtp2nntp!not-for-mail From: Jeff Johnson <[EMAIL PROTECTED]> Newsgroups: en.list.rpm-list Subject: Re: How do you fix a corrupt rpm database? Date: Thu, 28 Feb 2002 18:09:33 -0500 Organization: Engelschall Lines: 103 Sender: [EMAIL PROTECTED] Approved: [EMAIL PROTECTED] Message-ID: <[EMAIL PROTECTED]> References: <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] NNTP-Posting-Host: visp.engelschall.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: en4.engelschall.com 1014937843 29575 195.27.176.148 (28 Feb 2002 23:10:43 GMT) X-Complaints-To: [EMAIL PROTECTED] NNTP-Posting-Date: Thu, 28 Feb 2002 23:10:43 +0000 (UTC) Delivered-To: [EMAIL PROTECTED] Delivered-To: [EMAIL PROTECTED] Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <[EMAIL PROTECTED]>; from [EMAIL PROTECTED] on Thu, Feb 28, 2002 at 04:34:05PM -0600 X-Loop: [EMAIL PROTECTED] Errors-To: [EMAIL PROTECTED] X-BeenThere: [EMAIL PROTECTED] X-Mailman-Version: 2.0.1 Precedence: bulk List-Help: <mailto:[EMAIL PROTECTED]?subject=help> List-Post: <mailto:[EMAIL PROTECTED]> List-Subscribe: <https://listman.redhat.com/mailman/listinfo/rpm-list>, <mailto:[EMAIL PROTECTED]?subject=subscribe> List-Id: RPM Package Manager <rpm-list.redhat.com> List-Unsubscribe: <https://listman.redhat.com/mailman/listinfo/rpm-list>, <mailto:[EMAIL PROTECTED]?subject=unsubscribe> List-Archive: <https://listman.redhat.com/mailman/private/rpm-list/> X-Gateway: lmtp2nntp/1.2alpha Xref: visp.engelschall.com en.list.rpm-list:713 On Thu, Feb 28, 2002 at 04:34:05PM -0600, [EMAIL PROTECTED] wrote: > I have a problem using up2date. The rpm database is corrupted. rpm --rebuilddb > fails as does --initdb. When using up2date, I get a number of error that specify > a number of errors by line. > > Is there some tool that can fix this? No single tool, but here's what I do: 0) Make a copy of everything, just in case: cd /var/lib tar czvf /tmp/rpmdb.tar.gz rpm 1) Check /var/lib/rpm/Packages with db_verify. The command is db_verify /var/lib/rpm/Packages If that fails, the fix is cd /var/lib/rpm mv Packages Packages-ORIG db_dump Packages-ORIG | db_load Packages At this point Packages should be OK. 2) Read all Package headers. The command is rpm -qa If that "works", go to step 5), do "rpm --rebuilddb" and you're done. If that segfaults, go to 3). if that hangs, then do rm -f /var/lib/rpm/__db* and try again. 3) You have a segfault on a header. The first step is to get the segfaulting header instance. Append "debug" to the Packages configuration by echo "%_dbi_config_Packages %{_dbi_htconfig} lockdbfd debug" \ >> /etc/rpm/macros Try "rpm -qa", lots of boring glop until segfault. On the screen will be something like ... Get Packages key (0x8216580,4) data (0x4014f008,155244) "#612" 47000000 rc 0kernel-enterprise-2.4.9-26beta.17 Get Packages key ((nil),0) data ((nil),0) "" deadbeef rc -30990 <segfault here> The 2nd to last "Get Packages" line is what you want, the bad header instance above is "612" in decimal. Note the package name-version-release, you'll want to reinstall that package somewhen. 4) Nuke the bad header. I usually whip out my handy-dandy header instance deleter, edit the bad record into the source, compile, run, and go back to step 2). The program is at ftp://people.redhat.com/jbj/t38454.c FWIW, the program is named after the bugzilla report that caused me to write it. Retrieve, and edit the bad header instances into ... int badrecs[] = { --> EDIT --> 562, 566, 559, 561, 563, 560, 564, -1 }; ... Compile with cc -o t38454 t38454.c -ldb-3.2 Run as t38454 Go back to step 2). 5) Clean up. a) rpm --rebuilddb b) rm -f /etc/rpm/macros c) rm -rf /var/lib/rpmrebuild* d) Reinstall the deleted package. Otherwise, give me a bug report at http://bugzilla.redhat.com with a pointer (i.e. URL, bugzilla attachments won't work) to the tarball you created in step 0), and I'll see what I can figger. 73 de Jeff -- Jeff Johnson ARS N3NPQ [EMAIL PROTECTED] ([EMAIL PROTECTED]) Chapel Hill, NC _______________________________________________ Rpm-list mailing list [EMAIL PROTECTED] https://listman.redhat.com/mailman/listinfo/rpm-list -- end of forwarded message -- Ralf S. Engelschall [EMAIL PROTECTED] www.engelschall.com ______________________________________________________________________ The OpenPKG Project www.openpkg.org Developer Communication List [EMAIL PROTECTED]