1

Recently, find command behavior is strange.

[root@luna ~]# find / -name \*.sh -print
[root@luna ~]# find / -name \*.sh -print
/home/data/tools/rd/RDService/scripts/createZipArchive.sh
/home/data/tools/rd/RDService/scripts/createImgArchive.sh
find: `/home/data/lost+found': Permission denied
find: `/home/music/lost+found': Permission denied
(snip)

I executed find but I got nothing and it exited within 1 second. So, I did again. I got the right result this time. (Permission denied is by NFS)

I use arch linux 64bit. the version of find is as follows:

[root@luna ~]# type -a find
find is /usr/bin/find
[root@luna ~]# find --version | head -1
find (GNU findutils) 4.4.2
[root@luna ~]# 

Any help?

EDIT:

[root@luna ~]# find / -name \*.sh -print
[root@luna ~]# echo $?
0
[root@luna ~]# find / -name \*.sh -print
/home/data/tools/rd/RDService/scripts/createZipArchive.sh
/home/data/tools/rd/RDService/scripts/createImgArchive.sh
find: `/home/data/lost+found': Permission denied
^C
[root@luna ~]# 

EDIT:

It seems to be reproducible once after reboot.

I have these two lines in /etc/fstab:

nicobo:/export/music    /home/music     nfs             vers=4.2,rw,soft,bg,intr,noauto,x-systemd.automount,x-systemd.device-timeout=10 0 0
nicobo:/export/data     /home/data      nfs             vers=4.2,rw,soft,bg,intr,noauto,x-systemd.automount,x-systemd.device-timeout=10 0 0

After I comment out these lines and reboot, it is not reproducible. I uncommented, rebooted, and I got the follows:

[root@luna ~]# ls /home/data > /dev/null
[root@luna ~]# ls /home/music > /dev/null
[root@luna ~]# find / -name \*.sh -print
/home/data/tools/rd/RDService/scripts/createZipArchive.sh
/home/data/tools/rd/RDService/scripts/createImgArchive.sh
find: `/home/data/lost+found': Permission denied
^C
[root@luna ~]# 

And I can reproduce it:

[root@luna ~]# umount /home/data
[root@luna ~]# find / -name \*.sh -print
[root@luna ~]# find / -name \*.sh -print
/home/data/tools/rd/RDService/scripts/createZipArchive.sh
/home/data/tools/rd/RDService/scripts/createImgArchive.sh
find: `/home/data/lost+found': Permission denied
^C
[root@luna ~]# umount /home/data
[root@luna ~]# find / -name \*.sh -print
[root@luna ~]# find / -name \*.sh -print
/home/data/tools/rd/RDService/scripts/createZipArchive.sh
/home/data/tools/rd/RDService/scripts/createImgArchive.sh
find: `/home/data/lost+found': Permission denied
^C
[root@luna ~]# 

It seems to be an autofs-related issue.

  • 1
    Hi, welcome on Super User. I have the same version of find on another distribution.Mine is working as expected. Please run again find / -name \*.sh -print and when it exits, write echo $? to understand if it is crashed. – Hastur Nov 16 '15 at 15:59
  • I too run the same find version on ArchLinux amd64. It works perfectly on my system. – MariusMatutiae Nov 16 '15 at 16:03
  • So, it seems like the first time you run find the file-system is simply not mounted, but by the second time autofs has done its thing? If so, I think it's functioning as expected. – ams Nov 19 '15 at 14:28
  • When the filesystem is not mounted and I accessed it, it should be mounted and accessible, I think. git version of findutils has been already fixed. – masm Nov 20 '15 at 6:00
0

It seems to be fixed with findutils 4.6.0 in arch linux.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.