What is the difference between Alt, poweroff and reboot?

Asked

Viewed 1,399 times

6

I have heard several times that if I want to shut down/restart the computer from the terminal just run one of these options :

  • Halt
  • poweroff
  • reboot

poweroff and reboot are very intuitive "shut down" and "reset", I just didn’t understand the right halt "stop"

To which I was told :

"The computer has boot stages the halt sends to stage 0"

I also learned that he has 6 stages.

From the terminal documentation I haven’t had much success knowing what they are :

> man halt
...
DESCRIPTION
       halt, poweroff, reboot may be used to halt, power-off or reboot the machine.
...

Doubt

  • What in fact is the halt?
  • What are his stages?
  • Here is another kick than another thing: I believe that the HALT is to suspend/hibernate the machine, it does not turn off completely, but also does not stay fully connected.

1 answer

7


What in fact is Halt?

Halt is a command that for all CPU’s present in the system.

What are his stages?

The boot stages are 6, as you said, which are as follows::

  1. BIOS - performs some integrity checks on the system, searches for the boot program, loads it in memory and gives control to it
  2. MBR (Master Boot Record) - Basically loads and runs GRUB (operating system loader [Grand Unified Bootloader)
  3. GRUB - It is the screen that shows the systems that can be started. It waits a few seconds for a selection, if it doesn’t happen, it loads the default system
  4. Kernel - Mount the file system, run the /sbin/init program
  5. Init - Look at the /etc/inittab to decide the Runlevel of the system, which are these:
    0 - Halt (this is where the Halt command puts you)
    1 - Single User Mode
    2 - Full Multiuser mode
    3 - unused
    4 - X11
    5 - reboot
  6. Runlevel Programs - Where services and programs are started

I put the boot stages and the Runlevel stages, so there is no confusion. Stage "0" that Halt puts you, is at Runlevel

More specifications on the Halt command

  • If you invoke Halt without parameters, it simply executes shutdown
  • If called with --force, during runlevel 0 or 6, runs reboot, otherwise, executes shutdown
  • If called with -p, behaves as poweroff
  • If called with -w, doesn’t make rebootnor poweroff. Instead, save the shutdown record to /var/log/wtmp.
  • If called with --verbose, shows more detailed messages on reboot, useful for debugging shutdown problems

References

https://linux.die.net/man/8/halt
http://www.thegeekstuff.com/2011/02/Linux-boot-process/

Browser other questions tagged

You are not signed in. Login or sign up in order to post.