How to Fix Failed to Start Update man-db Database in Ubuntu

During package management operations with APT or reviewing systemd startup logs via systemctl --failed, Ubuntu administrators frequently observe a failed service unit: man-db.service or Failed to start Update man-db database. While manual pages might appear incidental on headless cloud servers, a failing man-db service can stall background package triggers, delay boots, and generate recurrent cron failure notifications.

Why Does the man-db Service Fail in Ubuntu?

The man-db.service unit triggers the mandb indexing binary to catalog manual page documentation installed by newly added Debian packages. Common failure causes include:

  • Corrupted Manual Index Cache: An interrupted package installation or hard reboot leaving /var/cache/man/index.db in an invalid or half-written state.
  • Stale Lock Files: Lingering lock files inside /var/cache/man/ preventing the indexing process from securing exclusive write access.
  • File Permission Degradation: The man user or group lacking ownership of the /var/cache/man directory structure.
  • Low System Memory or Inode Exhaustion: Small virtual machines exhausting available memory or file inodes during intensive index hashing.

1. Inspect Detailed systemd Service Failure Logs

Begin by checking journal entries to confirm the exact reason for the failure.

sudo systemctl status man-db.service

For extensive diagnostics, execute journalctl filtered specifically for the service:

sudo journalctl -u man-db.service -e --no-pager

Common clues include “Permission denied”, “mandb: can’t create index cache”, or “Signal caught: Bus error”.

2. Remove Stale Lock Files and Purge Corrupt Cache

Deleting corrupted database binaries and locks allows the indexing utility to rebuild from scratch.

  1. Stop any stuck mandb processes:
    sudo killall mandb 2>/dev/null
  2. Purge cached index files and locks inside the manual directory:
    sudo rm -f /var/cache/man/index.db
    sudo rm -f /var/cache/man/*.lock
  3. Verify and restore standard directory ownership:
    sudo chown -R man:man /var/cache/man
    sudo chmod -R 755 /var/cache/man

3. Manually Recreate the Manual Page Index Database

Once lock files are cleared, invoke the mandb binary manually with forced rebuild flags to construct a fresh indexing table.

sudo mandb -c

The -c flag forces mandb to create the database from scratch rather than updating existing structures. Allow the utility one to two minutes to parse all manual trees in /usr/share/man.

4. Restart the systemd Service and Timer

After regenerating the database, test the systemd service to confirm clean execution.

sudo systemctl start man-db.service
sudo systemctl status man-db.service

Verify that the service exits with status Active: inactive (dead) and code SUCCESS, which indicates that the one-shot indexing task concluded properly. Finally, ensure the accompanying maintenance timer is active:

sudo systemctl enable --now man-db.timer

5. Optimise for Low-Resource Cloud Servers (Optional)

On budget cloud VPS instances with 512 MB to 1 GB RAM, mandb index generation can trigger Out-Of-Memory (OOM) killer events. You can configure dpkg to skip automatic man-db indexing triggers during upgrades by placing an override file:

sudo touch /var/lib/man-db/auto-update

Removing write triggers ensures package upgrades finish instantaneously without triggering intensive manual page index rebuilds.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.