javabiz Posted March 9, 2004 Report Share Posted March 9, 2004 (edited) The only rpm info that I can see is /var/log/rpmpkgs Can this be used for anything? I have tried rpm --rebuilddb with no luck and even rpm --initdb It comes up with a file lock in /var/lib/rpm (but this directory doesn't exist) I have tried a few urpm commands to no avail. Any help would be greatly appreciated! Edited March 9, 2004 by javabiz Quote Link to comment Share on other sites More sharing options...
javabiz Posted March 10, 2004 Author Report Share Posted March 10, 2004 (edited) Still working on this problem and I found a similar situation at the following url. http://www.daylate.com/blog/archives/2003_02.html Below is the jist of what it says: RPM Database Crash It was an interesting weekend. I planned on updating the RPM packages on the system over the weekend using Red-Carpet. However, it indicated there weren't any packages to update, which I knew was wrong. I did some checking and it appeared that my RPM database was corrupted. The solution to that seemed to be running rpm --rebuilddb. That rebuilds the database from the header files stored on the computer. Well...do you know what happens if your headers are also corrupted? You end up with a database of RPM's significantly smaller than you had before. Fortunately for me RedHat outputs to a log file (/var/log/rpmpkgs) the current packages installed. After rebuilding my database I compared it with the log file. The rebuilt database was about 1/5 the size. What this means is my rebuilt database was missing 4/5 of the RPM's I had installed on my system. Everythings was still installed and ran fine but I knew I'd run into dependency problems and such if I ever wanted to update my packages or install a new package. So...basically I was left with the task of rebuilding my entire RPM database. Which, according to the rpmpkgs log file was around 800 packages. WHAT A MESS. However, after a few hours I came up with a pretty slick way to do it. I wrote a simple bash script to read through the rpmpkgs log file, download the package from the RedHat distribution and then add it to the database. Here's the script I used: #!/bin/bash exec < rpmpkgs.1 exec > zoutput.txt while read line do wget ftp://ftp.rpmfind.net/linux/redhat/8.0/en...RPMS/$line rpm -iv --nodeps --justdb --noscripts --force --notriggers $line done I used the rpmfind website instead of ftp.redhat.com cause it seemed to have more bandwidth. Anyway, I let this run over night. Then wrote another script to determine which packages it couldn't find. Basically it was just a script to figure out which files it couldn't find. I stored these in a file called znotfound.txt. Then I used that file as my input file (instead of rpmpkgs.1) and used the same script to scan the Red-Carpet cache of packages I had on my system (I installed all packages in the Red-Carpet cache first). Anyway, here's the script (basically just as simple as the previous): #!/bin/bash exec < znotfound.txt exec > znotfound2.txt while read line do if ! test -e $line then echo $line fi done Basically all this does is check to see if the RPM file exists. After running these scripts I was left with 5 packages that were sill missing. NOT BAD! I can handle installing 5 packages manually, 800 is another thing. After all was said and done I ran rpm -Va to verify the packages installed. Everything looked good. No missing dependencies or conflicts. I think I'll start adding the RPM database directory (/var/lib/rpms) to my backup script. ADDENDUM: I still haven't been able to figure out what caused the corruption in the first place, which has me concerned. We did have a couple power outages recently which sent the machine down hard so maybe that had something to do with it. I dunno...all the more reason to get a server I can colocate at a data center. Unfortunately I can't seem to find a colocation price that is as cheap as just hooking it up to my DSL line :). --------------------------------------------------------So back to my problem: Does anyone out there know of a way to get Mandrake's rpm database back without having to do the script diddies above? Does the urpmi do essentially the same thing--and if so--what's the command to get my database back. I have the same problem as the person above--but with Mandrake and not Red Hat. For those who say--just change the ftp sites--that probably won't work. Is there a simpler way than above to get the same results? All gurus welcome! Edited March 10, 2004 by javabiz Quote Link to comment Share on other sites More sharing options...
scoopy Posted March 10, 2004 Report Share Posted March 10, 2004 Seeing I am not a guru, I thought I would take a stab at this anyway. I would first check to see if your sources are listed and available in "Software Media Manager." You may have just lost your listings to the sources. You can start via cli w/ $ /usr/sbin/edit-urpm-media Quote Link to comment Share on other sites More sharing options...
javabiz Posted March 10, 2004 Author Report Share Posted March 10, 2004 (edited) Okay, mine shows the following: main contrib plf updates and three mirrors I use from the Mandrake Club download site. and a local directory /var/lib/urpmi that isn't working with it's hdlist. This may be the problem. Is there a central hdlist that I'm missing that has all the packages I've installed that needs to be restored. Something like the rpmpkgs list in /var/log? Or do I have to go back in and do what the url in post #2 suggests and restore with scripts? I hope that isn't the case. The other thing is that I can see hdlists for all of the above but how do I use this information to reload if you will my database. I don't see how it could use the info above to do that since it would need my hdlists---I would presume. And where is the original hdlist that I created--I hope- when I did the installation? Hope this turns out to be easier than I think! Oh, one other thing, I created a new /var/lib/rpm and it seems to have put some files in there but all of them lack of any size when one considers I have 1000 + programs installed. Edited March 10, 2004 by javabiz Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.