init(8) — RISC
Name
init − process control initialization
Syntax
/bin/init [ options ]
Description
The ULTRIX system invokes the init command as the last step in the boot procedure. The system normally then runs the automatic reboot sequence, as described in reboot(.). If reboot succeeds, the init command begins multiuser operation. If reboot fails, init begins single-user operation by giving the superuser a shell on the console.
You can use the boot command so that parameters are passed from the boot program to init so that multiuser operation begins immediately. When the superuser terminates the single-user shell (by pressing CTRL/D), init runs the /etc/rc command file without the reboot parameter. This command file performs housekeeping operations such as removing temporary files, mounting file systems, and starting daemons. For further information, see reboot(.).
In multiuser operation, init creates a process for each terminal port where a user may log in. To begin such operations, it reads the file /etc/ttys. For further information, see ttys(.). For each terminal that is marked “on” in the ttys file, init forks and invokes the command specified for the current line. The command is passed the name of the terminal as the last argument. The other arguments (if any) are specified after the command in the ttys file. Usually, the command is getty(,), but it may be any command.
The getty command reads the user’s name and invokes login to log in the user and execute the shell.
Ultimately, the shell terminates because of an end-of-file. The end-of-file may be typed explicitly or generated as a result of hanging up on a terminal line. The main path of init, which has been waiting for such an event, wakes up and removes the appropriate entry from the file utmp, which records current users. The init command then makes an entry in /usr/adm/wtmp, which maintains a history of logins and logouts. The wtmp entry is made only if a user logged in successfully on the line. Then the appropriate terminal is reopened and getty is reinvoked.
The init command catches the hangup signal (signal SIGHUP) and interprets it to mean that the file /etc/ttys should be read again. The shell process on each line which used to be active in ttys but is no longer there is terminated; a new process is created for each added line; lines unchanged in the file are undisturbed. Thus it is possible to drop or add phone lines without rebooting the system by changing the ttys file and sending a hangup signal to the init process, using kill −HUP 1.
The init command terminates multiuser operations and resumes single-user mode if it receives a terminate (TERM) signal. That is, the superuser types kill −TERM 1. If there are processes outstanding which are deadlocked (due to hardware or software failure), init does not wait for them all to die, but times out after 30 seconds and prints a warning message.
If init receives a terminal stop signal (the superuser types kill −TSTP 1), init stops creating new processes and lets the system slowly die away. A later hangup will resume full multiuser operations, or a terminate will initiate a single user shell. This feature is used by reboot() and halt(.).
If init dies, the system will reboot itself automatically. If, at bootstrap time, the init process cannot be located, the system will loop in user mode at location 0x13.
Options
−a Specifies that the system should autoreboot to multiuser mode. This option is similar to specifying auto to the console prompt or specifying either shutdown with the −r option or reboot from the command line.
−s Specifies that the system should boot to single-user mode.
Diagnostics
WARNING: Something is hung (wont die); ps axl advised
The system is shutting down and init cannot kill a certain process. This usually occurs when a process cannot exit a device driver due to a persistent device error condition.
init: ‘command tty’ failing, sleeping.
The init command tried to spawn a new process (use the execve() system call) for the command five times. Each time, the command failed. This may indicate that the command was invoked with invalid arguments. Check the /etc/ttys file for errors. This error message is printed at syslog() level LOG_ERR.
init: exec failed: cmd= command reason
The init command tried to spawn a new process using the execve() system call for the command. The execve failed. The reason is the explanation produced by the perror() routine for why the execve failed. This error message is printed at syslog() level LOG_ERR.
Files
/etc/utmp Lists current system users
/usr/adm/wtmp
History of logins and logouts
/etc/ttys The init command reads this file for a command to execute for the terminal line
/etc/rc Command file executed by init