LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-21-2006, 09:44 AM   #1
jugglingphil
LQ Newbie
 
Registered: Jun 2006
Location: Nottingham, UK
Distribution: RH8, RH9, RHEL
Posts: 5

Rep: Reputation: 0
rpm problems


Hi
I'm running a server (IBM Xseries) with CentOS 4.2.

I suspect (fear) the RPM database is corrupt because "rpm -qa" gives no output and "rpm -q {known installed rpm}" gives package is not installed message.

I can not install/upgrade any rpms as it fails on all dependencies. Other than the rpm problem the server seams to be functioning correctly.

Is there anyway of resolving rpm issue, without needing a reinstall?

Thanks
 
Old 08-21-2006, 10:19 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Make a backup of /var/lib/rpm the "rpm --rebuilddb" to try and rebuild the database.
 
Old 08-21-2006, 10:41 AM   #3
jugglingphil
LQ Newbie
 
Registered: Jun 2006
Location: Nottingham, UK
Distribution: RH8, RH9, RHEL
Posts: 5

Original Poster
Rep: Reputation: 0
Have backed up directory and run "rpm --rebuilddb", the file __db.003 changes but I still get no output from rpm -q commands
 
Old 08-21-2006, 12:25 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
file __db.003 changes
You should always "rm -f /var/lib/rpm/__db.00?" before any rpm ops.


but I still get no output from rpm -q commands
Luckily you made backups?

Can you retrace steps leading up to the rpmdb corruption?
 
Old 08-22-2006, 03:02 AM   #5
jugglingphil
LQ Newbie
 
Registered: Jun 2006
Location: Nottingham, UK
Distribution: RH8, RH9, RHEL
Posts: 5

Original Poster
Rep: Reputation: 0
I'm not sure what has caused to corruption. Only noticed when trying to install a new rpm.

I have deleted the __db.00? files and run rpmbuilddb this finishes almost instantly and creates a new __db.003 file.

rpm -qa still displays no output
 
Old 08-22-2006, 07:49 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
rpmbuilddb this finishes almost instantly
Not good. Copy backup over /var/lib/rpm, delete __db.00? files then run again with (a couple of) -v's and redirect output to file add "2>&1|tee logfile". Luckily you made backups? Else if you still have /var/log/rpmpkgs or equivalent then we could --initdb and then add all with --justdb and be done with it.
 
Old 08-23-2006, 05:57 AM   #7
jugglingphil
LQ Newbie
 
Registered: Jun 2006
Location: Nottingham, UK
Distribution: RH8, RH9, RHEL
Posts: 5

Original Poster
Rep: Reputation: 0
Thanks for your continued help.

I don't have a backup or the /var/lib/rpm dir prior to problems!
rpmpkgs is empty but if I install rpm with nodeps (a package that is already installed) it appears in this file. rpmpkgs.1 .2 .3 .4 contain a list of the packages installed and are all identical.

So if I run "rpm --initdb --justdb" do I need to remove the __db.00? files, do I need to do anything with the rpmpkgs files?
 
Old 08-23-2006, 06:41 AM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
BTW, did "logfile" contain anything useful?

rpmpkgs.1 .2 .3 .4 contain a list of the packages installed and are all identical.
Then check rpmpkgs.1.gz if there are no obvious rpm's missing. After that make all installed rpm's available either on disk in one directory or on removable media. Then test this:
Code:
#!/bin/sh -
zcat /var/log/rpmpkgs.1.gz|while read rpm; do
find /some/dir/ -maxdepth 5 -type f -name "$rpm"|while read rpmf
/bin/rpm --install --noscripts --nodeps --notriggers --justdb  --test "$rpmf" >/dev/null
done; done; exit 0
Do note:
- Since I don't know where you will have those rpm's I used "find" which inarguably makes the script much slower.
- You will have to replace the "/var/log/rpmpkgs.1.gz" placeholder for the report that has the most complete record of rpms installed.
- You will have to replace the "/some/dir/" placeholder for the directory the rpm's reside in or mountpoint. If you insist on using a mountpoint then you will encounter an error when the rpm cannot be found on that disk. In that case you'll just have to run the script for each of the other disks.
- Output goes to the bitbucket, so "tee" output to a logfile to be able to resolve errors later on.

When the run finishes w/o significant problems remove the "--test" flag and run for real. As always: YMMV(VM)
 
Old 09-13-2006, 10:26 PM   #9
Niceman2005
Member
 
Registered: Nov 2004
Distribution: Fedora Core 2
Posts: 330

Rep: Reputation: 30
Hi...

May I know if the problem has been resolved...? I experienced exactly the same problem...unluckily on my mail server..I have searched through the internet couldnt find anyone else facing the same problem....Thanks Mr Uspawn for directing me to this thread...

I still have the /var/lib/rpm backup, but the content is somehow weird, inside the rpm folder there are only these:

Basenames __db.001 __db.002 __db.003 Name Packages Providename Pubkeys

seems liek many things are missing....

Stess~ even the way it happened was exactly mysterious like what happened to jugglingphil....it happened when i tried to uninstall the clamav and install again...just a normal operation....

please help if possible....thanks ....for taking time reading my thread ...

Regards
Y
 
Old 10-04-2006, 03:07 AM   #10
jugglingphil
LQ Newbie
 
Registered: Jun 2006
Location: Nottingham, UK
Distribution: RH8, RH9, RHEL
Posts: 5

Original Poster
Rep: Reputation: 0
Hi
At the moment I'm unsure as the server is Live at a customer site. I'm due to replace the servers shortly, then I'll be able bring the problem server back to my office and amend the server with confidence.

I'm not sure what triggered the situation, but it sounds strange that un-installing and installing clam could do it (something a lot of us do frequently).

Hopefully I'll be able to undate next week, sorry if this isn't soon enough.

JugglingPhil
 
  


Reply



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
'rpm' problems. Devyn Linux - Software 2 01-02-2006 08:38 PM
RPM Problems OrdinaryGuy Linux - Software 7 11-28-2003 08:12 PM
Problems with RPM Lespuff Linux - Newbie 4 11-23-2003 04:15 AM
problems with rpm talkinggoat Linux - Software 2 10-12-2003 10:02 PM
RPM Problems!! InSane103 Linux - Software 3 07-11-2003 10:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:47 AM.

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