12

I just managed to overwrite /usr/share/bin

and it doesn't seem like it's possible to undo.

I did this as a root user.

Am I doomed?

  • 1
    No, not doomed. You can easily backup and reinstall. – mikewhatever Nov 17 '18 at 16:32
  • Might not be a bad idea. –  Nov 17 '18 at 16:37
  • 10
    If it helps, I have a pretty clean installation of 18.04 and it does not have a `/usr/share/bin` folder at all. I think you will be fine. – Terrance Nov 17 '18 at 16:53
  • That is reassuring. I was only worried because I'm running as root. –  Nov 17 '18 at 16:54
  • 2
    Hey, doesn't hurt to ask. =) – Terrance Nov 17 '18 at 16:54
  • 2
    It happened to me some time ago to overried `/usr/local/bin`. Still not fatal. Most of the stuff that was there were "ruby gems" (e.g. `fpm`). Anyway they are just user applications so you can continue using your system and when you see a weird error about not finding `/usr/.../bin/application` you know that you have to reinstall it. – Bakuriu Nov 17 '18 at 23:12
  • 1
    Possible duplicate of [How can I recover from deleting the /usr/share/themes directory?](https://askubuntu.com/questions/493637/how-can-i-recover-from-deleting-the-usr-share-themes-directory) – Olorin Nov 18 '18 at 04:13
  • This question has far higher scores than the the "duplicated" question. The answer is also easier to understand. – C.S.Cameron Oct 11 '22 at 06:58

1 Answers1

30

Not doomed at all.

Nothing critical in a Ubuntu Desktop or Ubuntu Server install uses /usr/share/bin.

Run dpkg -S /usr/share/bin to list your installed packages that use dir. Those packages, if any, should be reinstalled.

If the reply is no path found matching pattern, then you indeed have nothing installed that uses the dir.

user535733
  • 58,040
  • 10
  • 106
  • 136
  • It just sends me an error message `dpkg-query: no path found matching pattern /usr/share/bin` –  Nov 17 '18 at 16:37
  • 6
    That would indicate that you have no installed packages referring to the directory. – Charles Green Nov 17 '18 at 17:02
  • 2
    Indeed, this doesn't look like a standard location. – Ruslan Nov 17 '18 at 22:58
  • @Ruslan: I've seen it in the standards before (but it might not be in the current ones); since the only plausible things that could live there are scripts and jitted binaries being empty/non-extant is plausible. – Joshua Nov 18 '18 at 21:04
  • @Joshua given that `/usr` hierarchy is not normally writable, I doubt there could be jitted binaries. I'd rather expect them in `/var/cache` or somewhere else under the `/var` tree. – Ruslan Nov 18 '18 at 21:13
  • @Ruslan: jitted binaries means binaries that run via a jitter, not binaries that are the output of a jitter. – Joshua Nov 18 '18 at 21:15