Are there any good reasons for halting system without cutting power?

13

1

Are there any good reasons to halt a system without switching off power to the hardware? I mean using the halt command without using the -p switch.

I haven’t been able to find an answer on the Internet.

Zafan

Posted 2015-04-10T15:48:31.223

Reputation: 133

1

Failing/improperly implemented/unsupported ACPI could be one reason.

– Ƭᴇcʜιᴇ007 – 2015-04-10T16:15:32.623

I think the OP means why is a command such as halt implemented if it's never used without -p. Why would someone halt a system if they don't intend on then cutting the power? Thus why not implement halt to cut power off. – Kinnectus – 2015-04-10T17:09:26.573

1@BigChris For "Why", my assumption would be it's because "Halt" was created before ACPI was introduced/widely available, and the default Halt action was probably left as-is for backward compatibility. – Ƭᴇcʜιᴇ007 – 2015-04-10T17:16:49.000

Answers

13

Are there any good reasons to halt a system without switching off power to the hardware?

Yes. I might want to push its reset button and reboot it, instead of pushing its power button to turn off its power.

I mean using the halt command without using the -p switch.

In 4.2BSD, the halt command did not have a -p switch. This points towards the larger answer, here: Not all hardware works like a PC; even PCs haven't always worked the way that they do now.

It has not been (and still sometimes is not) the case that Central Processing Units have control over the power supply, or can fully reset the mainboard and peripherals to the same states as they have at power-on. On some systems, the second part of "shut down and power off" or "shut down and reset" was a physical action, taken by the operator pressing a (proper) power button or a reset button on the machine's front panel. No amount of command-line switches could achieve it. On the software side, the machine simply shut down and then spun in an infinite loop doing nothing. (Some machines would exit to a ROM monitor program.)

Modern BSDs note that their halt command's -p option only turns off power "if it can" (FreeBSD) and will not do so where "the system does not support software powerdown" (NetBSD). The SCO UNIX haltsys command (the System 5 equivalent for halt) also didn't have a -p option, and its manual page explains that it halts the system so that the operator can then, through other means, power it off or reboot it.

Nowadays, there are those who, like the systemd folk, maintain that the halt command is in fact obsolete. They would maintain that one really does not have to use the halt command at all and that it exists in systems "for compatibility only" (as the systemd manual pages have it). This rather renders the question of what options to give to it moot (systemctl halt not having a -p option).

It also demonstrates the position that we are now in that this command set has become so festooned with compatibility options that it allows people to give computers self-contradictory instructions like reboot --halt and poweroff --reboot. I noted this in the manual page for the nosh halt, fasthalt, reboot, fastboot, and poweroff commands. ☺

Further reading

  • halt. 1982-05-11. 4.2BSD manual.
  • haltsys. 2005-06-03. SCO OpenServer manual.
  • Jonathan de Boyne Pollard (2018). haltsys. nosh Guide. Softwares.
  • Jonathan de Boyne Pollard (2018). fastpowercycle. nosh Guide. Softwares.
  • Jonathan de Boyne Pollard (2018). shutdown. nosh Guide. Softwares.
  • Lennart Poettering (2013-10-07). halt. systemd manual pages. freedesktop.org.

JdeBP

Posted 2015-04-10T15:48:31.223

Reputation: 23 855

2ockquote>

"I might want to push its reset button and reboot it, instead of pushing its power button to turn off its power."

What is the reasoning for this? To reduce wear and tear on the hardware? Otherwise, why not just do a reboot instead of a halt? – TheKarateKid – 2018-02-28T00:47:58.597