I followed this answer to the question of removing Ubuntu documentation to save space. While the method worked, it has rendered my system somewhat broken. Every now and then when I install some package, it depends on some folder in the documentation existing. Two such apps are:

  1. Virtual Box (error during run -- had to create /usr/share/doc/virtualbox)
  2. PostgreSQL (error during installation -- had to create /usr/share/man/man7)


It took a lot of digging (around 2 days) to find solution to 1. Unfortunately, there was no way to find out which directory was the issue, or even that the existence of the directory was the issue. Fortunately, after 2 days, just before I was about to do a clean install, I came across this post that hinted that removing the documentation could be the problem.

So the solution is not just to "recreate the folder", as one of the comment says, but to find out which folder(s) to recreate, which is not so easy.

2 was easier due to the error printed on console.

For now I would like to get my system back to the "unbroken" stage without having to do a complete reinstall. What is the best way to get documentation back?

  • 1
    A comment under the accepted answer says you should manually recreate those folders removed, did you try that? – George Udosen Jan 27 '17 at 9:14
  • Yes I did try that. In fact that's how I got the above two to work. I'm talking about the general case. In rm -rf /usr/share/man/* /usr/share/groff/* /usr/share/info/*, we don't really know what folders were deleted, unless you are a Linux guru. I have edited the question. – Jus12 Jan 27 '17 at 10:16
  • Boy, just looked at those folders and there's a lot that got removed especially in the /usr/share/info/* – George Udosen Jan 27 '17 at 10:49

The easiest way to regenerate any package-provided file, including documentation, is to reinstall the package.

sudo apt install --reinstall package_name

However, sometimes documentation is provided by a different package:

dpkg -L package_name        // List of files installed by the package
apt depends package_name    // Other dependency packages, including doc packages

If you are unsure which package provided a file, it's easy to look up:

dpkg -S /path/to/file_name

And one tip: The package manager (apt/dpkg) cares about the presence of a file. Never manually remove a file placed by apt/dpkg. However, apt/dpkg cares not a whit for the content of that file. If you really wish, you can easily replace large doc files with tiny dummy files (at your own risk, of course).

sudo rm /path/to/file_name          // Warning: rm cannot be undone!
sudo touch /path/to/file_name

The 'du' command is very useful to determine if the space savings are worthwhile. Undo the substitution by reinstalling the package.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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