plocate updatedb failing to index files in $HOME ? (bug or idiot error?)
All, I don't have to search for squirreled away files too often, but when I do, I rely on plocate (mlocate successor). However, tonight I was surprised it had not indexed by Readme-doxygen.txt and I can't figure out why. The file I wanted to find has been there since Jan 15: $ l /home/david/doc/linux/doxygen/Readme-doxygen.txt -rw-r--r-- 1 david david 5067 Jan 15 2024 /home/david/doc/linux/doxygen/Readme-doxygen.txt My install has 3 partitons /boot, swap and / and /home is part of / and is mounted: /dev/sda3 / ext4 rw,relatime 0 0 My /etc/updatedb.conf does not exclude /home or ext4 filesystems, e.g. $ noc /etc/updatedb.conf PRUNEFS="9p afs anon_inodefs auto autofs bdev binfmt binfmt_misc ceph fuse.ceph cgroup cifs coda configfs cramfs cpuset debugfs devfs devpts devtmps ecryptfs eventpollfs exofs futexfs ftpfs fuse fusectl gfs gfs2 gpfs hostfs hugetlbfs inotifyfs iso9660 jffs2 lustre misc mqueue ncpfs nfs NFS nfs4 nfsd nnpfs ocfs ocfs2 pipefs proc ramfs rpc_pipefs securityfs selinuxfs sfs shfs smbfs sockfs spufs sshfs subfs supermount sysfs tmpfs ubifs udf usbfs vboxsf vperfctrfs" PRUNEPATHS="/tmp /var/tmp /var/cache /var/lock /var/run /var/spool /mnt /cdrom /usr/tmp /proc /media /sys /.snapshots /var/run/media" PRUNENAMES = ".git .hg .svn .bzr .arch-ids {arch} CVS" PRUNE_BIND_MOUNTS="no" My plocate-updatedb.timer just ran less than an hour ago: $ scs plocate-updatedb ○ plocate-updatedb.service - Update the locate database Loaded: loaded (/usr/lib/systemd/system/plocate-updatedb.service; static5:185m) Active: inactive (dead) since Sun 2024-11-24 00:33:56 CST; 14min ago Invocation: 633dc34e995a4a658e4d66f1f61a0622 TriggeredBy: ● plocate-updatedb.timer Docs: man:updatedb Process: 158324 ExecStart=/bin/sh -c chown -R ${RUN_UPDATEDB_AS}:root /var/lib/plocate && su --shell=/bin/sh ${RUN_UPDATEDB_AS} -c 'umask 0022; /usr/sbin/updatedb' (code=exited, status=0/SUCCESS) Main PID: 158324 (code=exited, status=0/SUCCESS) CPU: 53ms Nov 24 00:33:54 wizard systemd[1]: Starting Update the locate database... Nov 24 00:33:54 wizard su[158324]: (to nobody) root on none Nov 24 00:33:54 wizard su[158324]: pam_systemd(su:session): New sd-bus connection (system-bus-pam-systemd-158324) opened. Nov 24 00:33:54 wizard su[158324]: pam_unix(su:session): session opened for user nobody(uid=65534) by (uid=0) Nov 24 00:33:56 wizard systemd[1]: plocate-updatedb.service: Deactivated successfully. Nov 24 00:33:56 wizard systemd[1]: Finished Update the locate database. 'locate' is properly linked to 'plocate': $ l /usr/bin/locate lrwxrwxrwx 1 root root 7 Jun 12 10:04 /usr/bin/locate -> plocate Yet running 'locate Readme' or 'locate doxygen' does not turn up my file. Why is this? What magic am I missing? -- David C. Rankin, J.D.,P.E.
David C. Rankin wrote:
All,
I don't have to search for squirreled away files too often, but when I do, I rely on plocate (mlocate successor). However, tonight I was surprised it had not indexed by Readme-doxygen.txt and I can't figure out why.
Does it find any files in your home directory? What is the permission of your home directory (or the parent directories of the file)? As what user is plocate running (/etc/sysconfig/locate)?
On 11/26/24 7:57 AM, Pit Suetterlin via openSUSE Users wrote:
David C. Rankin wrote:
All,
I don't have to search for squirreled away files too often, but when I do, I rely on plocate (mlocate successor). However, tonight I was surprised it had not indexed by Readme-doxygen.txt and I can't figure out why.
Does it find any files in your home directory? What is the permission of your home directory (or the parent directories of the file)? As what user is plocate running (/etc/sysconfig/locate)?
I think you hit the nail on the head, but I'm not sure how to configure this? No files in my $HOME are indexed. The problem appears to be whoever plocate runs as, they do not have permission in my home directory: drwx------ 48 david david 4096 Nov 26 23:47 . In TW (and I presume in Leap), config is controlled by /etc/updatedb.conf and the default does not specify and user:group it is running as (I always just presumed root, mlocate never had an issue). Maybe this is part of the "more secure" plocate features. Looking at the systemd service file, it looks like it runs as a specific user with root group: ExecStart=/bin/sh -c \ "chown -R ${RUN_UPDATEDB_AS}:root /var/lib/plocate && \ su --shell=/bin/sh ${RUN_UPDATEDB_AS} -c 'umask 0022; /usr/sbin/updatedb'" Since my home has no group-read, the plocate user can't read it and there is no group read for root to read. I'll change perms to 0750 on my home and I bet it works. Will confirm after update. -- David C. Rankin, J.D.,P.E.
On 11-27-2024 02:34AM, David C. Rankin wrote:
On 11/26/24 7:57 AM, Pit Suetterlin via openSUSE Users wrote:
David C. Rankin wrote:
All,
I don't have to search for squirreled away files too often, but when I do, I rely on plocate (mlocate successor). However, tonight I was surprised it had not indexed by Readme-doxygen.txt and I can't figure out why.
Does it find any files in your home directory? What is the permission of your home directory (or the parent directories of the file)? As what user is plocate running (/etc/sysconfig/locate)?
I think you hit the nail on the head, but I'm not sure how to configure this? No files in my $HOME are indexed. The problem appears to be whoever plocate runs as, they do not have permission in my home directory:
drwx------ 48 david david 4096 Nov 26 23:47 .
In TW (and I presume in Leap), config is controlled by /etc/ updatedb.conf and the default does not specify and user:group it is running as (I always just presumed root, mlocate never had an issue). Maybe this is part of the "more secure" plocate features.
Looking at the systemd service file, it looks like it runs as a specific user with root group:
ExecStart=/bin/sh -c \ "chown -R ${RUN_UPDATEDB_AS}:root /var/lib/plocate && \ su --shell=/bin/sh ${RUN_UPDATEDB_AS} -c 'umask 0022; /usr/ sbin/updatedb'"
Since my home has no group-read, the plocate user can't read it and there is no group read for root to read. I'll change perms to 0750 on my home and I bet it works. Will confirm after update.
Hi, my home directory here is very similar to yours permissions wise (I think it appears so). drwx------. 1 paul paul 1.3K Nov 25 11:47 paul locate does not have problems locating files in home it appears. locate .config does show .config files in home directory. I wrote to tell you about the permissions being similar. -Regards -Regards
On 11/27/24 2:42 AM, -pj via openSUSE Users wrote:
On 11-27-2024 02:34AM, David C. Rankin wrote:
On 11/26/24 7:57 AM, Pit Suetterlin via openSUSE Users wrote:
David C. Rankin wrote:
All,
I don't have to search for squirreled away files too often, but when I do, I rely on plocate (mlocate successor). However, tonight I was surprised it had not indexed by Readme-doxygen.txt and I can't figure out why.
Does it find any files in your home directory? What is the permission of your home directory (or the parent directories of the file)? As what user is plocate running (/etc/sysconfig/locate)?
I think you hit the nail on the head, but I'm not sure how to configure this? No files in my $HOME are indexed. The problem appears to be whoever plocate runs as, they do not have permission in my home directory:
drwx------ 48 david david 4096 Nov 26 23:47 .
In TW (and I presume in Leap), config is controlled by /etc/ updatedb.conf and the default does not specify and user:group it is running as (I always just presumed root, mlocate never had an issue). Maybe this is part of the "more secure" plocate features.
Looking at the systemd service file, it looks like it runs as a specific user with root group:
ExecStart=/bin/sh -c \ "chown -R ${RUN_UPDATEDB_AS}:root /var/lib/plocate && \ su --shell=/bin/sh ${RUN_UPDATEDB_AS} -c 'umask 0022; /usr/ sbin/updatedb'"
Since my home has no group-read, the plocate user can't read it and there is no group read for root to read. I'll change perms to 0750 on my home and I bet it works. Will confirm after update.
Hi, my home directory here is very similar to yours permissions wise (I think it appears so). drwx------. 1 paul paul 1.3K Nov 25 11:47 paul locate does not have problems locating files in home it appears. locate .config does show .config files in home directory. I wrote to tell you about the permissions being similar.
Well... crap... that was it! Bad news is you must set home world-readable 0755 for plocate-updatdb to index your home. 0750 won't work. The process runs as user 'nobody', e.g. Nov 27 02:38:43 wizard systemd[1]: Starting Update the locate database... Nov 27 02:38:43 wizard su[184034]: (to nobody) root on none After setting home to 0755 and running the plocate-updatedb service, home is indexed and I can find my files: $ plocate doxygen | grep -i readme /home/david/dev/doc/c/doxygen/Readme_doxygen.txt /home/david/doc/linux/doxygen/Readme-doxygen.txt Hmm, seems I have two versions squirreled away :) No problem. I reset my home to 0700 and if I need to find a file plocate hasn't indexed yet, I'll just make home world-readable for the update and switch back after it is done. Only takes about 10 seconds with a SSD. Thank you for the help figuring this one out. I wasn't even thinking about permissions. It's always just worked. Now I have my "where did I put it" helper back -- and an easy procedure to update when needed. -- David C. Rankin, J.D.,P.E.
On 2024-11-27 09:34, David C. Rankin wrote:
On 11/26/24 7:57 AM, Pit Suetterlin via openSUSE Users wrote:
David C. Rankin wrote:
All,
I don't have to search for squirreled away files too often, but when I do, I rely on plocate (mlocate successor). However, tonight I was surprised it had not indexed by Readme-doxygen.txt and I can't figure out why.
Does it find any files in your home directory? What is the permission of your home directory (or the parent directories of the file)? As what user is plocate running (/etc/sysconfig/locate)?
I think you hit the nail on the head, but I'm not sure how to configure this? No files in my $HOME are indexed. The problem appears to be whoever plocate runs as, they do not have permission in my home directory:
drwx------ 48 david david 4096 Nov 26 23:47 .
In TW (and I presume in Leap), config is controlled by /etc/ updatedb.conf and the default does not specify and user:group it is running as (I always just presumed root, mlocate never had an issue). Maybe this is part of the "more secure" plocate features.
Looking at the systemd service file, it looks like it runs as a specific user with root group:
ExecStart=/bin/sh -c \ "chown -R ${RUN_UPDATEDB_AS}:root /var/lib/plocate && \ su --shell=/bin/sh ${RUN_UPDATEDB_AS} -c 'umask 0022; /usr/ sbin/updatedb'"
Variable "RUN_UPDATEDB_AS" is probably defined in file /etc/sysconfig/locate. RUN_UPDATEDB_AS="root" #RUN_UPDATEDB_AS="nobody"
Since my home has no group-read, the plocate user can't read it and there is no group read for root to read. I'll change perms to 0750 on my home and I bet it works. Will confirm after update.
-- Cheers / Saludos, Carlos E. R. (from 15.5 x86_64 at Telcontar)
On 11/27/24 6:22 AM, Carlos E. R. wrote:
Variable "RUN_UPDATEDB_AS" is probably defined in file /etc/sysconfig/locate.
RUN_UPDATEDB_AS="root" #RUN_UPDATEDB_AS="nobody"
Thank you Carlos, I had don't a quick ls /etc/sysconfig/plocate and got nothing.... Now it will work. I specifically like the logic of the comment above. I'd rather set $HOME as 0700 than worry about some potential directory info be gleaned from having run find as root.... -- David C. Rankin, J.D.,P.E.
On 2024-11-29 06:17, David C. Rankin wrote:
On 11/27/24 6:22 AM, Carlos E. R. wrote:
Variable "RUN_UPDATEDB_AS" is probably defined in file /etc/sysconfig/ locate.
RUN_UPDATEDB_AS="root" #RUN_UPDATEDB_AS="nobody"
Thank you Carlos,
I had don't a quick ls /etc/sysconfig/plocate and got nothing.... Now it will work. I specifically like the logic of the comment above. I'd rather set $HOME as 0700 than worry about some potential directory info be gleaned from having run find as root....
I think that with the modern variants of locate you can have the database populated by root, but when you search for a file you will only see those files you have permissions for. I mean, a file can be in the database and when you call ?locate it says not found or no permission because it belongs to another user and the home is not group read. -- Cheers / Saludos, Carlos E. R. (from 15.5 x86_64 at Telcontar)
On Sun, 24 Nov 2024 01:14:30 -0600, "David C. Rankin" <drankinatty@gmail.com> wrote:
I don't have to search for squirreled away files too often, but when I do, I rely on plocate (mlocate successor). However, tonight I was surprised it had not indexed by Readme-doxygen.txt and I can't figure out why.
The file I wanted to find has been there since Jan 15:
$ l /home/david/doc/linux/doxygen/Readme-doxygen.txt -rw-r--r-- 1 david david 5067 Jan 15 2024 /home/david/doc/linux/doxygen/Readme-doxygen.txt
My install has 3 partitons /boot, swap and / and /home is part of / and is mounted:
/dev/sda3 / ext4 rw,relatime 0 0
My /etc/updatedb.conf does not exclude /home or ext4 filesystems, e.g.
$ noc /etc/updatedb.conf PRUNEFS="9p afs anon_inodefs auto autofs bdev binfmt binfmt_misc ceph fuse.ceph cgroup cifs coda configfs cramfs cpuset debugfs devfs devpts devtmps ecryptfs eventpollfs exofs futexfs ftpfs fuse fusectl gfs gfs2 gpfs hostfs hugetlbfs inotifyfs iso9660 jffs2 lustre misc mqueue ncpfs nfs NFS nfs4 nfsd nnpfs ocfs ocfs2 pipefs proc ramfs rpc_pipefs securityfs selinuxfs sfs shfs smbfs sockfs spufs sshfs subfs supermount sysfs tmpfs ubifs udf usbfs vboxsf vperfctrfs" PRUNEPATHS="/tmp /var/tmp /var/cache /var/lock /var/run /var/spool /mnt /cdrom /usr/tmp /proc /media /sys /.snapshots /var/run/media" PRUNENAMES = ".git .hg .svn .bzr .arch-ids {arch} CVS" PRUNE_BIND_MOUNTS="no"
$ grep -Ev '^(#|$)' /etc/updatedb.conf |grep -Ewc 'btrfs|xfs|ext4|home' 0
My plocate-updatedb.timer just ran less than an hour ago:
$ scs plocate-updatedb ○ plocate-updatedb.service - Update the locate database Loaded: loaded (/usr/lib/systemd/system/plocate-updatedb.service; static5:185m) Active: inactive (dead) since Sun 2024-11-24 00:33:56 CST; 14min ago Invocation: 633dc34e995a4a658e4d66f1f61a0622 TriggeredBy: ● plocate-updatedb.timer Docs: man:updatedb Process: 158324 ExecStart=/bin/sh -c chown -R ${RUN_UPDATEDB_AS}:root /var/lib/plocate && su --shell=/bin/sh ${RUN_UPDATEDB_AS} -c 'umask 0022; /usr/sbin/updatedb' (code=exited, status=0/SUCCESS) Main PID: 158324 (code=exited, status=0/SUCCESS) CPU: 53ms
Nov 24 00:33:54 wizard systemd[1]: Starting Update the locate database... Nov 24 00:33:54 wizard su[158324]: (to nobody) root on none Nov 24 00:33:54 wizard su[158324]: pam_systemd(su:session): New sd-bus connection (system-bus-pam-systemd-158324) opened. Nov 24 00:33:54 wizard su[158324]: pam_unix(su:session): session opened for user nobody(uid=65534) by (uid=0) Nov 24 00:33:56 wizard systemd[1]: plocate-updatedb.service: Deactivated successfully. Nov 24 00:33:56 wizard systemd[1]: Finished Update the locate database.
$ systemctl status plocate-updatedb ○ plocate-updatedb.service - Update the locate database Loaded: loaded (/usr/lib/systemd/system/plocate-updatedb.service; static) Active: inactive (dead) since Tue 2024-11-26 01:43:58 PST; 13h ago Invocation: 77f1a21411a1411d8d66b4d15b3fd7b7 TriggeredBy: ● plocate-updatedb.timer Docs: man:updatedb Process: 125750 ExecStart=/bin/sh -c chown -R ${RUN_UPDATEDB_AS}:root /var/lib/plocate && su --shell=/bin/sh ${RUN_UPDATEDB_AS} -c 'umask 0022; /usr/sbin/updatedb' (code=exited, status=0/SUCCESS) Main PID: 125750 (code=exited, status=0/SUCCESS) CPU: 1.877s Nov 26 01:43:56 poppies systemd[1]: Starting Update the locate database... Nov 26 01:43:56 poppies su[125750]: (to root) root on none Nov 26 01:43:56 poppies su[125750]: pam_unix(su:session): session opened for user root(uid=0) by (uid=0) Nov 26 01:43:56 poppies su[125750]: pam_kwallet5(su:session): pam_kwallet5: pam_sm_open_session Nov 26 01:43:56 poppies su[125750]: pam_kwallet5(su:session): pam_kwallet5: not a graphical session, skipping. Use force_run parameter to ignore this. Nov 26 01:43:58 poppies su[125750]: pam_unix(su:session): session closed for user root Nov 26 01:43:58 poppies su[125750]: pam_kwallet5(su:session): pam_kwallet5: pam_sm_close_session Nov 26 01:43:58 poppies systemd[1]: plocate-updatedb.service: Deactivated successfully. Nov 26 01:43:58 poppies systemd[1]: Finished Update the locate database. Nov 26 01:43:58 poppies systemd[1]: plocate-updatedb.service: Consumed 1.877s CPU time. I don't see a significant difference from yours. Both updatedbs ran successfully as root.
'locate' is properly linked to 'plocate':
$ l /usr/bin/locate lrwxrwxrwx 1 root root 7 Jun 12 10:04 /usr/bin/locate -> plocate
Yet running 'locate Readme' or 'locate doxygen' does not turn up my file. Why is this? What magic am I missing?
Is that unique to that file, or are none of your files in $HOME found? $ locate -c ~ 168104 $ find ~ |wc -l 168229 -- Robert Webb
participants (5)
-
-pj
-
Carlos E. R.
-
David C. Rankin
-
Pit Suetterlin
-
Robert Webb