[CALUG] How do I get out of X?

Dave Dodge dododge at dododge.net
Fri Aug 25 18:10:20 CDT 2006


On Fri, Aug 25, 2006 at 10:33:17AM -0400, James Ewing Cottrell 3rd wrote:
> Which brings up the question: Why TF does "telinit" exist in the first 
> place?

Historical reasons, most likely.  "telinit" probably goes back to
whatever SYSV version introduced the concept of runlevels way back
when.

> What's wrong with simply typing "init 1"? Nothing!

"telinit" is really the more correct method.  "init 1" only works
because of a quirk in how init and telinit are normally implemented on
Linux.  Somewhere along the way someone decided to combine them into a
single executable, and the program picks its operating mode based on
the pid it gets from the OS.  So when you use "init 1" you're really
running "telinit 1" even if the binary happens to be called "init".
As you've seen, it takes telinits's options rather than init's.

If you try "init 1" on a system where they are _not_ combined into a
single program, then it might not have the expected behavior.  I don't
know if there are any such systems; it's conceivable that some "init"
replacement for Linux, or perhaps a commercial SYSV derivative,
doesn't have an init that switches to telinit mode automatically.

That said, using init to run telinit normally works on Linux, and the
manpage (on SLES9 and RHEL4 at least) even documents this
implementation shortcut.  There's probably enough stuff on Linux that
relies on it that it's unlikely to break.

                                                  -Dave Dodge


More information about the lug mailing list