0

I removed libc6 and now server is broken.

Now no commands work. ls, df nothing but I'm still connected to it on the ssh session. Any help?

user
  • 3
  • 1

2 Answers2

1

You just found out that removing libc6 is a bad idea. Basically nothing will work, except for statically linked programs and programs that are already running.

You may be able to use scp to copy the library to the correct position.

If you can't recreate the library with the available programs, you have to boot a live system from another source and reinstall libc6.

RalfFriedl
  • 3,108
  • 4
  • 13
  • 17
  • I cannot chroot when using a live dvd either. Error "chroot: failed to run command `/bin/bash`: No such file or directory. But I the `/bin/bash` exists under /mnt/bin/bash ". The command I ran was `sudo chroot /mnt`. I guess if this worked, then I could install the package – user Aug 15 '18 at 08:30
  • Of course you cannot chroot before you reinstall the libc. – RalfFriedl Aug 15 '18 at 08:49
  • How do I reinstall libc without chroot when using live dvd? Is there any other way that I'm not aware of? – user Aug 15 '18 at 09:07
  • The problem is you are missing library files. Do `ldd /bin/bash` on your live CD. it will list the paths of several libraries. For each of these, copy them to the corresponding location in your system below /mnt, but only if it is missing. Then you should be able to chroot into your system, probably even be able to boot. – RalfFriedl Aug 15 '18 at 09:10
  • That helped. I was able to boot into OS after I linked the libs. I even rsycned lib from another debian. Thanks – user Aug 16 '18 at 05:53
0

You could copy the package from your iso or dvd to your machine using scp with another computer, I guess (?) Then use dpkg -i to install the package again.

EDIT: Pretty sure you're not the only one who came accross this problem, have you done any research before asking ?

Vex -
  • 13
  • 1
  • 6
  • how could I? I rebooted the host and it won't even boot to shell. Kernel panic – user Aug 14 '18 at 12:44
  • You said you had a ssh session still running, I assumed you had two machine so you could get the package on the machine you ssh from and past it on the server with scp. Have you also checked the link posted by `Gerald Schneider`? – Vex - Aug 14 '18 at 12:46
  • ssh session had no commands working. it was useless. Can't even ls. Is it possible to find the DVD ISO and boot into live DVD and then mount the root partition and install package onto that root partition? – user Aug 14 '18 at 12:49
  • https://serverfault.com/questions/519664/accidentally-deleted-symlink-libc-so-6-in-centos-6-4-how-to-get-sudo-privilege The answer suggest to use a live DVD to get the package again, have you followed this answer ? – Vex - Aug 14 '18 at 12:50