Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How do you kill a process *no matter what* ?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo Chat
View previous topic :: View next topic  
Author Message
Promit
Guru
Guru


Joined: 15 Nov 2003
Posts: 344

PostPosted: Tue Dec 23, 2003 12:40 am    Post subject: How do you kill a process *no matter what* ? Reply with quote

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
View user's profile Send private message
xoomix
Guru
Guru


Joined: 02 Jan 2003
Posts: 489

PostPosted: Tue Dec 23, 2003 12:44 am    Post subject: Reboot Reply with quote

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
View user's profile Send private message
xoomix
Guru
Guru


Joined: 02 Jan 2003
Posts: 489

PostPosted: Tue Dec 23, 2003 12:47 am    Post subject: Oh yeah -- Reply with quote

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
View user's profile Send private message
Flolp
n00b
n00b


Joined: 02 Jul 2003
Posts: 26

PostPosted: Tue Mar 16, 2004 11:03 am    Post subject: Reply with quote

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
View user's profile Send private message
Vulpes_Vulpes
Apprentice
Apprentice


Joined: 10 Dec 2003
Posts: 264
Location: Amsterdam

PostPosted: Tue Mar 16, 2004 11:08 am    Post subject: Reply with quote

Maybe you want to take a look at psDoom. 8) ;)
Back to top
View user's profile Send private message
Flolp
n00b
n00b


Joined: 02 Jul 2003
Posts: 26

PostPosted: Tue Mar 16, 2004 11:23 am    Post subject: Reply with quote

*LOL* quite a good Idea. I'll install it and see if the BFG does the job :twisted:
Back to top
View user's profile Send private message
Bastux
Guru
Guru


Joined: 15 Dec 2002
Posts: 369
Location: France - Paris

PostPosted: Tue Mar 16, 2004 11:23 am    Post subject: Reply with quote

-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
View user's profile Send private message
ed0n
l33t
l33t


Joined: 23 Apr 2003
Posts: 638
Location: Prishtine/Kosove

PostPosted: Tue Mar 16, 2004 11:35 am    Post subject: Reply with quote

killall -9 process
Back to top
View user's profile Send private message
Flolp
n00b
n00b


Joined: 02 Jul 2003
Posts: 26

PostPosted: Tue Mar 16, 2004 11:52 am    Post subject: Reply with quote

Yes, but what to do if not even kill -9 (or killall) works?
Back to top
View user's profile Send private message
Roguelazer
Veteran
Veteran


Joined: 10 Feb 2003
Posts: 1233
Location: San Francisco, CA

PostPosted: Tue Mar 16, 2004 11:52 am    Post subject: Reply with quote

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
View user's profile Send private message
Flolp
n00b
n00b


Joined: 02 Jul 2003
Posts: 26

PostPosted: Tue Mar 16, 2004 12:00 pm    Post subject: Reply with quote

*lol* How about calling this one "MG": "Machine Giller"
Back to top
View user's profile Send private message
NiklasH
Apprentice
Apprentice


Joined: 30 Aug 2002
Posts: 211
Location: On top of something

PostPosted: Tue Mar 16, 2004 12:51 pm    Post subject: Reply with quote

A puny
Code:
kill -9
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
View user's profile Send private message
georwell
Guru
Guru


Joined: 25 Jun 2003
Posts: 430
Location: Uppsala, Sweden

PostPosted: Tue Mar 16, 2004 1:44 pm    Post subject: Reply with quote

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
View user's profile Send private message
sapphirecat
Guru
Guru


Joined: 15 Jan 2003
Posts: 376

PostPosted: Tue Mar 16, 2004 4:47 pm    Post subject: Re: Oh yeah -- Reply with quote

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
View user's profile Send private message
Phant0m51
Tux's lil' helper
Tux's lil' helper


Joined: 30 Mar 2003
Posts: 105

PostPosted: Tue Mar 16, 2004 6:27 pm    Post subject: Reply with quote

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
View user's profile Send private message
Lews_Therin
l33t
l33t


Joined: 03 Oct 2003
Posts: 657
Location: Banned

PostPosted: Tue Mar 16, 2004 6:30 pm    Post subject: Reply with quote

If it just won't die, use The Button.
Back to top
View user's profile Send private message
reek
n00b
n00b


Joined: 13 Oct 2003
Posts: 4

PostPosted: Tue Mar 16, 2004 7:57 pm    Post subject: Reply with quote

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
View user's profile Send private message
Lews_Therin
l33t
l33t


Joined: 03 Oct 2003
Posts: 657
Location: Banned

PostPosted: Tue Mar 16, 2004 9:07 pm    Post subject: Reply with quote

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 :lol:
Back to top
View user's profile Send private message
Roguelazer
Veteran
Veteran


Joined: 10 Feb 2003
Posts: 1233
Location: San Francisco, CA

PostPosted: Tue Mar 16, 2004 9:10 pm    Post subject: Reply with quote

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
View user's profile Send private message
Uranus
Guru
Guru


Joined: 07 May 2002
Posts: 438
Location: Portugal, Braga

PostPosted: Tue Mar 16, 2004 11:38 pm    Post subject: Reply with quote

dude that psdoom looks cool! Is there an ebuild out there?
Back to top
View user's profile Send private message
Epyon
l33t
l33t


Joined: 11 Sep 2003
Posts: 754
Location: NJ, USA

PostPosted: Wed Mar 17, 2004 1:09 am    Post subject: Reply with quote

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
View user's profile Send private message
lightvhawk0
Guru
Guru


Joined: 07 Nov 2003
Posts: 388

PostPosted: Wed Mar 17, 2004 4:02 am    Post subject: Reply with quote

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
View user's profile Send private message
sapphirecat
Guru
Guru


Joined: 15 Jan 2003
Posts: 376

PostPosted: Wed Mar 17, 2004 4:27 am    Post subject: Reply with quote

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
View user's profile Send private message
dontremember
Apprentice
Apprentice


Joined: 21 Sep 2002
Posts: 151
Location: Oklahoma

PostPosted: Wed Mar 17, 2004 6:16 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo Chat All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum