Hi,

On Mon, May 16, 2011 at 10:01:31AM +0200, Christoph Mitasch wrote:
> the idea is actually good, but my experience is that modern Linux
> distros are unable to shutdown with "kill -s INT/PWR".

Well. I consider the default setup of your "modern" Linux distros
broken. So pressing Ctrl+Alt+Del on those does nothing? At all?

> I tested on Debian Squeeze and Ubuntu Natty and it didn't work. What
> distro are you using?

Debian on Debian. Works out of the box. And just for the fun of it:

For reference: On a "normal" system, the Linux kernel sends SIGINT to
PID 1 when a "keyboard interrupt" (Ctrl+Alt+Del) is received. Search for
ctrl_alt_del and kill_cad_pid in the kernel for details.

What actually happens after PID 1 receives the signal is a policy
decision. Let's see how different processes running as PID 1 handle
this (I'm using Debian packages as reference, see those for versions):

* sysvinit (2.88dsf-13.6)

As seen in src/init.c, lines 2429-2441, this just runs the ctrlaltdel
entry from /etc/inittab, which can be configured to shut down the
container.

* upstart (0.6.6-2):

If I see this correctly, in init/main.c, line 453, there is a signal
handle for SIGINT. There even is a default job file to handle this event
at conf/control-alt-delete.conf.

* systemd (25-2):

The code to handle this is in src/manager.c, lines 2120-2132. This
triggers ctrl-alt-del.target, which seems to be an alias for either
halt, reboot or poweroff, maybe based on a symlink?

* runit (2.1.1-6.2):

Handler is in src/runit.c lines 38-41 and seems to trigger a state
transition in lines 220-241. Looks sane.



So it SEEMS that any "modern" init system should handle SIGINT just
fine. If they don't, now would be a good time to find out why...

Have a nice day, Tobias

-- 
My blog: http://blog.23.gs/
GPG-Key 0xE2BEA341 - signed/encrypted mail preferred
http://www.fli4l.de/ - ISDN- & DSL-Router on one disk!
Registered FLI4L-User #00000003

Attachment: signature.asc
Description: Digital signature

------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to