0

I try to kill process by using command "kill -9 pid", but can not succeed. Anybody know how could I kill such process and why I can't kill it ?

zjffdu
  • 25,496
  • 45
  • 109
  • 159
  • 2
    A `kill -9` always succeeds, _if you have permission to control that process_. So most likely you do _not_ have permission to control this specific process. You might want to take a look at the `sudo` utility for this. It allows you to raise your privilege level for the kill command. – arkascha Nov 18 '15 at 10:08
  • @arkascha Ever had a process in an uninterruptable sleep (`D`)? – glglgl Nov 18 '15 at 12:37
  • @arkascha actually I start the process, so I think I should have permission to kill it. – zjffdu Nov 19 '15 at 00:54
  • @glglgl What does uninterruptable sleep mean ? The process is a scala code, do you mean it is the sleep in java/scala api ? – zjffdu Nov 19 '15 at 00:55
  • @arkascha `kill -9` can fail if there is an uninterruptable system call in progress. This can be caused by driver limitations or by bugs (kernel or driver) while processing a system call. – janm Nov 19 '15 at 06:47
  • @zjffdu Maybe that process changed permissions? A typical thing for daemons getting started for example. Or maybe you started the process with raised privileges yourself? Just take a look into the process table: who owns the process? – arkascha Nov 19 '15 at 07:26

2 Answers2

1

The process could be zombie? Its good to check process state using ps command as well if you have permission.

Randolf
  • 125
  • 1
  • 9
1

If your process is in an uninterruptable sleep (D) due to hanging in some hardware access, you indeed cannot terminate that process.

Here is another explanation.

Personally, I saw such D states for example when accessing files on a SD card or USB stick when there was a hardware problem. But there are many other scenarios where such a state might occur.

Community
  • 1
  • 1
glglgl
  • 89,107
  • 13
  • 149
  • 217