RonR
Posts: 753
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Raspbian Jessie find command

Wed Apr 13, 2016 6:42 pm

Is there a known problem with the find command under 2016-03-18-raspbian-jessie-lite.img? The first time find is run after a reboot (logging in via SSH), it almost always fails to find a file that's then found on subsequent attempts:

Last login: Wed Apr 13 12:15:53 2016 from gigabyte
[email protected]:~# find / -name res_xmpp.c
[email protected]:~# find / -name res_xmpp.c
/usr/src/asterisk-13.8.0/res/res_xmpp.c
[email protected]:~#

The net result is that you always have to run find twice to be sure the results are accurate.

This does not occur under 2015-05-05-raspbian-wheezy.img.

User avatar
Douglas6
Posts: 4801
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Raspbian Jessie find command

Wed Apr 13, 2016 6:47 pm

I've noticed the same thing.

User avatar
jojopi
Posts: 3108
Joined: Tue Oct 11, 2011 8:38 pm

Re: Raspbian Jessie find command

Wed Apr 13, 2016 9:12 pm

I cannot conveniently reboot any of my Pies at the moment, and I am not using the lite image, and I do not have FreePBX or asterisk installed.

I do have a diagnostic suggestion:

Code: Select all

sudo apt-get update && sudo apt-get install strace
sudo reboot
sudo sysctl -w kernel.randomize_va_space=0
strace -o TRY1 find / -name res_xmpp.c
strace -o TRY2 find / -name res_xmpp.c
diff -u TRY1 TRY2 |less
strace records all the system calls issued by the commands. Disabling kernel address space layout randomization reduces the differences to just those involving timestamps, process ids, or actual logic changes. The results from diff may then give some clue as to why the output from the second run differs.

(One thing that might break find is improper use of inotify by an unrelated process.)

User avatar
Douglas6
Posts: 4801
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Raspbian Jessie find command

Wed Apr 13, 2016 9:56 pm

jojopi wrote:I cannot conveniently reboot any of my Pies at the moment, and I am not using the lite image, and I do not have FreePBX or asterisk installed.
It's not related to Jessie Lite, or FreePBX or asterisk. I first posted about it here, viewtopic.php?p=917227#p917227, on a fairly fresh full Jessie install (searching for bluetoothd).

RonR
Posts: 753
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Raspbian Jessie find command

Thu Apr 14, 2016 7:23 am

jojopi wrote:The results from diff may then give some clue as to why the output from the second run differs.
I ran your diagnostic suggestion, but the text file output of diff is over 7 megabytes! It compresses to only 187,954 bytes, but the attachment limit is 64KB. The attached ZIP file contains the first 2,793,673 bytes of it.

I'll have to rely on your analysis as it's over my head at this point.

Thanks for your help!
Attachments
test.zip
(58.1 KiB) Downloaded 35 times

User avatar
RaTTuS
Posts: 10517
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: Raspbian Jessie find command

Thu Apr 14, 2016 7:56 am

RonR wrote:...p!
see
http://pastebin.com/
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

RonR
Posts: 753
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Raspbian Jessie find command

Thu Apr 14, 2016 6:51 pm

RaTTuS wrote:see
http://pastebin.com/
pastebin.com has a 500KB limit unless you purchase a PRO account.

RonR
Posts: 753
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Raspbian Jessie find command

Thu Apr 14, 2016 7:42 pm

jojopi wrote:(One thing that might break find is improper use of inotify by an unrelated process.)
I just tried it on a virgin copy of 2016-03-18-raspbian-jessie-lite.img:

Last login: Thu Apr 14 19:11:29 2016 from gigabyte
[email protected]:~ $ sudo find / -name messages
[email protected]:~ $ sudo find / -name messages
/var/log/messages
[email protected]:~ $

The problem does not occur on a virgin copy of 2016-03-18-raspbian-jessie.img:

Last login: Thu Apr 14 19:36:14 2016
[email protected]:~ $ sudo find / -name messages
/media/pi/eda95d8a-9cdd-4224-96d0-890b4791600c/var/log/messages
/var/log/messages
[email protected]:~ $

The problem appears to be limited to the lite image.

User avatar
jojopi
Posts: 3108
Joined: Tue Oct 11, 2011 8:38 pm

Re: Raspbian Jessie find command

Thu Apr 14, 2016 8:19 pm

The diff is so big because the last 41740 lines (of the 45720 lines you were able to post) happen only on the second run. Prior to this huge difference I do not spot a significant change in the results from getdents64 ("get directory entries").

So I wonder if the first run is simply crashing before it completes. "tail TRY1" should help to confirm this. (Is the first attempt faster than the second? Normally it should be slower, because some of the disk accesses will be cached on the second run.)

It seems that both you and Douglas6 in the other thread are running the find under sudo. A side effect of that is to suppress shell diagnostics such as "Segmentation fault" if the escalated process receives a fatal signal.

Do you see the same problem when using neither sudo nor strace? I have still not been able to reproduce this issue myself.

RonR
Posts: 753
Joined: Tue Apr 12, 2016 10:29 pm
Location: US

Re: Raspbian Jessie find command

Fri Apr 15, 2016 2:07 am

jojopi wrote:So I wonder if the first run is simply crashing before it completes. "tail TRY1" should help to confirm this. (Is the first attempt faster than the second?.
The first attempt that fails is faster than the second attempt that succeeds:

-rw-r--r-- 1 root root 5154466 Apr 14 20:58 TRY1
-rw-r--r-- 1 root root 9299393 Apr 14 20:58 TRY2

[email protected]:~# tail TRY1
close(5) = 0
open("..", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_NOFOLLOW) = 5
fstat64(5, {st_mode=S_IFDIR|0700, st_size=0, ...}) = 0
close(5) = 0
fchdir(4) = 0
close(4) = 0
close(1) = 0
close(2) = 0
exit_group(0) = ?
+++ exited with 0 +++
[email protected]:~#
jojopi wrote:It seems that both you and Douglas6 in the other thread are running the find under sudo. A side effect of that is to suppress shell diagnostics such as "Segmentation fault" if the escalated process receives a fatal signal.

Do you see the same problem when using neither sudo nor strace? I have still not been able to reproduce this issue myself.
I run as root without sudo. Your diagnostic suggestion was run as root without sudo. I didn't have strace installed until this discussion.

fruit-uk
Posts: 609
Joined: Wed Aug 06, 2014 4:19 pm
Location: Suffolk, UK

Fri Apr 15, 2016 5:44 am

I have had a vaguely similar problem running locate, with a message that database is 8 days old.
sudo updatedb would hang.
A reinstall of locate and mlocate seems to have cured it

This is on a jessie upgraded wheezy system so not the light version.

edo1
Posts: 151
Joined: Sun Jun 15, 2014 3:33 pm
Location: Russia

Re: Raspbian Jessie find command

Fri Apr 15, 2016 8:52 am

Code: Select all

[email protected]:~# find / >flist1
[email protected]:~# find / >flist2
[email protected]:~# egrep "^/[a-z]+$" flist1
/proc
/lib
/sys
[email protected]:~# egrep "^/[a-z]+$" flist2
/proc
/lib
/sys
/bin
/usr
/media
/srv
/dev
/tmp
/root
/home
/opt
/run
/etc
/sbin
/boot
/var
/mnt
awesome

Return to “Raspbian”