[Pkg-sysvinit-devel] Bug#590895: sysvinit: shutdown -hP sets INIT_HALT to POWERDOWN not POWEROFF

Geoff Clare debbugs at gclare.org.uk
Sun Jul 15 07:18:31 BST 2018


I see that bugs.debian.org says this bug is "No longer marked as found
in versions sysvinit/2.86.ds1-61."

However, the bug is still present in sysvinit 2.88 as can be seen from:

https://sources.debian.org/src/sysvinit/2.88dsf-59.10/src/shutdown.c/#L518

	case 'P':
		halttype = "POWERDOWN";

and:

https://sources.debian.org/src/sysvinit/2.88dsf-59.10/man/shutdown.8/#L174

	\fIINIT_HALT\fP to \fIHALT\fP, and the \fB-P\fP option just sets
	that variable to \fIPOWEROFF\fP. The shutdown script that calls

I believe the severity of this bug should be increased, as it can cause
loss of service when a UPS is involved.  This is because if UPS software
is configured to execute "shutdown -hP now" when the battery level
becomes critically low, /etc/init.d/halt powers off the system without
invoking "/etc/init.d/ups-monitor poweroff" to tell the UPS to kill the
power.  If A/C power is restored before the UPS turns itself off (which
is likely, as the UPS now has no load) the system does not get restarted
and has to be powered up manually.

Of course the simple work-around for this problem is to configure
"shutdown -h now" instead of "shutdown -hP now", but fixing the bug in
shutdown.c would prevent it happening to admins who are not (yet) aware
of it and who are misled by the man page into thinking that specifying -P
would be prudent to ensure poweroff.

Please change:

		halttype = "POWERDOWN";

to:

		halttype = "POWEROFF";

ASAP.



More information about the Pkg-sysvinit-devel mailing list