SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Slackware 14.2 soon to be Slackware 15
Posts: 699
Rep:
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?
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.
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.
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.
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.
Distribution: Slackware 14.2 soon to be Slackware 15
Posts: 699
Original Poster
Rep:
Quote:
Originally Posted by samac
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?
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".
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.