27

When running sudo aptitude upgrade, the console freezes for long after almost every package upgrade with a message "Processing triggers for man-db ...". What could be the problem and how can I fix it?

Ubuntu version: 12.04 (both Server and Xubuntu)

Thanks in advance.


Update: It looks like this problem is related to package autofs upon my further tests. Removing autofs resolved the issues. No idea why. I then have to use soft links instead of autofs for my file system to avoid this issue (and other two issues posted here as well).

1
  • I have the same problem, will see if removing autofs helps. Thanks! May 1, 2013 at 8:54

6 Answers 6

18

Might be helpful for someone: I ran into this issue on our CI regularly.

Just execute the following:

sudo apt-get remove -y --purge man-db

The command removes the man-db package completely, which in our case on CI, was completely useless anyway.

2
  • 5
    Hmm, on ubuntu this wanted to remove ubuntu-standard, which seems like a bad idea
    – Kevin
    Mar 13, 2021 at 1:32
  • 1
    @Kevin That is why you should never use the -y flag. I don't understand why so many people use it. Sep 19 at 14:42
14

It's possible the mandb index is corrupted.

check the index and recreate it

sudo mandb -t
rm -rf /var/cache/man
sudo mandb -c
4
  • This is the solution and works. Oct 1, 2020 at 6:33
  • didnt work for me
    – Adeerlike
    Oct 13, 2020 at 21:15
  • 1
    I'm not sure it's necessary to remove the cache prior to invoking mandb with the -c flag. According to the man page: -c, --create By default, mandb will try to update any previously created databases. If a database does not exist, it will create it. This option forces mandb to delete previous databases and re-create them from scratch, and implies --no-purge. This may be necessary if a database becomes corrupt or if a new database storage scheme is introduced in the future.
    – chb
    Oct 18, 2020 at 2:25
  • 1
    For me, the -t/--test action took half an hour. I’d recommend running it in tmux (or any persistent terminal), instead of plain SSH (which might be interrupted). May 28 at 1:54
7

I had something similar just after installing Ubuntu 18.04 on Windows Subsystem for Linux and running update and upgrade: it got stuck at processing triggers for man-db (2.8.3-2). And also later, after running

sudo apt install python3-pip

My solution: I just waited. In the second case even some 15 minutes. I do not know whether this is normal, as I am very new to Linux. But this so people just know another experience if they run into the same problem.

1
  • 1
    The reason this is slow on WSL1 is because of slow I/O on WSL1. It is a known issue. Apr 19, 2020 at 15:49
1

I have had the same problem when I was installing apache web server on my digital ocean droplet. After waited a bit, I simply just stop the process and rerun the command. It shows the apache is already installed and it worked. I hope it can still help.

1

Processing triggers for man-db is I/O bound, and can be painfully slow if you are on a HDD, or Google Cloud's default disk storage tier.

Upgrade your disk

4
  • 4
    this is not a solution
    – Habibillah
    Oct 19, 2021 at 17:09
  • @Habibillah i've edited my response to have a solution
    – Cherona
    Oct 20, 2021 at 15:28
  • I have this problem on a Raspberry Pi with a brand new SD-card.
    – bomben
    Jul 4 at 17:44
  • @bomben SD cards are extremely slow
    – Cherona
    Jul 21 at 14:43
0

Since I sometimes need the man pages.

And since there doesn't seem to be a stand-alone 'man' package, I can't simply remove 'man-db'.

My solution, for better or worse, was to move the 'mandb' executable out of the way and substitute in a copy of 'true'

On my system:

sudo mv /usr/bin/mandb /usr/bin/mandb-OFF
sudo cp -p /bin/true /usr/bin/mandb 
sudo rm -r /var/cache/man

This is easy to undo if the need arises. And I deleted the /var/cach/man directory, as it is no longer needed and recovered megabytes of space.

Any 'man' pages you need are grabbed from the source man directory and decompressed on the fly. No more caching means a slight inefficiency, but with today's speeder processors and disks, its minimal.

A caveat: Anytime you get a man-db package update, your modifications will be overwritten. Either apt-hold the 'man-db' package or be prepared to redo this at the whim of the 'man-db' package maintainers and distribution managers.

After this mod, you will still see the line "Processing triggers for man-db" fly by but it's a zero second thing. :-)

Good Luck.

2
  • Use dpkg-divert to move mandb executable elsewhere. Use update-alternatives to link /bin/true to mandb. Then you don't have to update anything after package upgrade
    – midenok
    Apr 27 at 20:53
  • @midenok : Is the man-db package 'alternatives' aware? IMHO, I don't think so. No mention of alternative checks in its pre/post installation scripts. It looks like any update will simply override any /dev/null or /etc/alternative links in its way. And the 'dpkg-divert' concept tends to blow away the basic Linux KISS, do one thing and do it well principal. I think I'll stay with just dev-nulling or 'true'ing /usr/bin/mandb
    – dave58
    Apr 29 at 3: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.