unbelievably stupid mistake - i broke /usr/lib need help

Alastair McKinley amckinley03 at qub.ac.uk
Fri Jan 6 00:50:05 UTC 2006


Sam Varshavchik wrote:

> You can try installing FC4 on another machine, and copy the librpm .so 
> file from there. You will not be able to do anything, NOTHING, not 
> rpm, not yum, until this is fixed.
>
>But, that's just the beginning.  What you basically have to do:
>
>  
>
> 1) Run "rpm -q -a -l", which is going to spit out every file installed 
> by every package you have supposedly installed. 2) If you're fairly 
> certain that you only broke /usr/lib, grep the file list for 
> "/usr/lib", then hack up a short script to check if each file still 
> exist, and spit out the exact list of missing files.
>
>3)  Use "rpm -q -f" to find out which packages they belong to.
>
>  
>
> 4) Make sure you have these RPMs available, and "rpm -e --force" each 
> one, followed by "rpm -i nodeps" to reinstall it.
>
>5)  Finally run ldconfig.
>
>  
>
> That should fix this, but it's probably easier to just chalk it up to 
> experience, and reinstall. If it's of any consolation, at least you 
> didn't wipe /lib, with the standard C runtime library. That would've 
> been a double-boner (actually, at least a quadruple-boner, on the 
> Richter scale),


Thanks for the advice Sam.  I managed to get the rpms downloaded on to my desktop, extracted them and I kept on replacing dependencies until rpm came alive again.
I'll try something like what you have suggested soon.


> I have a sneaky suspicion that you were trying to either install or 
> uninstall some external software package manually, without building 
> RPMs. That's the only reason I can think for screwing around in 
> /usr/lib, as root. And this is just one of the reasons why you should 
> never install various warez directly, manually, and you should always 
> use rpm. And if the warez doesn't come with a suitable rpm, then build 
> one yourself. The only reason for su-ing to root is to "rpm -i" the 
> freshly-built RPMs.


I feel like I should try and explain myself for this one!  

I was playing around with installing linux on my ipaq.  Its a h2200 and the linux port is nearly finished but not quite there. 
I had the root file system on an SD card mounted at /media/usbdisk1

I needed to wipe the partition and install a new rootfs.  In order to delete files owned by root, I needed to be root.
Something refused to delete in /usr/lib (on my SD card, i.e /media/usbdisk1/usr/lib).

So I'm at /media/usbdisk1 and I meant to type cd ./usr/lib, but I actually typed cd /usr/lib.

And then the final mistake: rm -rf ./*

I wondered for a second why it was taking so long as its a very small root file system.  Then I realised, I hit crtl-c but I was way too late.

I think I've learned my lesson.


Alastair













More information about the fedora-list mailing list