How to get slocate working

User avatar
Atip
Posts: 539
Joined: 5. Jun 2011, 04:27

How to get slocate working

Post by Atip »

SalixLive-64

How can one get slocate working and by the same matter updatedb?

If I give the commands nothing happens as user one and as well as sudo.

I reinstalled with format ext3. It is really great now with no limits on persistent.
User avatar
mimosa
Salix Warrior
Posts: 3311
Joined: 25. May 2010, 17:02
Contact:

Re: How to get slocate working

Post by mimosa »

Code: Select all

sudo slocate -u
westms
Posts: 298
Joined: 17. Mar 2013, 18:51

Re: How to get slocate working

Post by westms »

Atip wrote:SalixLive-64

How can one get slocate working and by the same matter updatedb?

If I give the commands nothing happens as user one and as well as sudo.
Does SalixLive64 not contain the file /etc/cron.daily/slocate?

In Salix64 14.2, this file contains:

Code: Select all

#!/bin/sh
ionice -c3 nice -n 19 /usr/bin/updatedb -c /etc/updatedb.conf
Where /usr/bin/updatedb is a symbolic link to slocate and /etc/updatedb.conf contains the following:

Code: Select all

# /etc/updatedb.conf:  slocate configuration file

PRUNEFS="devpts NFS nfs afs proc smbfs autofs iso9660 udf tmpfs cifs"
PRUNEPATHS="/dev /proc /sys /tmp /usr/tmp /var/tmp /afs /net /media /mnt"
export PRUNEFS
export PRUNEPATHS
User avatar
Atip
Posts: 539
Joined: 5. Jun 2011, 04:27

Re: How to get slocate working

Post by Atip »

mimosa wrote:

Code: Select all

sudo slocate -u
Nothing doing :(

Entering the command it immediately goes back to command line
when normally it would take some time to updatedb.

The same is the case for "locate whatever". Immediately
back to command line and nothing located.

Yes westms, all those files and contents are there.

Here is the output of strace:

Code: Select all

one[Desktop]$ sudo strace slocate dillo
Password: 
execve("/usr/bin/slocate", ["slocate", "dillo"], [/* 20 vars */]) = 0
brk(NULL)                               = 0x23e0000
fcntl(0, F_GETFD)                       = 0
fcntl(1, F_GETFD)                       = 0
fcntl(2, F_GETFD)                       = 0
access("/etc/suid-debug", F_OK)         = -1 ENOENT (No such file or directory)
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f933ae91000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=131807, ...}) = 0
mmap(NULL, 131807, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f933ae70000
close(3)                                = 0
open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360\10\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=2076848, ...}) = 0
mmap(NULL, 3967456, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f933a8a5000
mprotect(0x7f933aa65000, 2093056, PROT_NONE) = 0
mmap(0x7f933ac64000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bf000) = 0x7f933ac64000
mmap(0x7f933ac6a000, 14816, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f933ac6a000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f933ae6f000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f933ae6e000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f933ae6d000
arch_prctl(ARCH_SET_FS, 0x7f933ae6e700) = 0
mprotect(0x7f933ac64000, 16384, PROT_READ) = 0
mprotect(0x7f933ae92000, 4096, PROT_READ) = 0
munmap(0x7f933ae70000, 131807)          = 0
brk(NULL)                               = 0x23e0000
brk(0x2401000)                          = 0x2401000
getuid()                                = 0
getgid()                                = 0
socket(PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
connect(3, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
close(3)                                = 0
socket(PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
connect(3, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
close(3)                                = 0
open("/etc/nsswitch.conf", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=1083, ...}) = 0
read(3, "#\n# /etc/nsswitch.conf\n#\n# An ex"..., 1024) = 1024
read(3, "s:     files\n\nautomount:      fi"..., 1024) = 59
read(3, "", 1024)                       = 0
close(3)                                = 0
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=131807, ...}) = 0
mmap(NULL, 131807, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f933ae70000
close(3)                                = 0
open("/lib64/libnss_compat.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200\22\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=41944, ...}) = 0
mmap(NULL, 2131040, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f933a69c000
mprotect(0x7f933a6a4000, 2093056, PROT_NONE) = 0
mmap(0x7f933a8a3000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x7f933a8a3000
close(3)                                = 0
open("/lib64/libnsl.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P?\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=114320, ...}) = 0
mmap(NULL, 2202168, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f933a482000
mprotect(0x7f933a498000, 2097152, PROT_NONE) = 0
mmap(0x7f933a698000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16000) = 0x7f933a698000
mmap(0x7f933a69a000, 6712, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f933a69a000
close(3)                                = 0
mprotect(0x7f933a698000, 4096, PROT_READ) = 0
mprotect(0x7f933a8a3000, 4096, PROT_READ) = 0
munmap(0x7f933ae70000, 131807)          = 0
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=131807, ...}) = 0
mmap(NULL, 131807, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f933ae70000
close(3)                                = 0
open("/lib64/libnss_nis.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0  \0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=55920, ...}) = 0
mmap(NULL, 2143624, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f933a276000
mprotect(0x7f933a281000, 2093056, PROT_NONE) = 0
mmap(0x7f933a480000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xa000) = 0x7f933a480000
close(3)                                = 0
open("/lib64/libnss_files.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P!\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=56056, ...}) = 0
mmap(NULL, 2168600, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f933a064000
mprotect(0x7f933a06f000, 2093056, PROT_NONE) = 0
mmap(0x7f933a26e000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xa000) = 0x7f933a26e000
mmap(0x7f933a270000, 22296, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f933a270000
close(3)                                = 0
mprotect(0x7f933a26e000, 4096, PROT_READ) = 0
mprotect(0x7f933a480000, 4096, PROT_READ) = 0
munmap(0x7f933ae70000, 131807)          = 0
open("/etc/group", O_RDONLY|O_CLOEXEC)  = 3
lseek(3, 0, SEEK_CUR)                   = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=748, ...}) = 0
mmap(NULL, 748, PROT_READ, MAP_SHARED, 3, 0) = 0x7f933ae90000
lseek(3, 748, SEEK_SET)                 = 748
munmap(0x7f933ae90000, 748)             = 0
close(3)                                = 0
open("/etc/group", O_RDONLY|O_CLOEXEC)  = 3
lseek(3, 0, SEEK_CUR)                   = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=748, ...}) = 0
mmap(NULL, 748, PROT_READ, MAP_SHARED, 3, 0) = 0x7f933ae90000
lseek(3, 748, SEEK_SET)                 = 748
munmap(0x7f933ae90000, 748)             = 0
close(3)                                = 0
stat("/var/lib/slocate/slocate.db", {st_mode=S_IFREG|0640, st_size=1, ...}) = 0
getegid()                               = 21
stat("/var/lib/slocate/slocate.db", {st_mode=S_IFREG|0640, st_size=1, ...}) = 0
open("/var/lib/slocate/slocate.db", O_RDONLY) = 3
read(3, "1", 1)                         = 1
read(3, "", 4096)                       = 0
close(3)                                = 0
exit_group(0)                           = ?
+++ exited with 0 +++
one[Desktop]$ 
I have dillo installed and using it for this post.
djemos
Salix Warrior
Posts: 1433
Joined: 29. Dec 2009, 13:45
Location: Greece

Re: How to get slocate working

Post by djemos »

Type

Code: Select all

sudo updatedb
Wait until finish. Then type

Code: Select all

locate program-name-to-find
User avatar
Atip
Posts: 539
Joined: 5. Jun 2011, 04:27

Re: How to get slocate working

Post by Atip »

As I have mentioned in all previous posts

It does not work!

If it would work strace would show a lot of "dillo" locations.
It does not show a single one. And strace output would be much much longer.
What I posted is the entire output.

Portion of strace in Slint.

Code: Select all

sudo strace slocate dillo
....snip....
access("/home/guest", R_OK)             = 0
access("/home", R_OK)                   = 0
lstat64("/home/guest/.dillo/keysrc", {st_mode=S_IFREG|0644, st_size=2587, ...}) = 0
access("/home/guest/.dillo/keysrc", F_OK) = 0
access("/home/guest/.dillo", R_OK)      = 0
access("/home/guest", R_OK)             = 0
access("/home", R_OK)                   = 0
lstat64("/home/guest/.dillo/bm.txt.bak", {st_mode=S_IFREG|0600, st_size=9456, ...}) = 0
access("/home/guest/.dillo/bm.txt.bak", F_OK) = 0
access("/home/guest/.dillo", R_OK)      = 0
access("/home/guest", R_OK)             = 0
access("/home", R_OK)                   = 0
lstat64("/home/guest/.dillo/dpid_comm_keys", {st_mode=S_IFREG|0600, st_size=14, ...}) = 0
access("/home/guest/.dillo/dpid_comm_keys", F_OK) = 0
access("/home/guest/.dillo", R_OK)      = 0
access("/home/guest", R_OK)             = 0
access("/home", R_OK)                   = 0
lstat64("/home/guest/.dillo/bm.txt", {st_mode=S_IFREG|0600, st_size=9379, ...}) = 0
access("/home/guest/.dillo/bm.txt", F_OK) = 0
access("/home/guest/.dillo", R_OK)      = 0
....snip...
No such showing of dillo in strace of previous post;
since it does not work.

There is no updated db no matter how long I will wait after giving command since
no updating is taking place.

I am using slocate since more than 20 years in Linux so I know what I am doing one should assume. ;)
westms
Posts: 298
Joined: 17. Mar 2013, 18:51

Re: How to get slocate working

Post by westms »

Atip wrote:As I have mentioned in all previous posts

It does not work!
To compare with Salix64 14.2:

Is the database /var/lib/slocate/slocate.db renewed when you use the call

Code: Select all

sudo /usr/bin/updatedb -c /etc/updatedb.conf

? With me, yes.

Also the call

Code: Select all

sudo /usr/bin/updatedb -c /etc/updatedb.conf firefox
works. I do not have dillo.
The processes are done in silence. With me the database is renewed every time.

Then

Code: Select all

sudo slocate -c /etc/updatedb.conf
on the other hand does not produce anything.

Code: Select all

sudo slocate -c /etc/updatedb.conf firefox
throws out a lot of data, but does not change the database.

Called as

Code: Select all

sudo slocate -u -c /etc/updatedb.conf
or

Code: Select all

sudo slocate -u -c /etc/updatedb.conf firefox
the database is refreshed each time, also in silence.

The explanation for the difference between updatedb and slocate: When slocate is called as updatedb, the -u option is implied.
Atip wrote:I am using slocate since more than 20 years in Linux so I know what I am doing one should assume. ;)
More than 20 years? Maybe you just got lost in an age-related memory gap as far as the use of the command is concerned? :)

Is this SalixLive64 installed on HDD/SSD or is it booted from a memory stick?
If the latter is true, are you sure /var/lib/slocate/slocate.db is changeable?
User avatar
Atip
Posts: 539
Joined: 5. Jun 2011, 04:27

Re: How to get slocate working

Post by Atip »

To run updatedb it takes usually several seconds to several minutes
to complete depending on the size of the partition.

For example in my Slint-64 it takes 125 sec.
In my Slackel-Openbox 35 sec.
In my Slackel-Live-Openbox 20 sec.

IN SALIXLlIVE-64 IT TAKES A FRACTION OF A SECOND
even so it is rather large. That is because it does not work AT ALL.

I am closing now this discussion since it does not seem to lead anywhere.
Thanks everyone!

And I wish westms that he will have my memory if he will ever reach my age.
DidierSpaier
Posts: 518
Joined: 20. Jun 2016, 20:15

Re: How to get slocate working

Post by DidierSpaier »

Atip wrote:IN SALIXLlIVE-64 IT TAKES A FRACTION OF A SECOND
even so it is rather large. That is because it does not work AT ALL.
Do you run it in RAM, without persistence?
If yes, to 100% sure run updatedb then try "slocate <name>", <name> being the name of a file of which you are sure that it exists.

EDIT. I think that updatedb just does not include in its database files in RAM. I just tried that on Slint:

Code: Select all

didier[/dev/shm/didier]$ su
root's Password: 
root[/dev/shm/didier]# updatedb
root[/dev/shm/didier]# locate at-spi2-HA71AZ
root[/dev/shm/didier]# exit
didier[/dev/shm/didier]$ ls |grep at-spi2-HA71AZ
at-spi2-HA71AZ
didier[/dev/shm/didier]$ locate at-spi2-HA71AZ
didier[/dev/shm/didier]$ locate Musique
/home/nouveau/Musique
/home/didier/Musique
/old/home/didier/Musique
didier[/dev/shm/didier]$
As you can see locate finds files in mass storage device (like Musique) but not in RAM like at-spi2-HA71AZ, (dev/shm/didier is a temporary directory in shared memory).
User avatar
Atip
Posts: 539
Joined: 5. Jun 2011, 04:27

Re: How to get slocate working

Post by Atip »

No, I do no not run it RAM, have not enough memory.

There comes to mind could it be that memory is short
to run slocate?

Code: Select all

one[Desktop]$ free
                     total             used        free                shared  buff/cache   available
Mem:        2029564      223588     1217240       58216      588736     1441152
Swap:             0           0           0
Post Reply