0

So I wanted to free up disk space from documentation and followed the instructions in this answer. Basically I did create a file /etc/dpkg/dpkg.cfg.d/01_nodoc which specifies the desired filters:

path-exclude /usr/share/doc/*
# we need to keep copyright files for legal reasons
path-include /usr/share/doc/*/copyright
path-exclude /usr/share/man/*
path-exclude /usr/share/groff/*
path-exclude /usr/share/info/*
# lintian stuff is small, but really unnecessary
path-exclude /usr/share/lintian/*
path-exclude /usr/share/linda/*

Then you I manually removed any documentation already installed:

find /usr/share/doc -depth -type f ! -name copyright|xargs rm || true
find /usr/share/doc -empty|xargs rmdir || true
rm -rf /usr/share/groff/* /usr/share/info/*
rm -rf /usr/share/man/* /usr/share/lintian/* /usr/share/linda/* /var/cache/man/*

This freed up space alright but it also deleted my man pages, which I didn't want. I searched and I'm not the only casualty of this. Basically, as the described in the answer in the last link, in order to fix this I tried to remove the lines matching /usr/share/man and /usr/share/groff from /etc/dpkg/dpkg.cfg.d/01_nodoc, then reinstall groff, man-db, manpages. However, it didn't work for me as I still see just an empty man page when I type any man command, for example:

man cp 

and just blank man page (it opens but blank).

I also tried reinstalling the manpages-posix package as suggested in this thread but also doesn't work, still all blank, apparently not a single man page present.

Seems like the system may be broken so any ideas on how can I solve this?

EDIT: Here's my df -h output

S.ficheros     Tamaño Usados  Disp Uso% Montado en
udev             7.8G      0  7.8G   0% /dev
tmpfs            1.6G   1.9M  1.6G   1% /run
/dev/sda1         30G    24G  4.5G  85% /
tmpfs            7.8G   147M  7.7G   2% /dev/shm
tmpfs            5.0M   4.0K  5.0M   1% /run/lock
tmpfs            7.8G      0  7.8G   0% /sys/fs/cgroup
/dev/loop0       4.2M   4.2M     0 100% /snap/gnome-calculator/406
/dev/loop1        90M    90M     0 100% /snap/core/6818
/dev/loop2       3.8M   3.8M     0 100% /snap/gnome-system-monitor/81
/dev/loop4        20M    20M     0 100% /snap/gdoc-html-cleaner/3
/dev/loop3        15M    15M     0 100% /snap/gnome-characters/258
/dev/loop5       1.0M   1.0M     0 100% /snap/gnome-logs/61
/dev/loop6       236M   236M     0 100% /snap/kde-frameworks-5/27
/dev/loop7       896K   896K     0 100% /snap/pomodoro/3
/dev/loop9       152M   152M     0 100% /snap/gnome-3-28-1804/40
/dev/loop8       8.5M   8.5M     0 100% /snap/canonical-livepatch/77
/dev/loop10       54M    54M     0 100% /snap/core18/941
/dev/loop11       36M    36M     0 100% /snap/gtk-common-themes/1198
/dev/loop12      106M   106M     0 100% /snap/shotcut/45
/dev/sda6        426G   336G   69G  84% /home
tmpfs            1.6G    76K  1.6G   1% /run/user/1000
  • Please add output of df -h to the question to get real disk usage info. – N0rbert May 17 at 12:57
1

Your problem looks very similar to Accidentally deleted the “/usr/share” folder, but is easier to solve.

You need to reinstall the corresponding files with

sudo apt-get install --reinstall $(dpkg -S /usr/share/ | sed 's/,//g' | sed 's/: \/usr\/share//g')

(I do not list invidiual directories to keep solution straightforward)

Finally you have to check system integrity with sudo apt-get check and with debsums - sudo apt-get install debsums, followed by sudo debsums --all --changed .

The debsums method should be automated, for example with this long command:

xargs -rd '\n' -a <(sudo debsums -c 2>&1 | cut -d " " -f 4 | sort -u | xargs -rd '\n' -- dpkg -S | cut -d : -f 1 | sort -u) -- sudo apt-get install -f --reinstall --

(formatted as inline code for readabilty)

  • After following your suggestions carefully twice and double checking I still have no man pages. The final debsums --all --changed command output shows an endless stream of "debsums: missing file" and they are all related to documentation as far as I can see, so how to restore them? BTW I edited and added the df -h command output to the question. Thank you in advance for your kind help. – Fermín Franco-Medrano May 22 at 13:55
  • Carefully check output of debsums and reinstall all mentioned packages. Or use script (for example from askubuntu.com/a/397281/66509 ). – N0rbert May 22 at 16:38
  • Finally after using the script included in the link of your last comment, xargs -rd '\n' -a <(sudo debsums -c 2>&1 | cut -d " " -f 4 | sort -u | xargs -rd '\n' -- dpkg -S | cut -d : -f 1 | sort -u) -- sudo apt-get install -f --reinstall -- it worked. It needed to download almost 1GB of packages and install for over an hour (I didn't stay to watch so I can't be sure), so it would have been impossible to install so many missing packages without this kind of script so please add this to your answer or somehow modify it to include this step before I can accept it. Thanks a lot! – Fermín Franco-Medrano May 24 at 11:30
  • It is great that you have solved the problem! I have updated my answer with the COMMAND :) – N0rbert May 24 at 21:12

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.