View previous topic :: View next topic |
Author |
Message |
Promit Guru
Joined: 15 Nov 2003 Posts: 344
|
Posted: Tue Dec 23, 2003 12:40 am Post subject: How do you kill a process *no matter what* ? |
|
|
How can you absolutely force a process kill, regardless of its status (zombied, orphaned, etc.) or what it's doing? I want a process DEAD and I don't care what goes down with it... _________________ Windows, Linux, whatever. |
|
Back to top |
|
|
xoomix Guru
Joined: 02 Jan 2003 Posts: 489
|
Posted: Tue Dec 23, 2003 12:44 am Post subject: Reboot |
|
|
sadly, even in Linux processes can become completely unresponsive and only changing runlevels or rebooting will clear it. Kill -9 is your best bet -- if that doesn't work, telinit to a lower runlevel than you are at and then telinit back up, or reboot. |
|
Back to top |
|
|
xoomix Guru
Joined: 02 Jan 2003 Posts: 489
|
Posted: Tue Dec 23, 2003 12:47 am Post subject: Oh yeah -- |
|
|
Zombie processes you might have more luck with -- zombied processes are just proceses that have had their parent processes terminated prematurely. If you can find out what the parent process was and restart it, you may be able to get it to kill the child or zombie process by stopping the parent correctly. |
|
Back to top |
|
|
Flolp n00b
Joined: 02 Jul 2003 Posts: 26
|
Posted: Tue Mar 16, 2004 11:03 am Post subject: |
|
|
Hmmm I experienced that I get rid of processes like this if I kill their parents, for example my X Server. Sideeffect: All my processes running in graphical terminals go down.
Isn't there any way to do what the dying parent does on the process manually? *sigh* |
|
Back to top |
|
|
Vulpes_Vulpes Apprentice
Joined: 10 Dec 2003 Posts: 264 Location: Amsterdam
|
Posted: Tue Mar 16, 2004 11:08 am Post subject: |
|
|
Maybe you want to take a look at psDoom. |
|
Back to top |
|
|
Flolp n00b
Joined: 02 Jul 2003 Posts: 26
|
Posted: Tue Mar 16, 2004 11:23 am Post subject: |
|
|
*LOL* quite a good Idea. I'll install it and see if the BFG does the job |
|
Back to top |
|
|
Bastux Guru
Joined: 15 Dec 2002 Posts: 369 Location: France - Paris
|
Posted: Tue Mar 16, 2004 11:23 am Post subject: |
|
|
-8<---8<---TIP---8<---8<---
il you want to kill an app (e.g. firefox) and you don't want to look for its PID, just type :
Code: |
killall -s KILL firefox
|
same effect as kill -9 but you call it with its name instead of its PID
Pros :
more convenient
Cons :
Kill ALL apps with that name, not just the one that crashed
It's usefull sometimes, not sure everybody knew that tip so...
-8<---8<---TIP---8<---8<--- |
|
Back to top |
|
|
ed0n l33t
Joined: 23 Apr 2003 Posts: 638 Location: Prishtine/Kosove
|
Posted: Tue Mar 16, 2004 11:35 am Post subject: |
|
|
killall -9 process |
|
Back to top |
|
|
Flolp n00b
Joined: 02 Jul 2003 Posts: 26
|
Posted: Tue Mar 16, 2004 11:52 am Post subject: |
|
|
Yes, but what to do if not even kill -9 (or killall) works? |
|
Back to top |
|
|
Roguelazer Veteran
Joined: 10 Feb 2003 Posts: 1233 Location: San Francisco, CA
|
Posted: Tue Mar 16, 2004 11:52 am Post subject: |
|
|
I do this, just to be certain:
Code: |
while (true); do killall -9 $process; done
|
When it starts throwing "No process killed" messages, it's finished. I use this because sometimes things like mplayer take 20 or 30 kill messages to get the point. _________________ Registered Linux User #263260 |
|
Back to top |
|
|
Flolp n00b
Joined: 02 Jul 2003 Posts: 26
|
Posted: Tue Mar 16, 2004 12:00 pm Post subject: |
|
|
*lol* How about calling this one "MG": "Machine Giller" |
|
Back to top |
|
|
NiklasH Apprentice
Joined: 30 Aug 2002 Posts: 211 Location: On top of something
|
Posted: Tue Mar 16, 2004 12:51 pm Post subject: |
|
|
A puny is no match for a stale NFS mount.
How the f*ck do you kill an NFS mount where the server has gone down or changed IP?
Is it even possible?
I can't even reboot without the famous Alt+SysRq+B when one of those has hung. _________________ Banana Republic |
|
Back to top |
|
|
georwell Guru
Joined: 25 Jun 2003 Posts: 430 Location: Uppsala, Sweden
|
Posted: Tue Mar 16, 2004 1:44 pm Post subject: |
|
|
Quote: | How the f*ck do you kill an NFS mount where the server has gone down or changed IP? |
It is a very long process of unmount, unmount, unmount.... usually works for me. But damn NFS is damn near impossible to stop sometimes. I feel your pain. |
|
Back to top |
|
|
sapphirecat Guru
Joined: 15 Jan 2003 Posts: 376
|
Posted: Tue Mar 16, 2004 4:47 pm Post subject: Re: Oh yeah -- |
|
|
kiosk wrote: | Zombie processes you might have more luck with -- zombied processes are just proceses that have had their parent processes terminated prematurely. If you can find out what the parent process was and restart it, you may be able to get it to kill the child or zombie process by stopping the parent correctly. |
No, zombie processes are processes that have called exit, but their parent is still active and hasn't called wait for them. They can be reaped by killing the parent, but that doesn't have to be done "correctly" to kill the zombie. As long as the parent is gone, it'll get reparented to init which will call wait on it. _________________ Former Gentoo user; switched to Kubuntu 7.04 when I got sick of waiting on gcc. Chance of thread necro if you reply now approaching 100%... |
|
Back to top |
|
|
Phant0m51 Tux's lil' helper
Joined: 30 Mar 2003 Posts: 105
|
Posted: Tue Mar 16, 2004 6:27 pm Post subject: |
|
|
Of course, if you do want to know the PID of a process, you can just:
pidof (process)
As long as you know the name of the process, that is... |
|
Back to top |
|
|
Lews_Therin l33t
Joined: 03 Oct 2003 Posts: 657 Location: Banned
|
Posted: Tue Mar 16, 2004 6:30 pm Post subject: |
|
|
If it just won't die, use The Button. |
|
Back to top |
|
|
reek n00b
Joined: 13 Oct 2003 Posts: 4
|
Posted: Tue Mar 16, 2004 7:57 pm Post subject: |
|
|
Lews_Therin? Are you claiming to be the Penguin Reborn or what?
[edit]
Oh wait, my original question was supposed to be "What is the difference between kill -9 and killall?" I've never used killall and in the linux class I took I was only told about kill -9. I'd check the man pages on my linux box but it's at home and my windows and linux boxes are suddenly battling over the same IP address and I haven't fixed it yet.
[/edit] |
|
Back to top |
|
|
Lews_Therin l33t
Joined: 03 Oct 2003 Posts: 657 Location: Banned
|
Posted: Tue Mar 16, 2004 9:07 pm Post subject: |
|
|
reek wrote: | Lews_Therin? Are you claiming to be the Penguin Reborn or what?
[edit]
Oh wait, my original question was supposed to be "What is the difference between kill -9 and killall?" I've never used killall and in the linux class I took I was only told about kill -9. I'd check the man pages on my linux box but it's at home and my windows and linux boxes are suddenly battling over the same IP address and I haven't fixed it yet.
[/edit] |
Kill -9 kills a single process, and does it no matter what the outcome might be. It's basically a power switch for processes. Killall kills multiple processes...if you have 3 Eterms open, you can do a killall Eterm and bring them all down.
And of course I am the Penguin reborn |
|
Back to top |
|
|
Roguelazer Veteran
Joined: 10 Feb 2003 Posts: 1233 Location: San Francisco, CA
|
Posted: Tue Mar 16, 2004 9:10 pm Post subject: |
|
|
Sadly, many processes ignore kill -9 or killall -9. Like mplayer. Open mozilla with mplayerplug-in, go to some trailer site and start a movie playing. Then do a "killall mozilla" from the command line. mozilla dies, mplayer goes zombie. Both processes ignore kill -9 and killall -9. You can sometimes get away with my while statement, but usually they just ignore. I happened across this bug when mplayer caused mozilla to crash without giving a segfault, it just vanished off screen... _________________ Registered Linux User #263260 |
|
Back to top |
|
|
Uranus Guru
Joined: 07 May 2002 Posts: 438 Location: Portugal, Braga
|
Posted: Tue Mar 16, 2004 11:38 pm Post subject: |
|
|
dude that psdoom looks cool! Is there an ebuild out there? |
|
Back to top |
|
|
Epyon l33t
Joined: 11 Sep 2003 Posts: 754 Location: NJ, USA
|
Posted: Wed Mar 17, 2004 1:09 am Post subject: |
|
|
Roguelazer wrote: | Sadly, many processes ignore kill -9 or killall -9. Like mplayer. Open mozilla with mplayerplug-in, go to some trailer site and start a movie playing. Then do a "killall mozilla" from the command line. mozilla dies, mplayer goes zombie. Both processes ignore kill -9 and killall -9. You can sometimes get away with my while statement, but usually they just ignore. I happened across this bug when mplayer caused mozilla to crash without giving a segfault, it just vanished off screen... |
Yeah thats really annoying |
|
Back to top |
|
|
lightvhawk0 Guru
Joined: 07 Nov 2003 Posts: 388
|
Posted: Wed Mar 17, 2004 4:02 am Post subject: |
|
|
kill a zombie = reboot/maybe stop and start it via STOP/CONT signals
NFS try kill -2 or -3 _________________ If God has made us in his image, we have returned him the favor. - Voltaire |
|
Back to top |
|
|
sapphirecat Guru
Joined: 15 Jan 2003 Posts: 376
|
Posted: Wed Mar 17, 2004 4:27 am Post subject: |
|
|
Roguelazer wrote: | Sadly, many processes ignore kill -9 or killall -9. |
If that's true, that's a major bug.
signal(7) wrote: | The signals SIGKILL and SIGSTOP cannot be caught, blocked, or ignored. |
Of course, zombies can't be killed, but that's the way the system was designed. They're rather minimal structures kept in a separate tasklist (at least for 2.6, I'm not so familiar with the 2.4 scheduler) anyway, so it doesn't really hurt much to have them lying around. _________________ Former Gentoo user; switched to Kubuntu 7.04 when I got sick of waiting on gcc. Chance of thread necro if you reply now approaching 100%... |
|
Back to top |
|
|
dontremember Apprentice
Joined: 21 Sep 2002 Posts: 151 Location: Oklahoma
|
Posted: Wed Mar 17, 2004 6:16 am Post subject: |
|
|
loonxtall wrote: | Roguelazer wrote: | Sadly, many processes ignore kill -9 or killall -9. |
If that's true, that's a major bug.
signal(7) wrote: | The signals SIGKILL and SIGSTOP cannot be caught, blocked, or ignored. |
Of course, zombies can't be killed, but that's the way the system was designed. They're rather minimal structures kept in a separate tasklist (at least for 2.6, I'm not so familiar with the 2.4 scheduler) anyway, so it doesn't really hurt much to have them lying around. |
I think you'll find that SIGKILL and SIGSTOP cannot be caught, blocked, or ignored is not true if the process is in a device-wait state. For example, a backup program might command a tape drive to forward space by a number of blocks - it will then be waiting for the device to become ready again and will be unkillable. Once the device responds, the kill should get through and terminate the program.
Under some circumstances, however, the device may not ever respond, so the program never gets the kill. |
|
Back to top |
|
|
|