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
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_DEBUGoutput is written to standard error. IfLD_DEBUG_OUTPUTis 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.
alloption. TryLD_DEBUG=help ls, as the Oracle (Solaris) version documentation does not even showallas an option. It is also possible (for example) that yourlsis being found in BusyBox, which may be statically linked, so try a different command, likestat./tmp/debug.logas empty, or reported it was empty when it was actually not found?