Why lsof Complains About tracefs - Troubleshooting Guide


Every execution of lsof issues a warning about the TraceFS:

$ lsof any-file
lsof: WARNING: can't stat() tracefs file system /sys/kernel/debug/tracing
      Output information may be incomplete.

$ mount | grep trace
tracefs on /sys/kernel/debug/tracing type tracefs (rw,relatime)

(This is on Ubuntu 15.10, fully updated)

Is it normal for TraceFS to be mounted during normal operation?
If so, how can I tell lsof to skip it?

Best Answer

The answer to your question is in the file permissions:


$ ls -l /sys/kernel/debug/tracing
ls: cannot access '/sys/kernel/debug/tracing': Permission denied
$ ls -l /sys/kernel
total 0
drwx------  31 root root    0 2016-06-15 11:06:47 debug

So, normal users are not allowed to access /sys/kernel/debug/tracing and there seems to be no way to ask lsof to avoid accessing it.

We could then discuss whether this is a bug or not, but the answer to your question boils down to this.

Related Question