18fae3551SRodney W. Grimes.\" Copyright (c) 1980, 1991, 1993 28fae3551SRodney W. Grimes.\" The Regents of the University of California. All rights reserved. 38fae3551SRodney W. Grimes.\" 48fae3551SRodney W. Grimes.\" This code is derived from software contributed to Berkeley by 58fae3551SRodney W. Grimes.\" Donn Seeley at Berkeley Software Design, Inc. 68fae3551SRodney W. Grimes.\" 78fae3551SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without 88fae3551SRodney W. Grimes.\" modification, are permitted provided that the following conditions 98fae3551SRodney W. Grimes.\" are met: 108fae3551SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright 118fae3551SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer. 128fae3551SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright 138fae3551SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer in the 148fae3551SRodney W. Grimes.\" documentation and/or other materials provided with the distribution. 158fae3551SRodney W. Grimes.\" 3. All advertising materials mentioning features or use of this software 168fae3551SRodney W. Grimes.\" must display the following acknowledgement: 178fae3551SRodney W. Grimes.\" This product includes software developed by the University of 188fae3551SRodney W. Grimes.\" California, Berkeley and its contributors. 198fae3551SRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors 208fae3551SRodney W. Grimes.\" may be used to endorse or promote products derived from this software 218fae3551SRodney W. Grimes.\" without specific prior written permission. 228fae3551SRodney W. Grimes.\" 238fae3551SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 248fae3551SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 258fae3551SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 268fae3551SRodney W. Grimes.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 278fae3551SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 288fae3551SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 298fae3551SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 308fae3551SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 318fae3551SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 328fae3551SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 338fae3551SRodney W. Grimes.\" SUCH DAMAGE. 348fae3551SRodney W. Grimes.\" 358fae3551SRodney W. Grimes.\" @(#)init.8 8.3 (Berkeley) 4/18/94 368889c700SDavid Nugent.\" $Id: init.8,v 1.9 1997/04/01 20:41:04 mpp Exp $ 378fae3551SRodney W. Grimes.\" 388fae3551SRodney W. Grimes.Dd April 18, 1994 398fae3551SRodney W. Grimes.Dt INIT 8 408fae3551SRodney W. Grimes.Os BSD 4 418fae3551SRodney W. Grimes.Sh NAME 428fae3551SRodney W. Grimes.Nm init 438fae3551SRodney W. Grimes.Nd process control initialization 448fae3551SRodney W. Grimes.Sh SYNOPSIS 458fae3551SRodney W. Grimes.Nm init 468fae3551SRodney W. Grimes.Sh DESCRIPTION 478fae3551SRodney W. GrimesThe 488fae3551SRodney W. Grimes.Nm init 498fae3551SRodney W. Grimesprogram 508fae3551SRodney W. Grimesis the last stage of the boot process. 518fae3551SRodney W. GrimesIt normally runs the automatic reboot sequence as described in 528fae3551SRodney W. Grimes.Xr reboot 8 , 538fae3551SRodney W. Grimesand if this succeeds, begins multi-user operation. 548fae3551SRodney W. GrimesIf the reboot scripts fail, 558fae3551SRodney W. Grimes.Nm init 568fae3551SRodney W. Grimescommences single user operation by giving 578fae3551SRodney W. Grimesthe super-user a shell on the console. 588fae3551SRodney W. GrimesThe 598fae3551SRodney W. Grimes.Nm init 608fae3551SRodney W. Grimesprogram may be passed parameters 618fae3551SRodney W. Grimesfrom the boot program to 628fae3551SRodney W. Grimesprevent the system from going multi-user and to instead execute 638fae3551SRodney W. Grimesa single user shell without starting the normal daemons. 648fae3551SRodney W. GrimesThe system is then quiescent for maintenance work and may 658fae3551SRodney W. Grimeslater be made to go to multi-user by exiting the 668fae3551SRodney W. Grimessingle-user shell (with ^D). 678fae3551SRodney W. GrimesThis 688fae3551SRodney W. Grimescauses 698fae3551SRodney W. Grimes.Nm init 708fae3551SRodney W. Grimesto run the 718fae3551SRodney W. Grimes.Pa /etc/rc 728fae3551SRodney W. Grimesstart up command file in fastboot mode (skipping disk checks). 738fae3551SRodney W. Grimes.Pp 748fae3551SRodney W. GrimesIf the 758fae3551SRodney W. Grimes.Nm console 768fae3551SRodney W. Grimesentry in the 778fae3551SRodney W. Grimes.Xr ttys 5 788fae3551SRodney W. Grimesfile is marked ``insecure'', 798fae3551SRodney W. Grimesthen 808fae3551SRodney W. Grimes.Nm init 818fae3551SRodney W. Grimeswill require that the superuser password be 828fae3551SRodney W. Grimesentered before the system will start a single-user shell. 838fae3551SRodney W. GrimesThe password check is skipped if the 848fae3551SRodney W. Grimes.Nm console 858fae3551SRodney W. Grimesis marked as ``secure''. 868fae3551SRodney W. Grimes.Pp 878fae3551SRodney W. GrimesThe kernel runs with four different levels of security. 888fae3551SRodney W. GrimesAny superuser process can raise the security level, but only 898fae3551SRodney W. Grimes.Nm init 908fae3551SRodney W. Grimescan lower it. 9138058917SBruce EvansThe security levels are: 928fae3551SRodney W. Grimes.Bl -tag -width flag 938fae3551SRodney W. Grimes.It Ic -1 9438058917SBruce EvansPermanently insecure mode \- always run the system in level 0 mode. 958fae3551SRodney W. Grimes.It Ic 0 968fae3551SRodney W. GrimesInsecure mode \- immutable and append-only flags may be turned off. 978fae3551SRodney W. GrimesAll devices may be read or written subject to their permissions. 988fae3551SRodney W. Grimes.It Ic 1 9979665533SMike PritchardSecure mode \- the system immutable and system append-only flags may not 10079665533SMike Pritchardbe turned off; 1018fae3551SRodney W. Grimesdisks for mounted filesystems, 1028fae3551SRodney W. Grimes.Pa /dev/mem , 1038fae3551SRodney W. Grimesand 1048fae3551SRodney W. Grimes.Pa /dev/kmem 10538058917SBruce Evansmay not be opened for writing. 1068fae3551SRodney W. Grimes.It Ic 2 10738058917SBruce EvansHighly secure mode \- same as secure mode, plus disks may not be 10838058917SBruce Evansopened for writing (except by 10938058917SBruce Evans.Xr mount 2 ) 11038058917SBruce Evanswhether mounted or not. 1118fae3551SRodney W. GrimesThis level precludes tampering with filesystems by unmounting them, 1128fae3551SRodney W. Grimesbut also inhibits running 1138fae3551SRodney W. Grimes.Xr newfs 8 1148fae3551SRodney W. Grimeswhile the system is multi-user. 1158fae3551SRodney W. Grimes.El 1168fae3551SRodney W. Grimes.Pp 11738058917SBruce EvansIf the security level is initially -1, then 11838058917SBruce Evans.Nm init 11938058917SBruce Evansleaves it unchanged. 12038058917SBruce EvansOtherwise, 12138058917SBruce Evans.Nm init 12238058917SBruce Evansarranges to run the system in level 0 mode while single user 1238fae3551SRodney W. Grimesand in level 1 mode while multiuser. 12438058917SBruce EvansIf level 2 mode is desired while running multiuser, 12538058917SBruce Evansit can be set while single user, e.g., in the startup script 12638058917SBruce Evans.Pa /etc/rc , 1278fae3551SRodney W. Grimesusing 1288fae3551SRodney W. Grimes.Xr sysctl 8 . 1298fae3551SRodney W. Grimes.Pp 1308fae3551SRodney W. GrimesIn multi-user operation, 1318fae3551SRodney W. Grimes.Nm init 1328fae3551SRodney W. Grimesmaintains 1338fae3551SRodney W. Grimesprocesses for the terminal ports found in the file 1348fae3551SRodney W. Grimes.Xr ttys 5 . 1358fae3551SRodney W. Grimes.Nm Init 1368fae3551SRodney W. Grimesreads this file, and executes the command found in the second field. 1378fae3551SRodney W. GrimesThis command is usually 1388fae3551SRodney W. Grimes.Xr getty 8 ; 139edf0e5b3SMike Pritchard.Nm getty 1408fae3551SRodney W. Grimesopens and initializes the tty line 1418fae3551SRodney W. Grimesand 1428fae3551SRodney W. Grimesexecutes the 143edf0e5b3SMike Pritchard.Xr login 1 1448fae3551SRodney W. Grimesprogram. 1458fae3551SRodney W. GrimesThe 146edf0e5b3SMike Pritchard.Nm login 1478fae3551SRodney W. Grimesprogram, when a valid user logs in, 1488fae3551SRodney W. Grimesexecutes a shell for that user. When this shell 1498fae3551SRodney W. Grimesdies, either because the user logged out 1508fae3551SRodney W. Grimesor an abnormal termination occurred (a signal), 1518fae3551SRodney W. Grimesthe 1528fae3551SRodney W. Grimes.Nm init 1538fae3551SRodney W. Grimesprogram wakes up, deletes the user 1548fae3551SRodney W. Grimesfrom the 1558fae3551SRodney W. Grimes.Xr utmp 5 1568fae3551SRodney W. Grimesfile of current users and records the logout in the 157edf0e5b3SMike Pritchard.Xr wtmp 5 1588fae3551SRodney W. Grimesfile. 1598fae3551SRodney W. GrimesThe cycle is 1608fae3551SRodney W. Grimesthen restarted by 1618fae3551SRodney W. Grimes.Nm init 1628fae3551SRodney W. Grimesexecuting a new 163edf0e5b3SMike Pritchard.Nm getty 1648fae3551SRodney W. Grimesfor the line. 1658fae3551SRodney W. Grimes.Pp 1668fae3551SRodney W. GrimesLine status (on, off, secure, getty, or window information) 1678fae3551SRodney W. Grimesmay be changed in the 168edf0e5b3SMike Pritchard.Xr ttys 5 1698fae3551SRodney W. Grimesfile without a reboot by sending the signal 1708fae3551SRodney W. Grimes.Dv SIGHUP 1718fae3551SRodney W. Grimesto 1728fae3551SRodney W. Grimes.Nm init 1738fae3551SRodney W. Grimeswith the command 1748fae3551SRodney W. Grimes.Dq Li "kill -HUP 1" . 1758fae3551SRodney W. GrimesOn receipt of this signal, 1768fae3551SRodney W. Grimes.Nm init 1778fae3551SRodney W. Grimesre-reads the 178edf0e5b3SMike Pritchard.Xr ttys 5 1798fae3551SRodney W. Grimesfile. 1808fae3551SRodney W. GrimesWhen a line is turned off in 181edf0e5b3SMike Pritchard.Xr ttys 5 , 1828fae3551SRodney W. Grimes.Nm init 1838fae3551SRodney W. Grimeswill send a SIGHUP signal to the controlling process 1848fae3551SRodney W. Grimesfor the session associated with the line. 1858fae3551SRodney W. GrimesFor any lines that were previously turned off in the 186edf0e5b3SMike Pritchard.Xr ttys 5 1878fae3551SRodney W. Grimesfile and are now on, 1888fae3551SRodney W. Grimes.Nm init 1898fae3551SRodney W. Grimesexecutes a new 190edf0e5b3SMike Pritchard.Nm getty 1918fae3551SRodney W. Grimesto enable a new login. 1928fae3551SRodney W. GrimesIf the getty or window field for a line is changed, 1938fae3551SRodney W. Grimesthe change takes effect at the end of the current 1948fae3551SRodney W. Grimeslogin session (e.g., the next time 1958fae3551SRodney W. Grimes.Nm init 1968fae3551SRodney W. Grimesstarts a process on the line). 1978fae3551SRodney W. GrimesIf a line is commented out or deleted from 198edf0e5b3SMike Pritchard.Xr ttys 5 , 1998fae3551SRodney W. Grimes.Nm init 2008fae3551SRodney W. Grimeswill not do anything at all to that line. 2018fae3551SRodney W. GrimesHowever, it will complain that the relationship between lines 2028fae3551SRodney W. Grimesin the 203edf0e5b3SMike Pritchard.Xr ttys 5 2048fae3551SRodney W. Grimesfile and records in the 205edf0e5b3SMike Pritchard.Xr utmp 5 2068fae3551SRodney W. Grimesfile is out of sync, 2078fae3551SRodney W. Grimesso this practice is not recommended. 2088fae3551SRodney W. Grimes.Pp 2098fae3551SRodney W. Grimes.Nm Init 2108fae3551SRodney W. Grimeswill terminate multi-user operations and resume single-user mode 2118fae3551SRodney W. Grimesif sent a terminate 2128fae3551SRodney W. Grimes.Pq Dv TERM 2138fae3551SRodney W. Grimessignal, for example, 2148fae3551SRodney W. Grimes.Dq Li "kill \-TERM 1" . 2158fae3551SRodney W. GrimesIf there are processes outstanding that are deadlocked (because of 2168fae3551SRodney W. Grimeshardware or software failure), 217edf0e5b3SMike Pritchard.Nm init 2188fae3551SRodney W. Grimeswill not wait for them all to die (which might take forever), but 2198fae3551SRodney W. Grimeswill time out after 30 seconds and print a warning message. 2208fae3551SRodney W. Grimes.Pp 2218fae3551SRodney W. Grimes.Nm Init 2228fae3551SRodney W. Grimeswill cease creating new 223edf0e5b3SMike Pritchard.Nm getty Ns 's 2248fae3551SRodney W. Grimesand allow the system to slowly die away, if it is sent a terminal stop 2258fae3551SRodney W. Grimes.Pq Dv TSTP 2268fae3551SRodney W. Grimessignal, i.e. 2278fae3551SRodney W. Grimes.Dq Li "kill \-TSTP 1" . 2288fae3551SRodney W. GrimesA later hangup will resume full 2298fae3551SRodney W. Grimesmulti-user operations, or a terminate will start a single user shell. 2308fae3551SRodney W. GrimesThis hook is used by 2318fae3551SRodney W. Grimes.Xr reboot 8 2328fae3551SRodney W. Grimesand 2338fae3551SRodney W. Grimes.Xr halt 8 . 2348fae3551SRodney W. Grimes.Pp 235e460cfd3SNate Williams.Nm Init 236e460cfd3SNate Williamswill terminate all possible processes (again, it will not wait 237e460cfd3SNate Williamsfor deadlocked processes) and reboot the machine if sent the interrupt 238e460cfd3SNate Williams.Pq Dv INT 239e460cfd3SNate Williamssignal, i.e. 240e460cfd3SNate Williams.Dq Li "kill \-INT 1". 241e460cfd3SNate WilliamsThis is useful for shutting the machine down cleanly from inside the kernel 2424f3cac8fSAdam Davidor from X when the machine appears to be hung. 243e460cfd3SNate Williams.Pp 2448889c700SDavid NugentWhen shuting down the machine, 2458889c700SDavid Nugent.Nm init 2468889c700SDavid Nugentwill try to run the 2478889c700SDavid Nugent.Pa /etc/rc.shutdown 2488889c700SDavid Nugentscript. This script can be used to cleanly terminate specific programs such 2498889c700SDavid Nugentas 2508889c700SDavid Nugent.Nm innd 2518889c700SDavid Nugent(the InterNetNews server). 2528889c700SDavid Nugent.Pp 2538fae3551SRodney W. GrimesThe role of 2548fae3551SRodney W. Grimes.Nm init 2558fae3551SRodney W. Grimesis so critical that if it dies, the system will reboot itself 2568fae3551SRodney W. Grimesautomatically. 2578fae3551SRodney W. GrimesIf, at bootstrap time, the 258edf0e5b3SMike Pritchard.Nm init 2598fae3551SRodney W. Grimesprocess cannot be located, the system will panic with the message 2608fae3551SRodney W. Grimes``panic: "init died (signal %d, exit %d)''. 2618fae3551SRodney W. Grimes.Sh DIAGNOSTICS 2628fae3551SRodney W. Grimes.Bl -diag 2638fae3551SRodney W. Grimes.It "getty repeating too quickly on port %s, sleeping" 2648fae3551SRodney W. GrimesA process being started to service a line is exiting quickly 2658fae3551SRodney W. Grimeseach time it is started. 2668fae3551SRodney W. GrimesThis is often caused by a ringing or noisy terminal line. 2678fae3551SRodney W. Grimes.Em "Init will sleep for 10 seconds" , 2688fae3551SRodney W. Grimes.Em "then continue trying to start the process" . 2698fae3551SRodney W. Grimes.Pp 2708fae3551SRodney W. Grimes.It "some processes would not die; ps axl advised." 2718fae3551SRodney W. GrimesA process 2728fae3551SRodney W. Grimesis hung and could not be killed when the system was shutting down. 2738fae3551SRodney W. GrimesThis condition is usually caused by a process 2748fae3551SRodney W. Grimesthat is stuck in a device driver because of 2758fae3551SRodney W. Grimesa persistent device error condition. 2768fae3551SRodney W. Grimes.El 2778fae3551SRodney W. Grimes.Sh FILES 2788fae3551SRodney W. Grimes.Bl -tag -width /var/log/wtmp -compact 2798fae3551SRodney W. Grimes.It Pa /dev/console 2808fae3551SRodney W. GrimesSystem console device. 2818fae3551SRodney W. Grimes.It Pa /dev/tty* 2828fae3551SRodney W. GrimesTerminal ports found in 283edf0e5b3SMike Pritchard.Xr ttys 5 . 2848fae3551SRodney W. Grimes.It Pa /var/run/utmp 2858fae3551SRodney W. GrimesRecord of Current users on the system. 2868fae3551SRodney W. Grimes.It Pa /var/log/wtmp 2878fae3551SRodney W. GrimesRecord of all logins and logouts. 2888fae3551SRodney W. Grimes.It Pa /etc/ttys 2898fae3551SRodney W. GrimesThe terminal initialization information file. 2908fae3551SRodney W. Grimes.It Pa /etc/rc 2918fae3551SRodney W. GrimesSystem startup commands. 2928889c700SDavid Nugent.It Pa /etc/rc.shutdown 2938889c700SDavid NugentSystem shutdown commands. 2948fae3551SRodney W. Grimes.El 2958fae3551SRodney W. Grimes.Sh SEE ALSO 2968fae3551SRodney W. Grimes.Xr kill 1 , 297af202156SWolfram Schneider.Xr login 1 , 2988fae3551SRodney W. Grimes.Xr sh 1 , 2998fae3551SRodney W. Grimes.Xr ttys 5 , 3008fae3551SRodney W. Grimes.Xr crash 8 , 3018fae3551SRodney W. Grimes.Xr getty 8 , 302af202156SWolfram Schneider.Xr halt 8 , 3038fae3551SRodney W. Grimes.Xr rc 8 , 3048fae3551SRodney W. Grimes.Xr reboot 8 , 3058fae3551SRodney W. Grimes.Xr shutdown 8 3068fae3551SRodney W. Grimes.Sh HISTORY 3078fae3551SRodney W. GrimesA 3088fae3551SRodney W. Grimes.Nm 3098fae3551SRodney W. Grimescommand appeared in 3108fae3551SRodney W. Grimes.At v6 . 3118fae3551SRodney W. Grimes.Sh BUGS 3128fae3551SRodney W. GrimesSystems without 3138fae3551SRodney W. Grimes.Xr sysctl 3148fae3551SRodney W. Grimesbehave as though they have security level \-1. 315