Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ telinit(1m) — CX/UX 6.20

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

getty(1M)

login(1)

sh(1)

who(1)

kill(2)

inittab(4)

utmp(4)



init(1M)                                                 init(1M)



NAME
     init, telinit - process control initialization

SYNOPSIS
     /etc/init [0123456SsQq]

     /sbin/telinit [0123456sSQqabc]

DESCRIPTION
     Init
     init is a general process spawner. Its primary role is to
     create processes from a script stored in the file
     /etc/inittab (see inittab(4)).  This file usually has init
     spawn getty's on each line that a user may log in on.  It
     also controls autonomous processes required by any particu-
     lar system.

     init considers the system to be in a run-level at any given
     time.  A run-level can be viewed as a software configuration
     of the system where each configuration allows only a
     selected group of processes to exist.  The processes spawned
     by init for each of these run-levels is defined in the init-
     tab file.  init can be in one of eight run-levels, 0-6 and S
     or s.  The run-level is changed by having a privileged user
     run /etc/init (which is linked to /sbin/telinit).  This
     user-spawned init sends appropriate signals to the original
     init spawned by the operating system when the system was
     rebooted, telling it which run-level to change to.

     init is invoked inside the UNIX system as the last step in
     the boot procedure.  The first thing init does is to look
     for /etc/inittab and see if there is an entry of the type
     initdefault (see inittab(4)).  If there is, init uses the
     run-level specified in that entry as the initial run-level
     to enter.  If this entry is not in inittab or inittab is not
     found, init requests that the user enter a run-level from
     the virtual system console, /dev/syscon.  If an S (s) is
     entered, init goes into the SINGLE USER level.  This is the
     only run-level that doesn't require the existence of a prop-
     erly formatted inittab file.  If /etc/inittab doesn't exist,
     then by default the only legal run-level that init can enter
     is the SINGLE USER level.  In the SINGLE USER level the vir-
     tual console terminal /dev/syscon is opened for reading and
     writing and the command /bin/su is invoked immediately.  To
     exit from the SINGLE USER run-level one of two options can
     be elected. First, if the shell is terminated (via an end-
     of-file), init will reprompt for a new run-level.  Second,
     the init or telinit command can signal init and force it to
     change the run-level of the system.

     When attempting to boot the system, failure of init to
     prompt for a new run-level may be due to the fact that the



Page 1                            CX/UX Administrator's Reference





init(1M)                                                 init(1M)



     device /dev/syscon is linked to a device other than the phy-
     sical system console (/dev/systty).  If this occurs, init
     can be forced to relink /dev/syscon by typing a delete on
     the system console which is colocated with the processor.

     When init prompts for the new run-level, the operator may
     enter only one of the digits 0 through 6 or the letters S or
     s.  If S or s are entered init operates as previously
     described in SINGLE USER mode with the additional result
     that /dev/syscon is linked to the user's terminal line, thus
     making it the virtual system console.  A message is gen-
     erated on the physical console, /dev/systty, saying where
     the virtual terminal has been relocated.  /dev/console is a
     synonym for /dev/systty.

     When init comes up initially and whenever it switches out of
     SINGLE USER state to normal run states, it sets the ioctl(2)
     states of the virtual console, /dev/syscon, to those modes
     saved in the file /etc/ioctl.syscon.  This file is written
     by init whenever SINGLE USER mode is entered.  If this file
     does not exist when init wants to read it, a warning is
     printed and default settings are assumed.  If the terminal
     modes set in /etc/ioctl.syscon unsatisfactory (e.g., the
     delete character is not what you're used to), from single
     user mode you can change your terminal modes with stty(1),
     then save them permanently in /etc/ioctl.syscon by typing
     "init s".

     If a 0 through 6 is entered init enters the corresponding
     run-level.  Any other input will be rejected and the user
     will be re-prompted.  If this is the first time init has
     entered a run-level other than SINGLE USER, init first scans
     inittab for special entries of the type boot and bootwait.
     These entries are performed, providing the run-level entered
     matches that of the entry before any normal processing of
     inittab takes place.  In this way any special initialization
     of the operating system, such as mounting file systems, can
     take place before users are allowed onto the system.  The
     inittab file is scanned to find all entries that are to be
     processed for that run-level.

     Run-level 2 is usually defined by the user to contain all of
     the terminal processes and daemons that are spawned in the
     multi-user environment.

     In a multi-user environment, the inittab file is usually set
     up so that init will create a process for each terminal on
     the system.

     For terminal processes, ultimately the shell will terminate
     because of an end-of-file either typed explicitly or gen-
     erated as the result of hanging up.  When init receives a



Page 2                            CX/UX Administrator's Reference





init(1M)                                                 init(1M)



     child death signal, telling it that a process it spawned has
     died, it records the fact and the reason it died in
     /etc/utmp and /etc/wtmp if it exists (see who(1)).  A his-
     tory of the processes spawned is kept in /etc/wtmp if such a
     file exists.

     To spawn each process in the inittab file, init reads each
     entry and for each entry which should be respawned, it forks
     a child process.  After it has spawned all of the processes
     specified by the inittab file, init waits for one of its
     descendant processes to die, a powerfail signal, a signal by
     init or telinit to change the system's run-level, or until
     the scan interval, as specified in the inittab file,
     expires.  When one of the above four conditions occurs, init
     re-examines the inittab file.  New entries can be added to
     the inittab file at any time; however, init still waits for
     one of the above four conditions to occur.  To provide for
     an instantaneous response the init Q or init q command can
     wake init to re-examine the inittab file.

     If init receives a powerfail signal (SIGPWR) and is not in
     SINGLE USER mode, it scans inittab for special powerfail
     entries.  These entries are invoked (if the run-levels per-
     mit) before any further processing takes place.  In this way
     init can perform various cleanup and recording functions
     whenever the operating system experiences a power failure.

     When init is requested to change run-levels (via telinit),
     init sends the warning signal (SIGTERM) to all processes
     that are undefined in the target run-level.  init waits 20
     seconds before forcibly terminating these processes via the
     kill signal (SIGKILL).

     Telinit
     Telinit, which is linked to /etc/init , is used to direct
     the actions of init.  It takes a one-character argument and
     signals init via the kill system call to perform the
     appropriate action.  The following arguments serve as direc-
     tives to init.

          0-6      tells init to place the system in one of the
                   run-levels 0-6.

          a,b,c    tells init to process only those /etc/inittab
                   file entries having the a, b or c run-level
                   set.

          Q,q      tells init to re-examine the /etc/inittab
                   file.

          s,S      tells init to enter the single user environ-
                   ment.  When this level change is effected, the



Page 3                            CX/UX Administrator's Reference





init(1M)                                                 init(1M)



                   virtual system console, /dev/syscon, is
                   changed to the terminal from which the command
                   was executed.

     Telinit can only be run by someone who is super-user or a
     member of group sys.

FILES
     /etc/inittab
     /etc/utmp
     /etc/wtmp
     /etc/ioctl.syscon
     /dev/syscon
     /dev/systty

SEE ALSO
     getty(1M), login(1), sh(1), who(1), kill(2), inittab(4),
     utmp(4).

DIAGNOSTICS
     If init finds that it is continuously respawning an entry
     from /etc/inittab more than 10 times in 2 minutes, it will
     assume that there is an error in the command string, and
     generate an error message on the system console, and refuse
     to respawn this entry until either 5 minutes has elapsed or
     it receives a signal from a user init (telinit).  This
     prevents init from eating up system resources when someone
     makes a typographical error in the inittab file or a program
     is removed that is referenced in the inittab.


























Page 4                            CX/UX Administrator's Reference



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026