On multiple computers running Ubuntu 14.XX, I ran the command "killall init" as user, and was immediately logged out. I could log back in again without a problem. Why is this? What's going on behind the scenes?
Asked
Active
Viewed 1,577 times
1 Answers
21
On newer Upstart systems, a session init process is started when you login using the GUI. Since Ubuntu uses Upstart, there's an init process for your session. Test it out using pstree -ps $$ in a terminal:
$ pstree -ps $$
init(1)───lightdm(1741)───lightdm(9511)───init(9526)───/usr/bin/termin(9570)─┬─gnome-pty-helpe(9734)
└──zsh(7944)
So when you run killall init, you're not killing init PID 1 (because you don't have the privilege), but your session init, which would be PID 9526 in this example.
Since this init is the governing process for your GUI session, killing it kills your session and therefore you are logged out.
muru
- 72,889
pkillinstead ofkillallbecausekillallworks completely different on other systems such as Solaris... – glglgl Jan 28 '15 at 08:09killallkills all. Hence the name. – orion Jan 28 '15 at 12:10killall initasrootdoes not seem like a good idea - especially on a useful system - I thinkinitcauses a kernel panic if it dies because it is not intended to ever reach areturnat the end of it'smaincode loop. – SlySven Feb 13 '16 at 17:04systemdanywhere near my equipment) was looking at how to use the man-page indicated FIFO method of talking toinit- I did try switching from sysvinittoupstarton one of my Debian PCs - and hadn't read the small print {not possible, at least not directly like I tried - I had to reboot from a rescue OS on a USB stick, mount and chroot the original system drives and reinstall init - I was not impressed with upstart!} 8-/ – SlySven Feb 19 '16 at 04:09