In Ubuntu 16.04, I ran by mistake sudo rm -rf /usr/share. I know how stupid that is (I wanted to remove /usr/share/somefolder that had been installed as root and got distracted). I interrupted it after about 5 seconds. I can already see some strange things: some text is not displaying on askubuntu.SE in firefox, when I open a terminal I get /etc/zsh/zshrc:111: compinit: function definition file not found, autocompletion returns an error, etc.

My question is: what should I do now?

Edit I install debsums and followed the steps in this answer to Is there a Ubuntu sanity check?. With the command sudo debsums -cs, I could see that a lot of things where broken. However, I could not fix that other than by reinstalling (see my more detailed answer).

  • Many critical system files are (were) in /usr/share. A simple method is to boot from a LiveUSB, backup your data, and then reinstall. – user535733 Jan 10 '18 at 17:17
  • I've reopened your post. Sorry for the wait. – Seth Jan 15 '18 at 17:05
  • @Seth Thank you. I must say I was very surprised, but all is good now. – anderstood Jan 15 '18 at 19:07

Well boot Linux from USB drive and try extundelete Tool is for recovering deleted files from unmounted partition to mounted one.

$ extundelete /dev/sdaX --restore-all


$ extundelete /dev/sdaX --restore-directory /path/to/dir

For more info about extundelete check: http://extundelete.sourceforge.net/


What I finally did was to reinstall Ubuntu without formatting the partition, so that all my documents and some programs were preserved.

  1. Backup data
  2. Boot on live USB (actually I used a Linux Mint 18.3)
  3. In the destination prompt, choose "other choices" (or something similar) and select the partition with the faulty Ubuntu
  4. Select / as mount point (I don't know if that is required)
  5. Finalise the installation

This way I now have a clean installation with all my previous documents, settings, etc.

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.