1. Overview

updatedb is a utility that maintains a database of file paths. It’s used by the locate command, which efficiently searches this database for filenames. Therefore, the database needs to be updated once in a while or during a machine startup.

It’s the duty of the updatedb utility to create and update the database, which can be resource-intensive if there are many files. Therefore, we might need to disable it or completely remove it from the machine.

Usually, the updatedb command is associated with another package that provides the locate command, like GNU findutils, mlocate, or plocate. So, in order to remove it, we’ll need to find the corresponding package first.

In this article, we’ll learn how to remove or disable the updatedb command from a Linux machine. We’ll provide the process for major distributions.

2. Debian and Ubuntu

Before trying to disable updatedb, we should first find the package associated with updatedb:

$ dpkg -S updatedb
plocate: /etc/updatedb.conf
plocate: /usr/sbin/updatedb.plocate
plocate: /usr/share/man/man8/updatedb.plocate.8.gz
plocate: /usr/share/man/man5/updatedb.conf.5.gz
plocate: /lib/systemd/system/plocate-updatedb.timer
plocate: /lib/systemd/system/plocate-updatedb.service

Notably, it’s associated with plocate. To remove plocate, we should first check what packages require plocate:

$ apt-cache rdepends plocate
plocate
Reverse Depends:
  kubuntu-desktop
 |hollywood
  cruft-ng
 |catfish

As we can see, there are several packages that depend on this. Therefore, we can either remove the package or keep it. If we decide to remove the program, we can simply purge it from the system:

$ sudo apt remove --purge plocate

3. Fedora, RHEL, and CentOS

On Fedora, RHEL, and CentOS, we use rpm to find out the associated package:

$ rpm -qf /usr/bin/updatedb
mlocate-0.26-3.fc19.x86_64

Next, we find the packages that depend on mlocate:

$ rpm -q --whatrequires mlocate
no package requires mlocate

Notably, there are no dependent packages. So, we can safely remove it from the system:

$ dnf remove mlocate

4. Arch Linux and Manjaro

On Arch Linux and Manjaro, we can use pacman to find the updatedb associated package and remove it effectively from the system:

$ package=$(pacman -Qo /usr/bin/updatedb | cut -d ' ' -f 5) \
&& sudo pacman -Rns "$package"

The command finds the package associated with updatedb, extracts the package name and then removes it from the system using the -Rns switches.

5. Disable updatedb

There are cases where we need to keep the package associated with updatedb. Therefore, we can simply disable its respective systemd timer:

$ sudo systemctl disable plocate-updatedb.timer 
Removed "/etc/systemd/system/timers.target.wants/plocate-updatedb.timer".

Alternatively, we can also disable updatedb from its configuration file:

$ sudo sed -i 's/\(PRUNE_BIND_MOUNTS\)="yes"/\1="no"/' /etc/updatedb.conf

Afterwards, we restart the cron service for the change to take effect:

$ sudo systemctl restart cron

5. Conclusion

In this article, we learned the purpose of the updatedb command. Next, we covered removing it completely from the major Linux distributions.

Finally, we discussed how to disable updatedb without removing it entirely.