/etc/init.d/halt is an rc script. It does not have a specific manual page, and its command-line usage is that of all other van Smoorenburg rc scripts, namely one of the conventional start|stop|try-restart|status verbs as a single second argument. This is documented in chapter 9 of the Debian Policy Manual. This rc script is normally invoked as /etc/rc0.d/K08halt (or similar) by rc, as the last K action of run level 0.

/etc/default/halt is the settings file described by the halt(5) manual page. These settings control the behaviour of /etc/init.d/halt, and are the default way of it being told what happens as the last K action of run level 0. /sbin/shutdown's -P and -H options use internal mechanisms to make rc run /etc/rc0.d/K08halt with an INIT_HALT environment variable already set, bypassing /etc/default/halt .

/sbin/halt is a binary program. Its manual page is halt(8). It is this command that takes the -p and suchlike options. Conversely, it does not read Debian's /etc/default/halt . After all, it is the command that /etc/init.d/halt itself uses internally to actually enact the halt/poweroff, after parsing /etc/default/halt, using the -f option.

Jesse Smith is saying that invoking "halt -p" runs /sbin/halt, and that works as designed and as documented in the halt(8) manual page. Whereas it does not invoke /etc/init.d/halt. If "halt -p" runs /etc/init.d/halt for you, then your PATH is somewhat odd and you are running the wrong thing.

Static analysis indicates that he is wrong. /sbin/halt invoked without -f simply chains to /sbin/shutdown, and it forgets about any -p flag that it is passed. It only passes -r or -h to shutdown, never -P or -H. /sbin/poweroff (without -f) similarly fails to explicitly tell /sbin/shutdown to power off. In both cases, what is configured in /etc/default/halt thus happens instead. /sbin/shutdown does not set INIT_HALT, because /sbin/halt and /sbin/poweroff did not give it either a -P or a -H option, and thus /etc/rc0.d/K08halt reads the settings file.

This is genuinely an /sbin/halt bug, not an /etc/init.d/halt one. Its do_shutdown() function needs another parameter, derived from do_poweroff. This bug report should be re-opened.

Reply via email to