Wchan section in ps output not showing anything

I know that if a process go into D state then it means that it is in uninterruptable state. The process can not be killed by any signal. It will only come out of that state on reboot or if I/O wait is over.

I have many process in D state which shows that there is something wrong in my machine. Also even after reboot they go back to D state. I searched online and find that wchan section in ps output tells on what thing in kernel my process is waiting on.

When i use this command ps axl| grep D i am getting - in wchan column and there is no explanation online what does this means.

This is my sample output for above command.

0     0  69970      1  20   0  25064  1088 -      D    ?          0:00 ls -l

I am not able to understand what - meant in above output.


in the newer linux kernel you see in which kernel function your process is stuck

cat /proc/<pid_numer>/stack

There are several possibly reasons for wchan being reported as - by ps:

  • the process just isn't blocked in the kernel, i.e. it's running (cf. the ps state column)
  • the stack walking procedure fails due to some corner-case or race condition. It may even fail unconditionally, e.g. on kernels that require proper frame-pointer settings but were compiled without them - check that with cat /proc/*/wchan - all 0 output indicates broken wchan support (e.g. currently the case on Fedora 31 and 32)
  • you don't have the necessary ptrace access mode permissions (namely PTRACE_MODE_READ_FSCREDS) - unlikely
  • the symbol lookup fails in the kernel - unlikely

Note that recent ps version read the wchan information from /proc/$pid/wchan which you can access directly by cat as well, for easier testing. That file reads 0 if wchan information retrieval failed, which ps translates to -.

On systems where wchan is broken a substitute is to look at (requires root):

cat /proc/$pid/stack

Or alternatively, consult (doesn't require root privileges):

cat /proc/$pid/syscall

Man page for ps has this info, "-" means the process is running. WCHAN name of the kernel function in which the process is sleeping, a "-" if the process is running, or a "*" if the process is multi-threaded and ps is not displaying threads.