aarklon
I was going through the book "Hacking Ubuntu" by Neil Krawetz, in this book it is said that never do kill -9 -1 as root.In my office i tried this command as root on an RHEL4 machine but there was'nt any system crash as i expected only the x-server got crashed, and the commands like ps, ls were n't giving any o/p.when i rebooted the machine everything was back to normal
my question why init process wasn't killed ?
sebastian weisner
"A PID of -1 is special; it indicates all processes except the kill process itself and init."
evets25
My guess would be it's because Ubuntu has shifted away from the traditional init system and moved to something called "upstart." If you're interested in learning more about it, there's a great article on it here,http://www.linux.com/feature/125977.
trickykid
Well, first of all, you should never do a kill -9, you should always try to kill a process gracefully. -9 is always the last resort.As for killing init, pfft... you can't kill init from what I recall. That would just be stupid.
tredegar
Quote:
but there was'nt any system crash as i expected Linux is graceful. What did you expect, your computer to explode, with fireworks?
Quote:
the commands like ps, ls were n't giving any o/p.No, they are not giving any output, because they do not exist.
kenoshi
kill -9 -1 kills all processes owned by the user executing it, except for the shell you executed it from, with exception to root users.
Historically its used by non-root users to clean up after themselves, typically before logoff.
If you are logged in as root and run kill -9 -1 however, only root processes blocking SIGKILL (e.g. kernel threads) will remain. Everything else that belongs to root, including most daemons spawned through runlevel 1 - 5 such as dhclient, sendmail, sshd (you just booted everyone), ntpd, etc, will be killed.
On Redhat/CentOS systems, at runlevel 5 mingetty will be respawned to set up tty 1 - 6. Then the chosen/preferred desktop manager will be respawned via prefdm. Therefore it'll appear as if X server crashed and restored itself.
But if you look at processes closely, you'll see that nothing else is running except for the ttys, kernel threads, and bunch of desktop/gui processes.
This is one of the many many many many reasons why root access should be restricted...I've got horror stories about this one. Sometimes you just gotta learn the hard way I guess...
kill -9 1 doesn't work on Linux...its an old Solaris thing if memory serves.
No comments:
Post a Comment