LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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, 02:03 PM   #1
hedron
Member
 
Registered: Jul 2009
Location: NYC
Distribution: Slackware64-multilib 15.0, SARPI, artix
Posts: 401

Rep: Reputation: 32
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, 02:29 PM   #2
volkerdi
Slackware Maintainer
 
Registered: Dec 2002
Location: Minnesota
Distribution: Slackware! :-)
Posts: 2,504

Rep: Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461
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, 03:04 PM   #3
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
@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, 03:46 PM   #4
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
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 03:53 PM.
 
1 members found this post helpful.
  


Reply



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 04:12 PM
Use only one "kill" to kill father and child processes Xosen Programming 7 08-28-2008 03:33 AM
how to use kill to kill a batch of processes with same name? dr_zayus69 Linux - Software 2 09-03-2005 06:35 PM
stubborn zeroconf BasK Mandriva 14 01-14-2004 04:26 PM
Mozilla being stubborn Dodgy Linux - Software 3 04-27-2003 04:01 PM

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

All times are GMT -5. The time now is 10:29 PM.

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
Open Source Consulting | Domain Registration