Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I downloaded pcap source compiled it and got a lib ending in libsomething.so.1.21.1. I tried to find how to install a lib online and in my impatience did the following

sudo .install-sh /lib libsomething.1.21.1

The output was the following

install-sh :250:chmod not found

install-sh : 1: rm :not found

After this I could not launch any program or shell command at the prompt in the terminal(I could use cd but not ls or others). Now when I try to boot into Ubuntu I get a kernel panic after the following line:

run-init:/sbin/init: No such file or directory.

.install-sh is in the pcap folder, source was taken directly from the website.

I don't have a clue as to what the script did, I would be very thankful if somebody could give me any pointers on how to proceed.

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

Ok, what I think happened is that the script moved /lib to libsomething.1.21.1 (in the directory where you were when you ran the script). After that, pretty much nothing worked. Every dynamically linked executable relies on the dynamic loader, which lives in /lib: move that and you're in trouble.

It is possible to recover from moving /lib, but your system is now unbootable. You need to repair it from some other bootable media (a live CD or DVD).

Repairing should be simple, because moving away /lib means there was no opportunity for further damage. Just find which directory you were in and move back /path/to/libsomething.1.21.1 to /lib.

In unix circles, the source almost always comes before the destination, when copying or moving stuff.

For future reference, don't install home-built binaries in /lib. Files in /bin, /lib, /sbin and /usr (except /usr/local) are managed by your distribution. The directory /usr/local is for your own stuff; install your non-packaged libraries in /usr/local/lib, your non-packaged executables in /usr/local/bin and so on.

share|improve this answer
    
Sorry, did not see your response, you are right, the lib folder was moved to folder from where I was trying to install the library.I will try to copy it back and report result. –  AquaAsh Jan 11 '12 at 5:02
    
Thanks, your method worked, I am able to boot into the system and almost everything is working fine, graphics are working, but sound , wifi and other devices etc are not working, any suggestions. Is there a method to extract drivers or packages from CD,( I had like to avoid to boot 10.04 ubuntu from usb) and have them installed to get stuff working properly. –  AquaAsh Jan 11 '12 at 18:20
    
@AquaAsh It looks like you've got /lib back but /lib/modules (which contains the drivers that are not essential to booting) is somehow missing or corrupted. What entries do you see in /lib/modules? What does du -s /lib/modules/* show? The entry corresponding to the kernel you're running (uname -r) should have about 100MB. If the drivers are missing and don't seem to have been moved elsewhere, reinstall the linux-image-… package, something like apt-get --reinstall install linux-image-2.6.32-37-generic. –  Gilles Jan 11 '12 at 18:35
add comment

It sounds like it did an rm -fr, i.e. deleted everything. Boot from some other media and see what's left of the system, if anything.

share|improve this answer
    
I booted from a usb and everything is not deleted, there are files, folders, profiles, even the sbin folder is there, user files etc are also present. –  AquaAsh Jan 9 '12 at 3:52
    
@AquaAsh, and what about /sbin/init? –  psusi Jan 9 '12 at 4:31
    
The init file in sbin is present. Though, I seem to be missing the whole lib folder, what do you recommend. –  AquaAsh Jan 9 '12 at 14:23
    
@AquaAsh, that explains it.. if you wiped out your lib directory then you will need to restore it from backup or reinstall. –  psusi Jan 9 '12 at 19:31
    
I tried copying lib folder from another machine, but it does not seem to work, anyway I am going to install Linux mint and be done with it. Thanks for your help. –  AquaAsh Jan 11 '12 at 4:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.