Ubuntu systemd timers run routine maintenance services to ensure documentation and manual pages remain instantly searchable through commands like man, apropos, and whatis. The man-db.service and man-db.timer rebuild the binary index database in /var/cache/man daily. When running systemctl --failed reports that man-db.service has exited with a failure status, troubleshooting the database cache preserves efficient command documentation lookups.
What Does man-db.service Do?
The manual database service scans installed manual page hierarchies across your Linux file tree:
- It invokes the binary
/usr/bin/mandb --quietto scan/usr/share/man,/usr/local/man, and third-party package documentation. - It generates indexed Berkeley DB (or GDBM) cache files in
/var/cache/man/index.db. - Failures occur when disk storage in
/varis exhausted, corrupted GDBM database files lock write access, or broken symlinks from uninstalled packages cause mandb parser crashes.
1. Inspect Journalctl Logs for the Failure Reason
Checking systemd journal output reveals the specific exit code of the mandb process.
- Open your terminal and run:
sudo journalctl -u man-db.service -n 50 --no-pager - Identify the error messages:
mandb: can't create index cache /var/cache/man/...: Permission or disk space error.mandb: fatal: corrupted database: Damaged index file structure.No space left on device: Full partition.
2. Verify Disk Space and Inode Availability
A full filesystem blocks mandb from writing temporary index tables.
- Check disk capacity on
/var:df -h /var/cache/man - Check inode usage:
df -i /var - If the drive is full, clean package cache files:
sudo apt-get clean && sudo apt-get autoremove -y
3. Purge Corrupted Manual Cache Files
Removing corrupted index databases allows mandb to construct clean binary indexes from scratch.
- Stop any running manual services:
sudo systemctl stop man-db.service - Purge the cache directory contents:
sudo rm -rf /var/cache/man/* - Ensure proper directory permissions are restored:
sudo chown -R man:man /var/cache/man sudo chmod 755 /var/cache/man
4. Manually Rebuild the Manual Database
Running the builder with verbose output pinpoints any broken manual packages.
- Execute a full manual database regeneration:
(Thesudo mandb -c-cflag forces creation of fresh databases from scratch). - Watch the terminal output as it processes language catalogues (e.g.
/usr/share/man). - Once complete, verify that
/var/cache/man/index.dbexists and has non-zero file size:ls -lh /var/cache/man/index.db
5. Clear Failed State and Restart the Service
Reset systemd status flags and verify clean execution.
- Reset the systemd failure record:
sudo systemctl reset-failed man-db.service - Trigger the service manually via systemd:
sudo systemctl start man-db.service - Verify active success status:
sudo systemctl status man-db.service - Check that the companion timer is scheduled:
sudo systemctl status man-db.timer