Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Running ltrace isn't trivial. This RHEL 5.3 system has based on a Tomcat Catalina (servlet container) which uses text scripts to tie everything together. When I tried to find an executable here's the rabbit hole I went down:

/etc/init.d/pki-ca9 calls dtomcat5-pki-ca9

#Path to the tomcat launch script (direct don't use wrapper)

/usr/bin/dtomcat5-pki-ca9 calls a watchdog program

/usr/bin/nuxwdog -f $FNAME

I replaced nuxwdog with a wrapper

[root@qantas]# cat /usr/bin/nuxwdog
ltrace -e open -o /tmp/ltrace.$(date +%s) /usr/bin/nuxwdog.bak $@

[root@qantas]# service pki-ca9 start
Starting pki-ca9:              [  OK  ]

[root@qantas]# cat /tmp/ltrace.1295036985
+++ exited (status 1) +++

This is ugly. How do I run strace or ltrace in tomcat?


Here is the tomcat "process"

[root@qantas]# ps -ef | grep tomcat
pkiuser  21767 21766  0 10:10 ?        00:00:09 /usr/lib/jvm/jre/bin/java
 -classpath :/usr/lib/jvm/jre/lib/rt.jar:/usr/share/java/commons-
jmx.jar:/usr/share/tomcat5/common/lib/nuxwdog.jar -Dcatalina.base=/var/lib/pki-ca11
 org.apache.catalina.startup.Bootstrap start

Here are all the children

[root@qantas]# pstree -A -p 21767

This is what happens when I try to start ltrace on the text script

[root@qantas]# ltrace /usr/bin/dtomcat5-pki-ca11
ltrace: Can't open ELF file "/usr/bin/dtomcat5-pki-ca11"

When I attach ltrace to the parent and let it run for a day there is no output

[root@qantas]# ltrace -e open -o /tmp/ltrace.1295465058 -p 21767

...24 hours later...

[root@qantas]# ls -l /tmp/ltrace.1295465058
-rw-r--r-- 1 root root 0 Jan 19 11:24 /tmp/ltrace.1295465058
share|improve this question
I just gotta ask, why are you running strace on a JVM? What exactly are you looking for that you need to be at that level to find it? – Corey S. Jan 20 '11 at 18:27
I will answer your question with a question – flashnode Jan 20 '11 at 18:54
I tried everything. I don't have the time to pursue the answer. – flashnode Jan 27 '11 at 17:25
up vote 5 down vote accepted

Unless you need to trace something in the startup process, strace and ltrace both have a -p parameter which attaches to an existing process and begins tracing it. Once tomcat is running, you would get the process id from ps, and run

strace -p 1234 -e open -o outputfile


ltrace -p 1234 -e open -o outputfile

where 1234 is the process ID.

The other option, if these "text files" are shell scripts, you should be able to

strace -f -e whatever -o whatever

strace will begin tracing the shell executed to run the script, the -f will tell it to follow as it forks and executes each command. You'll need to filter through the output to figure out which process is which program (using -ff instead of -f will help).

share|improve this answer

I don't know what version of Tomcat you are running, so I'm going to take a swag here. It looks like you're running a Tomcat that might be embedded with some other application -- the init scripts seem unusual to me.

However, at the core in a stock Tomcat installation there is $CATALINA_BASE/bin/ That script can be used (and is often time wrapped by other scripts) to start, stop in a daemon configuration or run Tomcat from the console.

If you look at the current 6.x, at line 306 (297 if you are using security manager), you'll see this:

... snip ...

Would it be possible to insert your ltrace or strace between exec and "$_RUNJAVA"?

Then you can do ./ run and watch the strace (and your Tomcat stdout) scroll by in hopes you find what you are looking for.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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