Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have installed a daemon on a kubuntu system, that tries to find a specific config file in a unknown location. Have litterally filled the filesystem with symbolic links to the config file but still it complains "file not found".

Is there some command I can write, that will log all attempts to access non-existent files on harddrive, so I can find where it attempts to look for its file?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

You could use strace on the process if you know its PID:

strace -f -p 123 | tee testoutput.txt

(assuming a pid of 123). The "-f" stands for "follow forks" (simplified said), "-p" says "PID follows". See man strace for more details. In short words, strace tracks all actions the process attempts e.g. in opening files, reading from or writing to them. Best is to redirect the output to a file for analysis -- in my example, this is achieved by piping it to tee, which splits the output to be displayed on the console as well as written to the specified file.

In the output, look for something like

read(51, 0x7f287a7b36f0, 4096)          = -1 EAGAIN (Resource temporarily unavailable)

(Yeah, that's the wrong error -- but the only I could find for now) -- so a read followed by something in parenthesis, then some spaces followed by a "=" and a negative number (= error). I guess you should find something like "ENOTFOUND" to indicate the missing file (don't know the exact error code).

share|improve this answer

Your Answer

 
discard

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.