LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 10-21-2004, 02:33 AM   #1
Janneman
Member
 
Registered: May 2004
Distribution: Fedora Core 6
Posts: 36

Rep: Reputation: 15
I lost my rpm database


I lost my rpm database (RH 7.1). (Don't ask me how that happened, because I will lie about it.)
Is there any simple program (a shell program, or maybe in Perl) to regenerate it?
updatedb doesn't work.

All the files in /var/lib/rpm are still there, but I get error messages from rpm like:

error: cannot get exclusive lock on /var/lib/rpm/Packages
error: cannot open Packages index using db3 - Operation not permitted (1)
error: cannot open Packages database in /var/lib/rpm

Is there any place on the web where I can find all previous versions that were ever made of any libraries/packages?

Can different versions of the same library be installed side by side? Sometimes I need a certain version of a library to install some software. Some other software needs an older version. Of this other software there may not be any newer version yet that uses the newest version of the library. Can yum sort this out?

Janneman.

Last edited by Janneman; 10-21-2004 at 02:51 AM.
 
Old 10-21-2004, 09:48 AM   #2
NVRAM
LQ Newbie
 
Registered: Oct 2004
Location: Western USA
Distribution: Fedora,Suse,Redhat,Puppy,etc.
Posts: 13

Rep: Reputation: 1
Re: I lost my rpm database

Quote:
I lost my rpm database (RH 7.1). (Don't ask me how that happened, because I will lie about it.)
Is there any simple program (a shell program, or maybe in Perl) to regenerate it?
updatedb doesn't work.
No need to lie - it's happened to me multiple times, and more than once with no fault of my own.

And the program is rpm --rebuilddb.

Quote:
Ierror: cannot get exclusive lock on /var/lib/rpm/Packages
error: cannot open Packages index using db3 - Operation not permitted (1)
error: cannot open Packages database in /var/lib/rpm
The lock error indicates that you probably have an version of rpm running, use killall -v -0 rpm rpmbuild to find the process ID, then use ps -fp pid to determine the pty/tty where it's running and try to kill it (easily at first: INT, HUP, TERM, QUIT, KILL).

But likely the database content is hosed. What has worked for me (and YMMV) is to remove/rename the /var/lib/rpm/Packages file, then run rpm --rebuilddb -- which should run fairly fast (I don't remember, but a small number of minutes, certainly not for hours).

Good luck,
NVRAM
 
Old 10-21-2004, 10:15 AM   #3
Janneman
Member
 
Registered: May 2004
Distribution: Fedora Core 6
Posts: 36

Original Poster
Rep: Reputation: 15
Thanks, but with rpm --rebuilddb I get the message:

error: cannot open Packages index

and with rpm -qa:

error: cannot open Packages index using db3 - No such file or directory (2)

Janneman.
 
Old 10-21-2004, 01:00 PM   #4
NVRAM
LQ Newbie
 
Registered: Oct 2004
Location: Western USA
Distribution: Fedora,Suse,Redhat,Puppy,etc.
Posts: 13

Rep: Reputation: 1
Quote:
Thanks, but with rpm --rebuilddb I get the message:
error: cannot open Packages index

and with rpm -qa:
error: cannot open Packages index using db3 - No such file or directory (2)
Hmm, similar results here on a healthy system (after backup!).

Using rpm --initdb alleviates the errors, but after that rpm --rebuilddb doesn't do much, either. Perhaps it wasn't the "Packages" file that I renamed? I simply cannot remember, it was months ago. Sorry I can't help -- I remember my level of frustration when it's happened.

If I remember, I'll scan my history stack on the system where I last had this problem, but I wouldn't bet on any results, though.
 
Old 10-21-2004, 04:03 PM   #5
misc
Senior Member
 
Registered: Apr 2003
Distribution: Red Hat + Fedora
Posts: 1,084

Rep: Reputation: 54
Not trivial. Especially not, because you didn't add enough details. E.g. what is left in /var/lib/rpm?

Did Red Hat Linux 7.1 have /var/log/rpmpkgs already? (I don't remember) -- In case it does, save a copy of that file, because it contains a list of the packages which were found in your RPM database the previous night. Using that list, one can recreate the RPM database by reinstalling all the packages with options --justdb --noscripts --notriggers after initializing a new and empty database. In case you don't have that list, don't hope that you can recreate the database without having a backup.
 
Old 10-22-2004, 06:02 AM   #6
Janneman
Member
 
Registered: May 2004
Distribution: Fedora Core 6
Posts: 36

Original Poster
Rep: Reputation: 15
rpm core dump

When I try to install something with rpm, I get a core dump,e.g.:

rpm -ivh --justdb --noscripts --notriggers /mnt/cdrom/RedHat/RPMS/glibc-common-2.2.2-10.i386.rpm
Preparing... ########################################### [100%]
Segmentation fault (core dumped)

yum won't work because I have an empty database.
Can I download an rpm database from anywhere which contains the basic RH 7.1 packages and try to work from that?

It must be possible to figure out what's installed without this stupid database, mustn't it?

Janneman.

Last edited by Janneman; 10-22-2004 at 06:22 AM.
 
Old 12-15-2004, 12:46 PM   #7
adm
LQ Newbie
 
Registered: Dec 2004
Posts: 1

Rep: Reputation: 0
RE: I lost my rpm database

I also had this issue after I "torqued" my dbase file. I was able to re-create the Packages file after removing /var/lib/rpm/Packages; recreating an empty dbase with rpm --initdb. Then using the rpm command suggested with the packages listed in /var/log/rpmpkgs, but adding the --nodeps flag.

It took me a couple tries to get everything back. Once yum was back on line, I was able to check my rpm list against "yum install"

Thanks!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I lost my urpmi database...how to restore it ? riccisit Mandriva 14 01-22-2006 03:14 AM
I lost my rpm database Janneman Red Hat 1 10-24-2004 05:13 AM
RPM database, help! Thetargos Fedora 2 07-30-2004 05:47 PM
RH rpm database gfyspf Red Hat 1 09-17-2003 10:39 AM
Had to restore database from backup - about 5 minutes lost jeremy LQ Suggestions & Feedback 0 01-21-2001 10:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 03:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration