RPM broken due to accidental deletion of SQLite

2008 Oct 24 at 03:23 » Tagged as :

While trying sort out a recent mishap, I accidentally erased my sqlite rpm with drastic consequences: the  Redhat Package Manager is completely broken. This. This is one top of a complete breakdown of yum. I was trying to fix yum, when I did this foolish act. Sqlite isn't even a package that can be  be removed easily, you need to give the '-e' option to rpm but that's what I did. Now whenever you use any command of the RPM family it tells you that

rpm2cpio: error while loading shared libraries: libsqlite3.so.0: cannot open shared object file: No such file or directory

rpm2cpio is the last ditch effort. I have not used this command before but found a handy tutorial. The only trouble is rpm2cpio itself cannot be executed. Great, now both RPM and YUM are completely broken down. Nothing can be installed except by compiling from source. Fortunatley on linux, there is always more than one way to skin a cat. I worked around the broken rpm2cpio by simply logging into another machine, downloading the sqlite RPM using wget and then using the following command to generate a cpio file:

rpm2cpio sqlite-3.5.6-2.fc9.x86_64.rpm > sqlite.cpio

I then used SCP to download it here and then extracted the file using

cat sqlite.cpio | cpio -idv

By doing these steps, I have managed to manually extract the contents of an rpm - even whilst the rpm binaries themselves are broken and will not execute. The next step is to place the files in their proper folders. For that I used rsync. I thought my troubles would be over then but RPM et al, still protest about a missing libsqlite3.so.0 , sure enough there isn't one in /usr/lib64 - but that can be easily rectified by making a sym link to libsqlite3.so