Bug 199065

Summary: RPM database corrupted
Product: [Fedora] Fedora Reporter: Jan Kovats <johnny.d>
Component: rpmAssignee: Paul Nasrat <nobody+pnasrat>
Status: CLOSED WORKSFORME QA Contact: Mike McLean <mikem>
Severity: medium Docs Contact:
Priority: medium    
Version: 5CC: vanmeeuwen+fedora
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-07-24 02:01:25 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jan Kovats 2006-07-16 20:57:03 UTC
Description of problem:
The rpm Database doesn't seem to work anymore on my computer. It worked fine
and then suddenly without me fiddeling me with it yum didn't work anymore..
i coulnd't update anything. and when i try to install an rpm manually it says 
/bin/bash is missing, wich is rediculous.. i noticed that any package i ask rpm
about doesn't exist. Even  rpm -qv kernel says "Package not found" and i tried
rpm --initdb
and
rpm --rebuilddb
didn't do any good..
 /usr/lib/rpm/rpmdb_verify found /var/lib/rpm/Packages consistent

I expected some update did it.. 

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

RPM, Version 4.4.2

How reproducible:

No clue
  
Actual results:

__db.001  __db.002  __db.003  Name  Packages

Expected results:

 -rw-r--r-- 1 root root  5357568 Jul 16 22:08 Basenames
 -rw-r--r-- 1 root root    12288 Jul 16 22:08 Conflictname
 -rw-r--r-- 1 root root   983040 Jul 16 22:08 Dirnames
 -rw-r--r-- 1 root root  5251072 Jul 16 22:08 Filemd5s
 -rw-r--r-- 1 root root    32768 Jul 16 22:08 Group
 -rw-r--r-- 1 root root    20480 Jul 16 22:08 Installtid
 -rw-r--r-- 1 root root    49152 Jul 16 22:08 Name
 -rw-r--r-- 1 rpm  rpm  29380608 Jun 24 14:08 Packages
 -rw-r--r-- 1 root root   335872 Jul 16 22:08 Providename
 -rw-r--r-- 1 root root    94208 Jul 16 22:08 Provideversion
 -rw-r--r-- 1 root root    12288 Jul 16 22:07 Pubkeys
 -rw-r--r-- 1 root root   385024 Jul 16 22:08 Requirename
 -rw-r--r-- 1 root root   188416 Jul 16 22:08 Requireversion
 -rw-r--r-- 1 root root    81920 Jul 16 22:08 Sha1header
 -rw-r--r-- 1 root root    45056 Jul 16 22:08 Sigmd5
 -rw-r--r-- 1 root root    12288 Jul 16 22:08 Triggername

Additional info:

D: rebuilding database /var/lib/rpm into /var/lib/rpmrebuilddb.5670
D: creating directory /var/lib/rpmrebuilddb.5670
D: opening old database with dbapi 3
D: opening  db environment /var/lib/rpm/Packages joinenv
D: opening  db index       /var/lib/rpm/Packages rdonly mode=0x0
D: locked   db index       /var/lib/rpm/Packages
D: opening new database with dbapi 3
D: opening  db environment /var/lib/rpmrebuilddb.5670/Packages create:mpool
D: opening  db index       /var/lib/rpmrebuilddb.5670/Packages create mode=0x42
D: closed   db index       /var/lib/rpm/Packages
D: closed   db environment /var/lib/rpm/Packages
D: closed   db index       /var/lib/rpmrebuilddb.5670/Packages
D: closed   db environment /var/lib/rpmrebuilddb.5670/Packages
D: removing directory /var/lib/rpmrebuilddb.5670
D: May free Score board((nil))

Comment 1 Jeroen van Meeuwen 2006-07-16 21:12:25 UTC
I've tried to assist this user with solving the issue, and I may have some
additional information.

After we found the rpm utility unable to find any packages (rpm -qv kernel, or
rpm -qv bash), we tested the /var/lib/rpm/Packages file for consistency with
/usr/lib/rpm/rpmdb_verify.

As it appeared to be consistent, we removed every single file from /var/lib/rpm
except Packages, and let the RPM database be initialized (rpm --initdb), and
rebuild (rpm -vv --rebuilddb). As these commands do complete without any
complaint, but do not recreate the files in /var/lib/rpm nor
/var/lib/rpmrebuild.*, we except something goes wrong.

When setting the German language (de_DE.UTF-8), the rpm -vv --rebuilddb shows
the following:

D: Baue Datenbank /var/lib/rpm in /var/lib/rpmrebuilddb.5656 neu
D: Erstelle Verzeichnis /var/lib/rpmrebuilddb.5656
D: Ãâffne alte Datenbank mit dbapi 3
D: Offene   DB-Umgebung    /var/lib/rpm/Packages joinenv
D: Ãâffne    DB-Index       /var/lib/rpm/Packages rdonly Mode=0x0
D: Gesperrter  DB-Index    /var/lib/rpm/Packages
D: Ãâffne neue Datenbank mit dbapi 3
D: Offene   DB-Umgebung    /var/lib/rpmrebuilddb.5656/Packages create:mpool
D: Ãâffne    DB-Index       /var/lib/rpmrebuilddb.5656/Packages create Mode=0x42
D: Closed   DB-Index       /var/lib/rpm/Packages
Speicherzugriffsfehler

The last message means "Memory access error" in english.

Comment 2 Paul Nasrat 2006-07-17 17:02:56 UTC
Please run memtest86+ on your machine and see how that works.  Also try copying
the /var/lib/rpm/Packages  to another machine (eg to /tmp/otherdb) and do rpm
--dbpath /tmp/otherdb/ -q bash.

Comment 3 Jan Kovats 2006-07-18 13:35:36 UTC
(In reply to comment #2)
> Please run memtest86+ on your machine and see how that works.  Also try copying
> the /var/lib/rpm/Packages  to another machine (eg to /tmp/otherdb) and do rpm
> --dbpath /tmp/otherdb/ -q bash.

Ok, the memtest86+ found no errors whatsoever. And when i try Packages like you
sugested on another computer it gives me the same.. Bash not installed. Although
when i just run rpm -q bash on this computer he finds it.. both fedora core 5.

Comment 4 Jan Kovats 2006-07-21 23:28:52 UTC
Ok since this seemed to go no where, and i couldn't install anything or update
.. well anything conserning rpm i tried updating with a re-spin from the fedora
unity project. this rewrote my rpm database so it seems.. lost all package
information but it works again. And it slowely rewrites itself if i just install
the same stuff as before.. so over time i will have my full package db again.
thanks to kanarip for his help and paul for trieng.

Comment 5 Jeff Johnson 2006-07-24 02:01:25 UTC
This problem appears resolved.