Mlocate database is automatically recreated on every system reboot

Hey geekos! I’m having trouble with mlocate. Specifically, after each reboot, locate … will never return results, unless I run updatedb. I’m on a fresh install of Leap 16.0, where I recently ran zypper install mlocate.

Now, my understanding is that the database is automatically recreated on every system reboot, making it impossible to maintain a persistent database. Any updates to the database are lost at the next reboot. After I run updatedb, I can check the state with

ls -la /var/lib/mlocate/mlocate.db

which returns

-rw-r--r--.  1  root  root  <some normal file size>  <approx. current date, time>  mlocate.db

After a reboot, the same command however returns

-rw-r--r--.  1  nobody  nobody  <a small size>  <date, time of the boot>  mlocate.db

The timestamp changes to the reboot time, indicating the database was regenerated. The file is also owned by the nobody user instead of root . (BTW: None of my users is “nobody” :slight_smile:).

It seems that the mlocate.timer systemd unit is automatically running updatedb on every boot:

systemctl list-timers --all | grep mlocate

returns

<tomorrow> 00:00:00 … <last boot time> … mlocate.timer  mlocate.service

I think the mlocate database should persist across reboots. Users should be able to maintain and update the database without it being automatically regenerated on every boot.

Does anybody else see this issue?

I assume it can be mitigated with

sudo systemctl disable mlocate.timer
sudo systemctl stop mlocate.timer

But maybe this should be classified as unwanted behavior, and I should file a report in Bugzilla?

I couldn’t get updatedb to update after moving from leap 15.6 to tumbleweed because of the “nobody” issue. Couldn’t figure a way around it.
Searching internet I found command below that runs updatedb where sudo does not.
I don’t recall the reference for this.

“sudo systemctl start plocate-updatedb”

When on leap 15.6, I used “sudo updatedb” as needed and there was not a “nobody” issue. Apparently there is a cron run of updatedb every midnight but I have not verified that. I had no knowledge that updatedb ran on boot.

tom kosvic

Disabling + stopping the mlocate timer seems to mitigate the issue for me. I still think this should work out-of-the-box, though.

That is not a solution. It is turning off automation in favor of doing the same thing manually. There are already more threads about this.

I was recommended to use plocate rather than mlocate which may (or may not) address your issue.

If you install mlocate you will get plocate, since the 1st was deprecated in favor of the latter.