9

Specifically on a raspberry pi (running Raspbian Wheezy), but also in general, can I disable all man pages?

This would mean no stored man pages, no "processing triggers for man-db", and so on and so forth. With the manual pages always available on the internet, I don't really need them installed, and generating and storing them seems unnecessary.

  • I'm afraid you're probably stuck as far as the manpages themselves go -- they're part of the debs of the software they go with. – Shadur May 11 '14 at 7:39
  • 6
    Surely there are better candidates for space saving than man pages? – jasonwryan May 11 '14 at 7:43
  • I could imagine a configuration of a packaging tool to drop all files marked as docs and/or files matching a regex. I'm not aware of implemenations of this concept, though. – Pavel Šimerda May 11 '14 at 21:16
  • You'd only save, what, 1% of space (probably less in fact)? Probably a little more if you also suppress /usr/share/doc. – Gilles May 11 '14 at 22:59
12

I was having the opposite problem on a Debian 8 image which somebody had put together for a Wandboard. I was trying to find the manual page for some packages which were already installed and noticed that after installing some new ones, the manual pages were missing, even though they were present in the deb file.

I then found this file 01_nodoc in /etc/dpkg/dpkg.conf.d, which is a simple solution to the original question on how to save space by deleting manual pages and locales and copyright files where space is at a premium (eg embedded systems).

# /etc/dpkg/dpkg.conf.d/01_nodoc

# Delete locales
path-exclude=/usr/share/locale/*

# Delete man pages
path-exclude=/usr/share/man/*

# Delete docs
path-exclude=/usr/share/doc/*
path-include=/usr/share/doc/*/copyright
6

The issue is that the package management system expects the files it installs (including man pages) to remain there, so whatever mechanism you use to remove them (except rebuilding every package as HalosGhost suggests) is going to confuse it.

If what you are doing is to produce a single-purpose appliance, one approach you could take is to have separate build and deploy steps for the appliance. That is, you install all the packages you want in a separate build environment (a different SD card, or an emulated RPi), and then copy only what you want to have in production from the build environment to the production environment. At that stage, you can leave out man pages and anything else that isn't needed in production.

In order to pick up upgraded OS or security fixes, you upgrade or rebuild the build environment and copy (or rsync) to production again.

That's a bit more work, but it gives you a very controlled production device, compared to logging on and running upgrades directly on it.

5

Well, not knowing what distro your RPi is running, I cannot help you with the exact commands, but you can probably remove the man-db package which provides both the man utility and a variety of man pages. However, removing all man pages would require removing each man page from each package—I cannot imagine that this is worth your time just to save KiBs of space.

If you really wanted to, then you would need to rebuild each package; on a distro like Archlinux or Gentoo, this is not necessarily impossible, but is still quite tedious. On other less "hands-on" distros, you may find this task incredibly difficult.

  • 2
    apt-get remove --purge man-db will also uninstall debhelper is that not needed? – rubo77 Jan 22 '15 at 4:29
4
$ cat /etc/apt/apt.conf.d/90debsums 
DPkg::Post-Invoke { "if [ -x /usr/bin/debsums ]; then /usr/bin/debsums --generate=nocheck -sp /var/cache/apt/archives; fi"; };

The Package debsums installs an action to generate md5sum lists for packages automatically after a package is installed without already having an own md5sums file..

You could add a similar post install action scanning for and removing the manpages (and info documents) after each install action.

To get the manpages and the owning packages, you need to scan thru all /var/lib/dpkg/info/PACKAGENAME.list files.

You should update the *.list files not to mention the removed manpages any longer too.

localepurge partially does this too. Quoted from apt-cache show localepurge:

This is a script to recover disk space wasted for unneeded locales, Gnome/KDE localizations and localized man pages. Depending on the installation, it is possible to save some 200, 300, or even more mega bytes of disk space dedicated for localization you will most probably never have any use for. It is run automagically upon completion of any apt installation actions.

The most important quote:

Please definitely do abstain from reporting any such bugs blaming localepurge if you break your system by using it. If you don't know what you are doing and can't handle any resulting breakage on your own then please simply don't use this package.

;-D

So just make a full backup and try to write your manpagekiller...

  • 1
    This is the solution I had in mind too (that, plus don't install man-db). I'd add the post-invoke hook via /etc/dpkg.cfg.d rather than via APT, to handle direct invocations of dpkg. – Gilles May 11 '14 at 22:44
  • Fine! As a per package (per .deb) action of dpkg it even will be easier than as post install action of apt because you'll have the package name and do not need to scan all *.list files for manpages again and again. I just forgot that dpkg has sich a hook too... – yeti May 12 '14 at 1:10
  • Hmmm... but handling packages being installed earlier than this handler still will require scanning the *.list files. Nevertheless the dpkg post-invoke hook is the better place to trigger that action. – yeti May 12 '14 at 1:20

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.