2
touch /tmp/debug.log
LD_DEBUG=all LD_DEBUG_OUTPUT=/tmp/debug.log ls

After doing this I expect debug info to be written to the /tmp/debug.log file, but it is empty.

Ubuntu 20.04

2
  • The output file (presumably) got created, so the problem is probably with the all option. Try LD_DEBUG=help ls, as the Oracle (Solaris) version documentation does not even show all as an option. It is also possible (for example) that your ls is being found in BusyBox, which may be statically linked, so try a different command, like stat. Commented Jun 26 at 7:27
  • With respect to @telcoM answer, did you create your own /tmp/debug.log as empty, or reported it was empty when it was actually not found? Commented Jun 26 at 7:32

1 Answer 1

5

The LD_* environment variables are described in the ld.so(8) man page.

For LD_DEBUG_OUTPUT, it says:

LD_DEBUG_OUTPUT (since glibc 2.1)

By default, LD_DEBUG output is written to standard error. If LD_DEBUG_OUTPUT is defined, then output is written to the pathname specified by its value, with the suffix "." (dot) followed by the process ID appended to the pathname.

So, if you ran the commands you specified in your question, and the process ID (PID) of the ls command happened to be 12345, then the output would be in a file named /tmp/debug.log.12345.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .