Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I accidentally removed libc6 and now every command returns "No such file or directory"

example: "bash: /bin/ls: No such file or directory"

Is there anything that can be done to reinstall libc6?

P.S. apt-get, dpkg return the same error

share|improve this question
up vote 2 down vote accepted

It is possible to recover from a mistake like that without shutting the system down, but it tends to involve deep Unix voodoo. You would need to figure out which commands do still work (these will be the ones that were statically linked when they were compiled) and from those, figure out a way to get another identical copy of libc6 back on the system, in the right place and with the right permissions.

This might involve something like using cat to paste the file into an open session and redirect the output to a file. If you're lucky, some process might still have the file open meaning you could recover it from /proc.

Here's an old tale of someone who did just that.

By far the easiest method will be to shut the system down, physically move the hard drive(s) to another machine, copy an identical libc6 back into the right place, move the hard drive(s) back to the original machine and boot it back up.

share|improve this answer

I'm not very familiar with Ubuntu, but you should be able to boot from the installation media as rescue, and from there reinstall the glibc package. Go check their website (or Debian's) for more detailed instructions.

share|improve this answer

Your Answer


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.