0

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

2 Answers 2

2

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.

1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .