1

I accidentally deleted the /usr/bin directory. Using a bootable usb, is it possible to rescue my machine?

1

This is possible, but you might be better off re-installing. If you want to try, I would first try to copy enough of dpkg to your filesystem that dpkg will run. There are a bunch of files from dpkg that are in /usr/bin/. Copy those in. For convenience, the list is

/usr/bin/dpkg-trigger
/usr/bin/dpkg-deb
/usr/bin/dpkg
/usr/bin/dpkg-query
/usr/bin/dpkg-split
/usr/bin/dpkg-maintscript-helper
/usr/bin/dpkg-divert
/usr/bin/update-alternatives
/usr/bin/dpkg-statoverride

Then you can download debs to the system, to, first, reinstall dpkg, and then reinstall apt. apt and dpkg don't seem to depend on other stuff in /usr/bin, so they might run. Once you have dpkg working, you can get a list of packages you have installed (using, e.g. dpkg -l), and then run apt to reinstall them. A detailed recipe would be hard without actually trying it.

If you do decide to go that route, post comments here if you run into problems.

  • I just ended up reinstalling after copying over as many files as possible with dd. Thanks for the answer, though! When I inevitably screwup again, I'll be back. – NecroTechno Mar 12 '14 at 22:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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