6

What conditions explain this output:

root@ip:/# find / -name "server.xml" -print
/etc/tomcat7/server.xml
root@ip:/# ls /var/lib/tomcat7/conf/server.xml 
/var/lib/tomcat7/conf/server.xml

I am running this as root, and starting the find from the root directory. I don't understand why the file I show with the "ls" command isn't coming up in the results.

Edit

output of mount:

/dev/xvda1 on / type ext4 (rw)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)

And:

root@ip:/# ls -la /var/lib/tomcat7/conf/
total 196
drwxr-xr-x  4 root root      4096 Apr 29 03:22 .
drwxr-xr-x 95 root root      4096 Apr 29 04:23 ..
drwxrwxr-x  3 root tomcat7   4096 Apr 29 03:22 Catalina
-rw-r--r--  1 root tomcat7   5586 Apr  1 20:32 catalina.properties
-rw-r--r--  1 root tomcat7   1394 Feb 25  2012 context.xml
-rw-r--r--  1 root tomcat7   2370 Jul 12  2012 logging.properties
drwxr-xr-x  2 root tomcat7   4096 Apr 29 03:22 policy.d
-rw-r--r--  1 root tomcat7   6500 Apr  1 20:32 server.xml
-rw-r-----  1 root tomcat7   1530 Feb 25  2012 tomcat-users.xml
-rw-r--r--  1 root tomcat7 152716 Feb 25  2012 web.xml

And:

root@ip-:/# ls -la /var/lib/tomcat7
total 24
drwxr-xr-x  6 root    root    4096 Apr 29 03:22 .
drwxr-xr-x 40 root    root    4096 Apr 29 01:26 ..
drwxr-xr-x  3 tomcat7 tomcat7 4096 Apr 29 03:22 common
lrwxrwxrwx  1 root    root      12 Apr  1 20:32 conf -> /etc/tomcat7
lrwxrwxrwx  1 root    root      17 Apr  1 20:32 logs -> ../../log/tomcat7
drwxr-xr-x  3 tomcat7 tomcat7 4096 Apr 29 03:22 server
drwxr-xr-x  3 tomcat7 tomcat7 4096 Apr 29 03:22 shared
drwxrwxr-x  4 tomcat7 tomcat7 4096 Apr 29 04:20 webapps
lrwxrwxrwx  1 root    root      19 Apr  1 20:32 work -> ../../cache/tomcat7
1
  • Is /var a different partition? Are there any special mount parameters? You might want to post the output of "ls -la /var/lib/tomcat7/conf/" and "mount" - it might help the case, not sure though.
    – superuser0
    Apr 29 '13 at 4:59
7

That would happen if /var/lib/tomcat7/conf is a symbolic link to /etc/tomcat7.

By default, find (the coreutils version anyway) will not follow symlinks. Try with the -L flag:

find -L / -name "server.xml" -print 
4
  • hmm... i get an infinite loop when i run with -L. fwiw, if i do "ls -l" inside of /etc/, tomcat7 is not listed as a link, but as an ordinary directory. or am i misunderstanding you?
    – Jonah
    Apr 29 '13 at 5:14
  • That's strange. What about ls -l /var/lib/ and var/lib/tomcat7?
    – Mat
    Apr 29 '13 at 5:17
  • Ah, ok, the tomcat7 one is culprit, correct?
    – Jonah
    Apr 29 '13 at 5:20
  • Ah! I had misread your question - thought find returned the path in /var/lib. Yes, that symlink is the reason. Still, I don't see a reason for a loop.
    – Mat
    Apr 29 '13 at 5:24

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.