The locate command doesn't show files from /home



In Fedora Linux 34 and 35, the locate command does not show files in user home directories (that is, those under /home).


Recent versions of Fedora Linux default to the Btrfs filesystem for desktop installations, with /home as a Btrfs “subvolume”. The version of the locate command we provide, mlocate, does not understand this setup. It thinks this is a “bind mount”, which it ignores by default, and therefore fails to index files under /home.

Related Issues

Bugzilla report: #906591


Option 1: Configure mlocate to follow bind mounts

Since the problem is that mlocate thinks that the Btrfs /home subvolume is a bind mount, you can tell it to not ignore those by editing the config file:

sudo -e /etc/updatedb.conf

and find the line PRUNE_BIND_MOUNTS = "yes". Change that to PRUNE_BIND_MOUNTS = "no" and save the file. Your home directory will be indexed on next update.

Option 2: Update to a newer version of the tool, as planned for Fedora Linux 36

For Fedora Linux 36, we plan to replace mlocate with plocate, a drop-in replacement that addresses this issue and is faster and uses less disk space. You can make this switch on older systems as well:

# install plocate, allowing mlocate to be removed
sudo dnf install plocate --allowerasing
# refresh the database — or, just skip this step and wait
sudo systemctl start plocate-updatedb.service

More information: Change: Plocate as the default locate implementation.