1

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

2 Answers2

0

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

OR

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

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

Petr
  • 408
0

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.