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
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
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.
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.