LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-23-2019, 03:03 PM   #1
hedron
Member
 
Registered: Jul 2009
Location: NYC
Distribution: Slackware64-multilib 14.2, SARPI
Posts: 331

Rep: Reputation: 30
how to kill stubborn processes


I've used:

Code:
kill -9 1234
But that never seem to work. This usually revolves around copy operations, but not always.

I have search the web about this issue numerous times in the past, and I have never found an adequate solution. The only one being to simply reboot the computer.

Is there a better way? How would I see what operations are involved in the process and then kill -9 them?
 
Old 10-23-2019, 03:29 PM   #2
volkerdi
Slackware Maintainer
 
Registered: Dec 2002
Location: Minnesota
Distribution: Slackware! :-)
Posts: 1,788

Rep: Reputation: 5742Reputation: 5742Reputation: 5742Reputation: 5742Reputation: 5742Reputation: 5742Reputation: 5742Reputation: 5742Reputation: 5742Reputation: 5742Reputation: 5742
If -9 won't kill it then it is probably already dead (aka a "zombie process"). The way to get those out of the process table is to kill the parent process that spawned it.
 
5 members found this post helpful.
Old 10-23-2019, 04:04 PM   #3
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,302

Rep: Reputation: 712Reputation: 712Reputation: 712Reputation: 712Reputation: 712Reputation: 712Reputation: 712
@hedron

Just adding, there is a rare level of "stubbornness" a process might turn into:
https://en.wikipedia.org/wiki/Sleep_...ruptible_sleep

Check the state of the process you want to kill with ps and if you get a Z - it's pretty much zombified, look after its parent. If it's D - well, send kill signals, wait, and if nothing happens use the "three-finger salute".
Here you can get an actual process state codes table:
https://unix.stackexchange.com/quest...-in-ps-command
or directly from the proc man page ( (3) state %c - section)
http://man7.org/linux/man-pages/man5/proc.5.html
 
Old 10-23-2019, 04:46 PM   #4
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,671

Rep: Reputation: 764Reputation: 764Reputation: 764Reputation: 764Reputation: 764Reputation: 764Reputation: 764
kill -9 ( SIGKILL ) is really a last ditch attempt

you should try -2 ( SIGINT ) first ( that is what Ctrl+C sends )
if that fails -15 ( SIGTERM ), that asks the process to terminate

as @volkerdi points out, it is could be a zombie

https://en.wikipedia.org/wiki/Zombie_process

to figure out if it is a zombie, check ( top ) the status column is usually to the left of CPU% , look for Z ( PgDown/PgUp or Down/Up arrow )

As they are undead you cannot kill them, typically they are only around for a short time and are perfectly normal.
However, if you find a particular program/script often spawns "long lived" Zombies you should investigate and possibly discontinue use of it in favour of an earlier/later version that does not exhibit such bad behaviour.

for the most part they are harmless, as the zombie is not really doing anything ( although they may be hold onto resources )

some more details on signals ( man 7 signal )

SIGHUP ( -1 ) is worth a mention, you can use that to restart a process
I must admit, I don't think I've used that in quite a while a daemon is best restarted via init script/service


I have found some Python code to behave oddly ( notably git )
where I have had to send SIGINT ( -2 ) SIGTSTP ( -20 ) SIGCONT ( -18 ) for it to exit cleanly but I've not needed that in a long time.

Edit
Regards "copy operations" is this cp ?
If so I would investigate the health of the hard drive.

Last edited by Firerat; 10-23-2019 at 04:53 PM.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: What Are Zombie Processes And How To Find & Kill Zombie Processes? LXer Syndicated Linux News 0 12-10-2017 05:12 PM
Use only one "kill" to kill father and child processes Xosen Programming 7 08-28-2008 04:33 AM
how to use kill to kill a batch of processes with same name? dr_zayus69 Linux - Software 2 09-03-2005 07:35 PM
stubborn zeroconf BasK Mandriva 14 01-14-2004 05:26 PM
Mozilla being stubborn Dodgy Linux - Software 3 04-27-2003 05:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 03:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration