In order to use updatedb I need always to change ownership of /var/lib/mlocate
owner: nobody
group: root

The problem is that it seems tor reset on every boot.
I need to find a way to fix this

linux:~ # updatedb
updatedb: can not open a temporary file for `/var/lib/mlocate/mlocate.db'

If I do:

linux:/var/lib # chown root mlocate/
linux:/var/lib # updatedb
linux:/var/lib #

So then it works.
But as I mentioned it works only on the current session.

Any ideas?


Looks like W.I.P with AppArmor profile…


Unless something changed <very> recently, I can run “update” with root permissions (did so the other day).

Did you <just> run “zypper dup” and immediately after run into this problem?


Thanks for the replies.
I am still not sure of the problem pattern.
See, 2 days ago I fixed the ownership of ‘/var/lib/mlocate’ as described above and it worked after an instant reboot.
Main wile i must have ‘zypper dup’ once or twice. Today I had to remake the ownership. I did a ‘zypper dup’ an hour or so after the process. And I rebooted tho check the updatedb.
Well it is still working for now.
I will monitor it and post if I find something useful.
Thanks malcomlewis, tsu2.

Just updated a TW and can see this problem now, too.


Apparently not the same problem.
As described in the bug, I configured updatedb to run as both “root” and as “nobody” by editing /etc/sysconfig/locate

No diff.

So, a different problem.

I find it a bit curious that the following is the permssions set for mlocate.db.
When /etc/sysconfig/locate is set to nobody (which is default) things <should> work.
But, if I change to root, I can’t see now the following permissions would permit the file to be over-written.

ls -l /var/lib/mlocate/mlocate.db
-rw-r--r-- 1 nobody nobody 5497939 Aug 22 08:47 /var/lib/mlocate/mlocate.db

Interesting that in the original post,
Instead of configuring updatedb to run as root, you simply “changed owner” to root instead to get it to work
And then, based on the above permissions I’m not sure how the file can be overwritten.


On Wed 22 Aug 2018 04:46:03 PM CDT, tsu2 wrote:

Just updated a TW and can see this problem now, too.


Update that open bug report with your findings…

Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
SLES 15 | GNOME Shell 3.26.2 | 4.12.14-25.13-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!

I just tried running your chown method, and I’m not getting the same results…

First, immediately after chown, I checked the permissions of the directory <and> the database file within the directory and I don’t see any permission changes, for some reason the changes aren’t taking.
[Edit - The following command just took forever to run. eventually it completed]
Then I tried running the “updatedb” command and the command just hangs… The command doesn’t return an error right away and is running, but it never completes.

Eventually the updatedb command completed, and locate is working, but curiously the permissions for over-writing the database haven’t changed. Not sure at the moment how this is working.


Bug updated, referencing this Forum thread…