FS#6902 - mlocate requires root access for "locate"
Attached to Project:
Arch Linux
Opened by Peter Morris (PeteMo) - Friday, 13 April 2007, 17:15 GMT
Last edited by James Rayner (iphitus) - Tuesday, 17 April 2007, 10:18 GMT
Opened by Peter Morris (PeteMo) - Friday, 13 April 2007, 17:15 GMT
Last edited by James Rayner (iphitus) - Tuesday, 17 April 2007, 10:18 GMT
|
Details
I believe this began with the update of mlocate to version
0.16-1 on or around April 9. Running "locate foo" as a user
results in "locate: can not open
`/var/lib/mlocate/mlocate.db': Permission denied". Running
as root works as expected.
I installed slocate to investigate and I believe that the problem lies with the permissions/groups on the locate executable at /usr/bin/locate. The permissions for each package are as follows: slocate: lrwxrwxrwx 1 root root 7 2007-04-13 13:03 /usr/bin/locate -> slocate mlocate: -rwxr-sr-x 1 root slocate 30812 2007-04-08 20:12 /usr/bin/locate |
This task depends upon
drwxr-x--- 2 root slocate 80 2007-04-13 19:19 .
drwxr-xr-x 11 root root 296 2007-04-13 19:19 ..
-rw-r----- 1 root mlocate 2303261 2007-04-13 19:19 mlocate.db
'grep locate /etc/groups' please
The mlocate and slocate groups share the same gid, but slocate should have been removed from /etc/groups when you removed slocate.
slocate:x:21:
mlocate:x:101:
I also have another machine with the older version of mlocate on it (0.15-1). There is no /var/lib/mlocate on that machine, only /var/lib/slocate. On that machine,
# ls -al /var/lib/slocate/
total 653
drwxr-x--- 2 root mlocate 80 2007-03-19 21:50 .
drwxr-xr-x 8 root root 224 2007-03-26 06:35 ..
-rw-r----- 1 root mlocate 666372 2007-03-19 21:50 slocate.db
and
$ grep locate /etc/group
mlocate:x:21:
As root run 'groupdel slocate ; pacman -S mlocate' and agree to reinstall mlocate, this should fix the permission problems.
$ grep locate /etc/group
mlocate:x:101:
# ls -al /var/lib/mlocate/
total 2254
drwxr-x--- 2 root 21 80 2007-04-13 19:52 .
drwxr-xr-x 11 root root 296 2007-04-13 19:51 ..
-rw-r----- 1 root mlocate 2303329 2007-04-13 19:52 mlocate.db
group 21 was the slocate group id. Should it now be 101, or perhaps mlocate should be group 21?
Where did you get the mlocate package from?
The mlocate package comes from http://mirror.cs.vt.edu/pub/ArchLinux/extra/os/i686
To fix your system run (as root)
chown root:mlocate /usr/bin/locate /var/lib/mlocate /var/lib/mlocate.db
I'll submit a patch for *locate to follow Roman's suggestion and switch to one group called locate for all *locate packages.
Interestingly, I removed mlocate, deleted the mlocate group, and then reinstalled mlocate. The mlocate group was then created with the correct group id, 21.
Also there's no need to distribute an empty {s,m}locate.db, updatedb sets the correct permissions on the file when it creates/updates it, and both {s,m}locate return errors when the file is zero length.
slocate.patch (3.2 KiB)
Reason for request: Can you also apply the slocate patch please.
:: Synchronizing package databases...
testing is up to date
current is up to date
extra is up to date
unstable is up to date
community is up to date
resolving dependencies... done.
looking for inter-conflicts...
:: mlocate conflicts with slocate. Remove slocate? [Y/n]
done.
Remove: slocate
Targets: mlocate-0.16-2
Total Package Size: 0.10 MB
Proceed with installation? [Y/n]
checking package integrity... done.
warning: /etc/updatedb.conf saved as /etc/updatedb.conf.pacsave
cleaning up... done.
(1/1) checking for file conflicts [---------------------] 100%
(1/1) installing mlocate [---------------------] 100%
mlocate command is technically locate, but slocate is symlinked and still works.
You should run updatedb as root.
[root@sawernew borje4]# chown root:mlocate /usr/bin/locate /var/lib/mlocate /var/lib/mlocate.db
chown: `root:mlocate': invalid group
linfan
The mlocate group (and slocate group once it's patched), no longer exist, they've been replaced by a single group named locate.
linfan
updatedb: can not find group `mlocate'
when i run updatedb
linfan
linfan
linfan
But I tried to download the files from the home page and there is a file called mlocate.db - but it doesn't contain anything it is blank and I cannot nano -w a file that is empty, can I? Maybe I should to nano -w mlaocate.db and type only a hash (#) and then save it.
I am confused,
linfan
linfan
I just installed the update, and it removed my old mlocate group, and put in the locate group.
mlocate appears to still want the mlocate group, however...as Börje already noted. I created the group manually (which the update had removed *sigh*) and it ran fine.
Was this package update tested at all before being pushed to extra?
I would think a cursory install and attempt to run the binary would have shown the problem...
I've built it myself and uploaded a working and tested version to http://linux.neptune-one.net/mlocate/mlocate-0.16-3-i686.pkg.tar.gz
You can find the working PKGBUILD and mlocate.install there as well.
Your package works fine.
The extra package just sucks - something is still wrong with that one in there.
linfan
Thanks.
so, i put -3 in the repos yesterday, does it work for you? Does for me.
James
Thanks :)
Linfan