Accidently Deleted /usr/lib/*.so.*
While I was installing MRTG, by mistake I have deleted /usr/lib/*.so.*
and /usr/lib/*.so
I am now unable to boot-up my system now, it gets stuck at the splash screen and when I press PAGEDOWN button I can see there are several things which are failing to load.
However, DHCP and WebMin are running and from Webmin I can see the system logs which tells me that cups is not loading because libpipeline.so.1
Is missing and several others.
My computer is running 11.04
You can spend a week finding everything that's missing or you can spend an hour just doing a reinstall from CD and then getting all your old packages back.
I'd suggest you boot into a LiveCD environment first to get backups of things first (copy them to an external USB drive, or another partition) and then start again.
Since you've only deleted /usr/lib/*
and not /lib/*
, you can probably recover. I think all the programs you critically need to recover your system only use libraries from /usr/lib
.
Boot to a text login prompt. If the normal boot doesn't give you a login:
prompt in text mode, boot with only minimum services. Press and hold Shift when your computer starts to show the Grub prompt; you need to press the key after the BIOS has initialized the keyboard but before Grub is loaded, which on some machines leaves only a small time window and may require several attemps. At the Grub prompt, press Down to highlight the single-user mode boot entry and boot that.
Once you have a command line, run apt-get --reinstall install PACKAGE1 PACKAGE2 …
to reinstall the packages that have files in /usr/lib
. You can run this shell snippet to get the list of names of packages to reinstall:
egrep -l '/usr/lib/[^/]*\.so\.' /var/lib/dpkg/info/a*.list |
sed -e 's!^/var/lib/dpkg/info/!!' -e 's!\.list$!!'
Some package installation scripts may require libraries from other packages to be present, so you may need to run the reinstallations in a particular order. If you find that a package's installation scripts are trying to use a particular program, you can find out which libraries this program needs with ldd
. For example, this indicates that python is missing three libraries that you need to reinstall:
$ ldd /usr/bin/python | grep 'not found'
libssl.so.0.9.8 => not found
libcrypto.so.0.9.8 => not found
libz.so.1 => not found
dpkg -S /usr/lib/libz.so.1
reveals that this file comes from zlib1g
, and so on.
If you find that apt-get
is unable to download packages, first download a few key packages from a live CD. zlib1g
and libssl0.9.8
are two packages you're very likely to need early on.
/usr/lib
contained the shared libraries of, frankly, everything except startup-critical software (that's what goes into /lib/
and stuff you didn't install via the package manager (usually /usr/local/lib
).
Short version, you just hosed your system.
Now, if you still have /var/cache/apt/archives
full of stuff, with a little judicious magickery you might be able to salvage the situation.
Check if it still contains archives of for the following packages:
libxapian
libsigc++
apt
libcwidget
libsqlite
libboost-iostreams
Those packages contain libraries in /usr/lib
that aptitude
requires to work If you can find the packages in /var/cache/apt/archives
you can reinstall them manually with dpkg -i <packagename
, and once they're all installed, aptitude should be able to run.
Then by running the command aptitude reinstall ~i
you'll force a reinstall of every package that was already installed, which hopefully should restore your system. I can't make absolute guarantees because the damage you did is really quite spectacular in this case...
I'd be tempted to boot from a Ubuntu 11.04 live-CD and attempt to copy the missing files back.
Before doing anything, check you have good backups of any user-generated data files. If not, I'd boot a live-CD mount the HDD read-only and make backups ASAP.