Star Hype News.

Premium celebrity moments with standout appeal.

news

How to reinstall man pages after deleting them

By Sophia Hammond

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
1

1 Answer

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)

4

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy