Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
locate: can not stat () `/var/lib/mlocate/mlocate.db': Permi
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
guyuming
Apprentice
Apprentice


Joined: 19 Nov 2020
Posts: 236

PostPosted: Fri Apr 21, 2023 3:58 am    Post subject: locate: can not stat () `/var/lib/mlocate/mlocate.db': Permi Reply with quote

i think the sgid for /usr/bin/locate is correct, isn't it?

but i cannot run locate, i can only run locate with sudo.

what can be wrong? what kind of investigation or analysis i shall do next?


Code:

guyuming@localhost ~ $ ls /usr/bin/locate -l
-rwxr-s--x 1 root locate 39456 Nov  2 14:14 /usr/bin/locate
guyuming@localhost ~ $ sudo ls -l /var/lib/mlocate/mlocate.db
Password:
-rw-rw---- 1 root locate 32152836 Apr 18 18:49 /var/lib/mlocate/mlocate.db
guyuming@localhost ~ $ locate xxxxxxxxxxxxxxxx
locate: can not stat () `/var/lib/mlocate/mlocate.db': Permission denied
guyuming@localhost ~ $ sudo locate xxxxxxxxxxxxxxxx
guyuming@localhost ~ $
Back to top
View user's profile Send private message
sublogic
Apprentice
Apprentice


Joined: 21 Mar 2022
Posts: 223
Location: Pennsylvania, USA

PostPosted: Fri Apr 21, 2023 4:20 am    Post subject: Reply with quote

I have
Code:
 sudo ls -l /var/lib/mlocate
total 15368
-rw-r----- 1 root locate 15732961 Apr 20 03:49 mlocate.db
$ sudo ls -ld /var/lib/mlocate
drwxr-x--- 2 root locate 4096 Apr 20 03:49 /var/lib/mlocate
What are the permissions on your /var/lib/mlocate directory ?
Back to top
View user's profile Send private message
guyuming
Apprentice
Apprentice


Joined: 19 Nov 2020
Posts: 236

PostPosted: Fri Apr 21, 2023 5:57 am    Post subject: Reply with quote

@sublogic


Code:

guyuming@localhost ~ $ sudo ls -l /var/lib/mlocate
total 31404
-rw-rw---- 1 root locate 32152836 Apr 18 18:49 mlocate.db
guyuming@localhost ~ $ sudo ls -ld /var/lib/mlocate
drwxr-x--- 2 root 998 4096 Apr 18 18:50 /var/lib/mlocate
guyuming@localhost ~ $



The 998 is strange, should be locate group. don't know why. But why is there a number? There is no 998 in /etc/group

Code:

guyuming@localhost ~ $ cat /etc/group|grep locate
locate:x:245:
guyuming@localhost ~ $ cat /etc/group|grep 998
guyuming@localhost ~ $


I did not use the -d parameter for ls before. Thanks!
Back to top
View user's profile Send private message
grknight
Retired Dev
Retired Dev


Joined: 20 Feb 2015
Posts: 1704

PostPosted: Fri Apr 21, 2023 12:36 pm    Post subject: Reply with quote

guyuming wrote:
Code:

guyuming@localhost ~ $ sudo ls -l /var/lib/mlocate
total 31404
-rw-rw---- 1 root locate 32152836 Apr 18 18:49 mlocate.db
guyuming@localhost ~ $ sudo ls -ld /var/lib/mlocate
drwxr-x--- 2 root 998 4096 Apr 18 18:50 /var/lib/mlocate
guyuming@localhost ~ $



The 998 is strange, should be locate group. don't know why. But why is there a number? There is no 998 in /etc/group


All file systems record a UID number and not any name resolution. This makes it easy to store and transfer.

ls uses standard libraries to show a name if it exists.

So your solution likely is to fix the group permissions with chown or chgrp to something that is valid.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum