Indiana University
University Information Technology Services
  
What are archived documents?
Login>>
Login

Login is for authorized groups (e.g., UITS, OVPIT, and TCC) that need access to specialized Knowledge Base documents. Otherwise, simply use the Knowledge Base without logging in.

Close

In Unix, why can't I kill certain background processes even with kill -9?

Occasionally you will have a process in Unix that you want to kill but cannot. This generally happens with SUID (Set User ID) processes, which are programs that assume (or allow assumption of, depending on particulars of the operating system) the file owner's UID when started. (Technically, the process's "effective" UID is set. The "real" UID is always yours.)

As soon as you run such a program, you no longer own the process. Many network-based applications run this way to take advantage of direct device access. This assumes that the user programs which have been SUID'd will behave properly and are written in a secure fashion.

Occasionally you will run into a situation where the SUID process does not behave properly. To kill a process like this, you must regain interactive control of the process or kill the parent process of the hung process.

To regain control of a backgrounded process, you need to bring the jobs it is associated with into the foreground. List the jobs you have running by entering the jobs command at your prompt: jobs You should see output similar to this: [1]+ Stopped emacs19 [2]- Running ping -l deathstar To regain control of the ping command use the fg command: fg %x Replace  x  with the number of the job in the listing. Often, you will not need to include the  %  (percent sign).

Once you have regained terminal control of the process, send an interrupt to the process by pressing Ctrl-c . This should stop the process and return you to the shell. If it does not, try sending a quit signal to the process by pressing Ctrl-\  (backslash).

Note: Some programs, such as Pine and Emacs, will not respond to either of these signals, but typically have their own commands to stop their processes.

If neither of these control key sequences work, try stopping the process by killing its parent process. On System V implementations, which include all UITS central systems, you can list your processes with parent process IDs included by entering: ps -fu username Replace username with your username. The equivalent BSD command is: ps xl

This will list all of your processes and their process IDs (PID in the listing) and parent process IDs (PPID in the listing). Locate the original process you are trying to kill, and send a HUP (Hangup) signal to it. Do this by entering: kill -HUP <PPID>

Replace <PPID> with the parent process ID.

If you've already detached the process (e.g., backgrounded it and logged out), all you can do is hope that it runs into a problem where it terminates itself (rather likely), or request the system administrators to kill the process for you. At Indiana University, you can notify the system administrators of the problem by posting to the ucs.system newsgroup or by sending email to  ithelp@iu.edu .

At Indiana University, for personal or departmental Linux or Unix systems support, see At IU, how do I get support for Linux or Unix?

This is document actl in domain all.
Last modified on August 22, 2008.

Comments/Questions/Corrections

Use this form to offer suggestions, corrections, and additions to the Knowledge Base. We welcome your input!

If you are affiliated with Indiana University and would like assistance with a specific computing problem, please use the Ask a Consultant form, or contact your campus Support Center.

Contact Information

Note: We will reply to your comment at this address. If your message concerns a problem receiving email, please enter an alternate email address.