LinuxQuestions.org
Help answer threads with 0 replies.
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 03-07-2012, 12:23 PM   #1
Ook
Member
 
Registered: Apr 2004
Location: Hell, Arizona (July - 118 degrees)
Distribution: Slackware 14.2 soon to be Slackware 15
Posts: 699

Rep: Reputation: 131Reputation: 131
How to kill a task when the task won't die?


Slackware 64 bit current, 3.2.2 kernel.

From time to time I need to kill a task. Most of the time this works as expected, but sometimes it does not. I try it from top, nothing happens. I go into htop, and try different kill signals, including 9 sigkill. The task keeps running. I issue kill <pid>, and it still keeps running.

Is there a way to forcibly kill a task, die now, remove it from cpu scheduler queue, just shut up and do it fer cryin' out loud? What do you do when kill won't kill the task, or how do you force a task to be killed no matter what?

Yes, I'm doing this as root.
 
Old 03-07-2012, 12:28 PM   #2
samac
Senior Member
 
Registered: Mar 2004
Location: Kirkwall, Orkney
Distribution: Linux Mint 20.3 - Cinnamon
Posts: 1,425

Rep: Reputation: 139Reputation: 139
su to root
ps ax
find the misbehaving PID
then
kill -9 $PID or kill -15 $PID
where $PID is the value of the PID

samac
 
1 members found this post helpful.
Old 03-07-2012, 12:47 PM   #3
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,200

Rep: Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307Reputation: 5307
If you can see the task in X (i.e. if it's a window), then run xkill. Your mouse cursor will turn into a skull and crossbones, and you click on the window you want to terminate.
 
Old 03-07-2012, 02:25 PM   #4
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,281

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
Are you sure you are tring to "kill -9" a running process and not for example a zombie or process did not restarted automatically? If you encounter this again, show output of "ps -A" with relevant line, before and after killing.
 
Old 03-07-2012, 06:08 PM   #5
adriv
Member
 
Registered: Nov 2005
Location: Diessen, The Netherlands
Distribution: Slackware 15
Posts: 700

Rep: Reputation: 43
Mostly I use top for terminating processes.
Press k and then type the PID.
 
Old 03-07-2012, 07:34 PM   #6
escaflown
Member
 
Registered: Apr 2009
Location: Canada
Distribution: Slackware
Posts: 239

Rep: Reputation: 31
Quote:
Originally Posted by adriv View Post
Mostly I use top for terminating processes.
Press k and then type the PID.
same thing here hut with htop.

Last edited by escaflown; 03-07-2012 at 07:36 PM.
 
Old 03-08-2012, 02:34 AM   #7
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467

Rep: Reputation: Disabled
There a couple (probably more) ways that processes refuse to die. They are marked [defunct] or if the process is waiting for hardware.

In the second if hardware is causing a problem sometimes waiting will work. Not always. Sometimes rebooting is the only cure and allows you to for example take out a bad CD/DVD if that was the problem.
 
Old 03-08-2012, 10:46 PM   #8
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,678
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
I have seen processes continue to run (actually use CPU and strace-able) even after I did "kill -KILL" on them from root. But this is very rare (maybe once every 3 years, and it has been 5 years since I last saw this). In all the cases I saw, it was actually a program I wrote that was doing this, and I put nothing in it to try to prevent being killed (I don't even know how to block "kill -KILL"). So I suspect some kernel bug, possibly corruption of the process table. Reboot got rid of it. I reran the program and it killed easily. One perhaps important bit of info: "kill -STOP" really would stop it, and "kill -CONT" would resume it, while "kill -KILL" did nothing at all to it. Strange.
 
Old 03-26-2012, 03:48 PM   #9
Ook
Member
 
Registered: Apr 2004
Location: Hell, Arizona (July - 118 degrees)
Distribution: Slackware 14.2 soon to be Slackware 15
Posts: 699

Original Poster
Rep: Reputation: 131Reputation: 131
Quote:
Originally Posted by samac View Post
su to root
ps ax
find the misbehaving PID
then
kill -9 $PID or kill -15 $PID
where $PID is the value of the PID

samac

I had to kill X the other day,l and kill -9 <pid> did not kill it, neither did kill -15 <pid> kill it. I could not kill it and had to reboot the machine to get rid of it.

What do you do when kill -9/-15 <pid> does not work, other then reboot?
 
Old 03-26-2012, 03:54 PM   #10
Ook
Member
 
Registered: Apr 2004
Location: Hell, Arizona (July - 118 degrees)
Distribution: Slackware 14.2 soon to be Slackware 15
Posts: 699

Original Poster
Rep: Reputation: 131Reputation: 131
Quote:
Originally Posted by escaflown View Post
same thing here hut with htop.
For some reason killing from top and htop does not always work, but exiting them and killing from the command line does. Not sure why.
 
Old 03-27-2012, 08:13 AM   #11
th0gz19
LQ Newbie
 
Registered: Dec 2011
Location: Philippines
Distribution: Slackware, Debian, Gentoo
Posts: 10

Rep: Reputation: Disabled
this happened to me, when i kill a process, i still see them in top.
this is how i do it just in case there are duplicate processes. (sometimes happens with my vlc)

# kill -15 `pidof vlc`

or

$ sudo kill -15 `pidof vlc`

if it didn't work, you can substitute "-15" with "-9".
 
  


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
kernel panic attempted to kill the idle task! in idle task - not syncing dudutworld Linux - Newbie 2 09-16-2013 01:50 PM
Python - Problems when trying to run a task at log on task on windows doomloard Programming 2 06-18-2011 04:31 PM
launching a task from cli and "divorcing it from terminal task wufo Linux - General 6 02-11-2011 11:32 AM
[SOLVED] Kill a hung task when kill -9 doesn't help 10110111 Linux - General 4 04-02-2009 11:10 AM
Apache die after programmed task barDo Linux - Networking 0 02-07-2003 10:04 AM

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

All times are GMT -5. The time now is 03:46 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
Open Source Consulting | Domain Registration