Why is ‘init 6’ the reboot command? (historic reasons)

documentationhistoryinitsignals

I would like to know why 6 is the number/code/signal associated with the reboot command in "init 6". I mean the history/stories/legend reasons, not in a technical way… If it was a "list related reason" or maybe a graphic thing about recursivity/circle-ouroboros/101 alike number.

I'm starting reading Design of the UNIX Operating System by Maurice Bach, but didn't find yet a reason or idea.

Best Answer

init 6 is the (or, a) reboot command because of the historical definitions of "runlevels", or general system states in which a host can be expected to be. These are generally defined as:

  • 0 - Shut down / System halt
  • 1 - Single User mode
  • 2 - Reserved for administrative use
  • 3 - Multi-User mode with networking and services
  • 4 - Reserved for administrative use
  • 5 - Multi-User mode with networking, services, and GUI login daemon
  • 6 - Reboot

The init command tells the system to move to the specified runlevel. Because 6 is the commonly defined runlevel used to reboot the host, and init 6 (or telinit 6) is the means to go to that runlevel, this is why init 6 is generally understood to be a reboot command.

Technically speaking, because these can be redefined by a crafty or bored system administrator, it might be more advisable to use shutdown -r as a reboot command. This is in part because some distributions (e. g. Gentoo) eschew this convention entirely, and because of the proliferating deprecation of the System V Init system in favor of upstart and other "PID 1" daemons.