OK, I don't have SuSE, so I can't tell you exactly how to kill off YaST because it only runs with SuSE. I can provide an example which is very similar though, and you should be able to apply this process to your problem.
Killing Synaptic Package Manager
First thing to note - killing off synaptic if it's half way through installing something may leave your package database in a bad way, and you'll have to fix this somehow. This is just an example!
OK, lets assume synaptic is running, but has locked up. Here's how to kill it using the kill command.
Firstly, synaptic runs with root permissions. This means regular users can't send signals to it - only root can send signals to a process running as root
. Because of this, we need to start a terminal
, and switch to the root user.
There several ways to do this. On systems which allow it, the easiest way is to use the command
You'll be prompted for the root password. If the command is successful, the prompt will probably change to something with the # character at the end.
For systems which disable the root user, such as ubuntu, you can still get a root shell by using this command as a user who is allowed to use sudo:
...and then entering the proper password for sudo. On Ubuntu this is the user's regular password, but it only word for users who are in the "adm" group.
OK, so now you should have a terminal running with a root shell.
The next step is to find out the process ID (PID) of the process which we want to kill.
We know the name of the program - in this case synaptic. There are lots of ways to find the process ID of the process, but we're going to use the time-old ps and grep method. Here's the command:
ps aux |grep -i synaptic
This command lists all processes on the system (this is what "ps aux" does) and then filters that list for the word "synaptic" (this is what the "grep -i synaptic" bit does).
Here's the output I get:
root 6950 1.1 4.9 50496 25504 pts/1 S 12:32 0:02 synaptic
root 7056 0.0 0.1 2892 812 pts/1 R+ 12:36 0:00 grep -i synaptic
Note that I see the grep process as well... grep -i synaptic matches it's own command. Far out. Anyway, the bit we're interested in is the second column of the line for synaptic itself. This is the PID of that process, in this case 6950.
So now we know the process ID to kill, lets kill it. First we'll let kill send the default signal, which is called SIGTERM. This signal will "request" that the program terminates. Maybe the program will ignore this. Lets see. Notice that since we're send the default signal, we don't need to tell kill which signal - we don't provide the -TERM or -15 option.
OK, lets' see if it died.
ps aux |grep -i synaptic
root 7095 0.0 0.1 2892 860 pts/1 R+ 12:40 0:00 grep -i synaptic
You can see that synaptic has vanished. yay - we killed it.
If it had not died, we could have got serious by sending the KILL signal. This doesn't just ask a process to terminate, it tells it. There's no argument with the kill signal. Here's how I would have done it:
I could also have done it this way:
...because the -KILL and the -9 are just different ways to say "use the kill signal".
Now the caveats.
- Sometimes program have more than one process, so you may need to kill several processes to stop a program running.
- You need to search for the name of the program file which is executed to run the program you want to kill. This isn't always the same as the name of the program which you see in the user interface. For example the gnome system monitor program has the program name gnome-system-monitor.
- If a process runs as root, you must kill it as root
- Use kill without the -KILL option first - some programs will intercept this signal and do nice things like saving open files, cleaning up temp files and so on beforer dying. The KILL signal doesn't give programs any chance to do this sort of thing - it just slays those processes immediately.
Hope that wasn't too long and boring.