LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-12-2006, 05:46 PM   #1
paddyjoy
Member
 
Registered: Apr 2005
Location: Sydney
Distribution: FC5
Posts: 174

Rep: Reputation: 30
Problem killing process


I'm having a bit of trouble killing a process. I was using rpm to remove a package when the terminal windo froze. So I opened up a new terminal and tried to kill the rpm process but with no luck.

Anyone any ideas?

Thanks
Paddy

Code:
[root@paddy ~]# ps -A | grep rpm
32258 pts/1    00:00:00 rpm
[root@paddy ~]# kill -9 32258
[root@paddy ~]# ps -A | grep rpm
32258 ?        00:00:00 rpm
[root@paddy ~]# kill -15 32258
[root@paddy ~]# ps -A | grep rpm
32258 ?        00:00:00 rpm
[root@paddy ~]# kill -9 32258
[root@paddy ~]# ps -A | grep rpm
32258 ?        00:00:00 rpm
 
Old 01-12-2006, 08:04 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
See what state the process is in with "ps aux ". If it's stuck in uninterruptable sleep (state D) it can't be killed, even with kill -9. I've seen this happen with corrupt RPM databases.
 
Old 01-12-2006, 08:25 PM   #3
paddyjoy
Member
 
Registered: Apr 2005
Location: Sydney
Distribution: FC5
Posts: 174

Original Poster
Rep: Reputation: 30
Thanks for the info, I actually ended up rebooting my machine because I wasn't able to kill the process!

Paddy
 
Old 01-12-2006, 09:07 PM   #4
Electro
LQ Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
It is better to use kill code 15 before using kill code 9 to force the program to quit. Kill code 15 means terminate, so it is the same as hitting CTRL+C. Sending kill code 9 to a program sometimes turns it into a zombie. A zombie process will not take up resources but a reboot is the only way to get rid of it.

Some processes, you will have to terminate or kill its parent PID.
 
Old 01-12-2006, 10:45 PM   #5
paddyjoy
Member
 
Registered: Apr 2005
Location: Sydney
Distribution: FC5
Posts: 174

Original Poster
Rep: Reputation: 30
Thanks I'll remember that for next time. It's annoying when a program like rpm or yum gets zombied like this because it locks some files and the only thing I can do is reboot before I can use that program again.

Paddy
 
Old 01-12-2006, 11:12 PM   #6
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
Quote:
Originally Posted by paddyjoy
Thanks I'll remember that for next time. It's annoying when a program like rpm or yum gets zombied like this because it locks some files and the only thing I can do is reboot before I can use that program again.
Zombies happen when a parent forks a child process and the child dies. The child becomes a zombie until either (1) the parent executes a wait() command on the child, or (2) the parent dies. The "parent executes a wait()" scenerio is where the somewhat morbid recommendation that "Parents should reap their dead children" comes from. The next time you zombie a process and can't seem to get rid of it, try logging off and back on again. That may kill the parent, thus freeing the zombie without a reboot. I'm not really familiar with the workings of rpm (I use Debain and dpkg/apt-get), but you can see after your first kill attempt at rpm that it looses it's controlling TTY (was "pts/1" before the kill, then "?" after the kill). I always that zombies showed up in a ps listing as "<defunct>". That's the way it's been for years on many different Unix systems I've worked with. Don't know specifically about Linux though. I haven't been using Linux all that long and haven't looked closely.
 
Old 01-12-2006, 11:20 PM   #7
paddyjoy
Member
 
Registered: Apr 2005
Location: Sydney
Distribution: FC5
Posts: 174

Original Poster
Rep: Reputation: 30
Thanks I'm going to try and reproduce it again so that I can test out the different methods of resolving it. After the first kill attempt wasn't successful I killed/closed the terminal window that had frozen, thats when the pts/1 changed to ? I was hoping at the time that killing the parent would also kill the child rpm process. It usually does but maybe this was just a freak occurence!

Paddy
 
  


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
Killing a process by its name rabeea Linux - Networking 3 03-17-2005 05:30 AM
Killing child process coolfrog Programming 3 09-28-2004 02:58 PM
Killing/Ending a process james_cwy Linux - Newbie 6 12-16-2003 09:45 PM
Killing Process probs collen Linux - General 4 09-16-2003 09:18 AM
Really Killing a Process! lazlow69 Linux - Newbie 14 05-10-2003 10:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:18 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