xref: /freebsd/sbin/init/init.8 (revision d21e322d563e0fd1f92c22205c2ced4bcd22dc23)
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.
15fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors
168fae3551SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
178fae3551SRodney W. Grimes.\"    without specific prior written permission.
188fae3551SRodney W. Grimes.\"
198fae3551SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
208fae3551SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
218fae3551SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
228fae3551SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
238fae3551SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
248fae3551SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
258fae3551SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
268fae3551SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
278fae3551SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
288fae3551SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
298fae3551SRodney W. Grimes.\" SUCH DAMAGE.
308fae3551SRodney W. Grimes.\"
314d159769SKyle Evans.Dd July 22, 2021
328fae3551SRodney W. Grimes.Dt INIT 8
339fe48c6eSRuslan Ermilov.Os
348fae3551SRodney W. Grimes.Sh NAME
358fae3551SRodney W. Grimes.Nm init
368fae3551SRodney W. Grimes.Nd process control initialization
378fae3551SRodney W. Grimes.Sh SYNOPSIS
387c7fb079SRuslan Ermilov.Nm
397c7fb079SRuslan Ermilov.Nm
401681d659SRuslan Ermilov.Oo
411681d659SRuslan Ermilov.Cm 0 | 1 | 6 |
421681d659SRuslan Ermilov.Cm c | q
431681d659SRuslan Ermilov.Oc
448fae3551SRodney W. Grimes.Sh DESCRIPTION
458fae3551SRodney W. GrimesThe
465df42cf4SPhilippe Charnier.Nm
47e1205e80SPhilippe Charnierutility
488fae3551SRodney W. Grimesis the last stage of the boot process.
498fae3551SRodney W. GrimesIt normally runs the automatic reboot sequence as described in
501681d659SRuslan Ermilov.Xr rc 8 ,
518fae3551SRodney W. Grimesand if this succeeds, begins multi-user operation.
528fae3551SRodney W. GrimesIf the reboot scripts fail,
535df42cf4SPhilippe Charnier.Nm
541681d659SRuslan Ermilovcommences single-user operation by giving
558fae3551SRodney W. Grimesthe super-user a shell on the console.
568fae3551SRodney W. GrimesThe
575df42cf4SPhilippe Charnier.Nm
58e1205e80SPhilippe Charnierutility may be passed parameters
598fae3551SRodney W. Grimesfrom the boot program to
608fae3551SRodney W. Grimesprevent the system from going multi-user and to instead execute
611681d659SRuslan Ermilova single-user shell without starting the normal daemons.
628fae3551SRodney W. GrimesThe system is then quiescent for maintenance work and may
638fae3551SRodney W. Grimeslater be made to go to multi-user by exiting the
648fae3551SRodney W. Grimessingle-user shell (with ^D).
658fae3551SRodney W. GrimesThis
668fae3551SRodney W. Grimescauses
675df42cf4SPhilippe Charnier.Nm
688fae3551SRodney W. Grimesto run the
698fae3551SRodney W. Grimes.Pa /etc/rc
708fae3551SRodney W. Grimesstart up command file in fastboot mode (skipping disk checks).
718fae3551SRodney W. Grimes.Pp
728fae3551SRodney W. GrimesIf the
735df42cf4SPhilippe Charnier.Em console
748fae3551SRodney W. Grimesentry in the
758fae3551SRodney W. Grimes.Xr ttys 5
761681d659SRuslan Ermilovfile is marked
771681d659SRuslan Ermilov.Dq insecure ,
788fae3551SRodney W. Grimesthen
795df42cf4SPhilippe Charnier.Nm
801681d659SRuslan Ermilovwill require that the super-user password be
818fae3551SRodney W. Grimesentered before the system will start a single-user shell.
828fae3551SRodney W. GrimesThe password check is skipped if the
835df42cf4SPhilippe Charnier.Em console
841681d659SRuslan Ermilovis marked as
851681d659SRuslan Ermilov.Dq secure .
865469cc0eSEdward Tomasz NapieralaNote that the password check does not protect from variables
875469cc0eSEdward Tomasz Napieralasuch as
885469cc0eSEdward Tomasz Napierala.Va init_script
895469cc0eSEdward Tomasz Napieralabeing set from the
905469cc0eSEdward Tomasz Napierala.Xr loader 8
915469cc0eSEdward Tomasz Napieralacommand line; see the
925469cc0eSEdward Tomasz Napierala.Sx SECURITY
935469cc0eSEdward Tomasz Napieralasection of
945469cc0eSEdward Tomasz Napierala.Xr loader 8 .
958fae3551SRodney W. Grimes.Pp
96e17c0e32SGary W. SwearingenIf the system security level (see
97e17c0e32SGary W. Swearingen.Xr security 7 )
98e17c0e32SGary W. Swearingenis initially nonzero, then
995df42cf4SPhilippe Charnier.Nm
10038058917SBruce Evansleaves it unchanged.
10138058917SBruce EvansOtherwise,
1025df42cf4SPhilippe Charnier.Nm
10367b661fdSSheldon Hearnraises the level to 1 before going multi-user for the first time.
10401de0116SSheldon HearnSince the level cannot be reduced, it will be at least 1 for
10501de0116SSheldon Hearnsubsequent operation, even on return to single-user.
10667b661fdSSheldon HearnIf a level higher than 1 is desired while running multi-user,
10767b661fdSSheldon Hearnit can be set before going multi-user, e.g., by the startup script
10867b661fdSSheldon Hearn.Xr rc 8 ,
1098fae3551SRodney W. Grimesusing
1106ebaa024SJoseph Koshy.Xr sysctl 8
1116ebaa024SJoseph Koshyto set the
112280b191cSKen Smith.Va kern.securelevel
1136ebaa024SJoseph Koshyvariable to the required security level.
1148fae3551SRodney W. Grimes.Pp
115280b191cSKen SmithIf
116280b191cSKen Smith.Nm
117d04b5dfeSRuslan Ermilovis run in a jail, the security level of the
118280b191cSKen Smith.Dq host system
1197090a0c6SRalf S. Engelschallwill not be affected.
120280b191cSKen SmithPart of the information set up in the kernel to support a jail
121e17c0e32SGary W. Swearingenis a per-jail security level.
122280b191cSKen SmithThis allows running a higher security level inside of a jail
123280b191cSKen Smiththan that of the host system.
124280b191cSKen SmithSee
125280b191cSKen Smith.Xr jail 8
126280b191cSKen Smithfor more information about jails.
127280b191cSKen Smith.Pp
1288fae3551SRodney W. GrimesIn multi-user operation,
1295df42cf4SPhilippe Charnier.Nm
1308fae3551SRodney W. Grimesmaintains
1318fae3551SRodney W. Grimesprocesses for the terminal ports found in the file
1328fae3551SRodney W. Grimes.Xr ttys 5 .
133e1205e80SPhilippe CharnierThe
134e1205e80SPhilippe Charnier.Nm
135e1205e80SPhilippe Charnierutility reads this file and executes the command found in the second field,
136f0f4f756SSheldon Hearnunless the first field refers to a device in
137f0f4f756SSheldon Hearn.Pa /dev
138f0f4f756SSheldon Hearnwhich is not configured.
139f0f4f756SSheldon HearnThe first field is supplied as the final argument to the command.
1408fae3551SRodney W. GrimesThis command is usually
1418fae3551SRodney W. Grimes.Xr getty 8 ;
142edf0e5b3SMike Pritchard.Nm getty
1438fae3551SRodney W. Grimesopens and initializes the tty line
1448fae3551SRodney W. Grimesand
1458fae3551SRodney W. Grimesexecutes the
146edf0e5b3SMike Pritchard.Xr login 1
1478fae3551SRodney W. Grimesprogram.
1488fae3551SRodney W. GrimesThe
149edf0e5b3SMike Pritchard.Nm login
1508fae3551SRodney W. Grimesprogram, when a valid user logs in,
1519806e231SRuslan Ermilovexecutes a shell for that user.
1529806e231SRuslan ErmilovWhen this shell
1538fae3551SRodney W. Grimesdies, either because the user logged out
1548fae3551SRodney W. Grimesor an abnormal termination occurred (a signal),
155c21ae3a4SEd Schoutenthe cycle is restarted by
1568fae3551SRodney W. Grimesexecuting a new
157edf0e5b3SMike Pritchard.Nm getty
1588fae3551SRodney W. Grimesfor the line.
1598fae3551SRodney W. Grimes.Pp
160e1205e80SPhilippe CharnierThe
161e1205e80SPhilippe Charnier.Nm
162e1205e80SPhilippe Charnierutility can also be used to keep arbitrary daemons running,
163f0f4f756SSheldon Hearnautomatically restarting them if they die.
164f0f4f756SSheldon HearnIn this case, the first field in the
165f0f4f756SSheldon Hearn.Xr ttys 5
166f0f4f756SSheldon Hearnfile must not reference the path to a configured device node
167f0f4f756SSheldon Hearnand will be passed to the daemon
168f0f4f756SSheldon Hearnas the final argument on its command line.
169f0f4f756SSheldon HearnThis is similar to the facility offered in the
170f0f4f756SSheldon Hearn.At V
171f0f4f756SSheldon Hearn.Pa /etc/inittab .
172f0f4f756SSheldon Hearn.Pp
1738fae3551SRodney W. GrimesLine status (on, off, secure, getty, or window information)
1748fae3551SRodney W. Grimesmay be changed in the
175edf0e5b3SMike Pritchard.Xr ttys 5
1768fae3551SRodney W. Grimesfile without a reboot by sending the signal
1778fae3551SRodney W. Grimes.Dv SIGHUP
1788fae3551SRodney W. Grimesto
1795df42cf4SPhilippe Charnier.Nm
1808fae3551SRodney W. Grimeswith the command
1818fae3551SRodney W. Grimes.Dq Li "kill -HUP 1" .
1828fae3551SRodney W. GrimesOn receipt of this signal,
1835df42cf4SPhilippe Charnier.Nm
1848fae3551SRodney W. Grimesre-reads the
185edf0e5b3SMike Pritchard.Xr ttys 5
1868fae3551SRodney W. Grimesfile.
1878fae3551SRodney W. GrimesWhen a line is turned off in
188edf0e5b3SMike Pritchard.Xr ttys 5 ,
1895df42cf4SPhilippe Charnier.Nm
1908fae3551SRodney W. Grimeswill send a SIGHUP signal to the controlling process
1918fae3551SRodney W. Grimesfor the session associated with the line.
1928fae3551SRodney W. GrimesFor any lines that were previously turned off in the
193edf0e5b3SMike Pritchard.Xr ttys 5
1948fae3551SRodney W. Grimesfile and are now on,
1955df42cf4SPhilippe Charnier.Nm
196f0f4f756SSheldon Hearnexecutes the command specified in the second field.
197f0f4f756SSheldon HearnIf the command or window field for a line is changed,
1988fae3551SRodney W. Grimesthe change takes effect at the end of the current
1998fae3551SRodney W. Grimeslogin session (e.g., the next time
2005df42cf4SPhilippe Charnier.Nm
2018fae3551SRodney W. Grimesstarts a process on the line).
2028fae3551SRodney W. GrimesIf a line is commented out or deleted from
203edf0e5b3SMike Pritchard.Xr ttys 5 ,
2045df42cf4SPhilippe Charnier.Nm
2058fae3551SRodney W. Grimeswill not do anything at all to that line.
2068fae3551SRodney W. Grimes.Pp
207e1205e80SPhilippe CharnierThe
208e1205e80SPhilippe Charnier.Nm
209e1205e80SPhilippe Charnierutility will terminate multi-user operations and resume single-user mode
2108fae3551SRodney W. Grimesif sent a terminate
2118fae3551SRodney W. Grimes.Pq Dv TERM
2128fae3551SRodney W. Grimessignal, for example,
2138fae3551SRodney W. Grimes.Dq Li "kill \-TERM 1" .
2148fae3551SRodney W. GrimesIf there are processes outstanding that are deadlocked (because of
2158fae3551SRodney W. Grimeshardware or software failure),
2165df42cf4SPhilippe Charnier.Nm
2178fae3551SRodney W. Grimeswill not wait for them all to die (which might take forever), but
2188fae3551SRodney W. Grimeswill time out after 30 seconds and print a warning message.
2198fae3551SRodney W. Grimes.Pp
220e1205e80SPhilippe CharnierThe
221e1205e80SPhilippe Charnier.Nm
222e1205e80SPhilippe Charnierutility will cease creating new processes
2238fae3551SRodney W. Grimesand allow the system to slowly die away, if it is sent a terminal stop
2248fae3551SRodney W. Grimes.Pq Dv TSTP
22557e4378bSRuslan Ermilovsignal, i.e.\&
2268fae3551SRodney W. Grimes.Dq Li "kill \-TSTP 1" .
2278fae3551SRodney W. GrimesA later hangup will resume full
2281681d659SRuslan Ermilovmulti-user operations, or a terminate will start a single-user shell.
2298fae3551SRodney W. GrimesThis hook is used by
2308fae3551SRodney W. Grimes.Xr reboot 8
2318fae3551SRodney W. Grimesand
2328fae3551SRodney W. Grimes.Xr halt 8 .
2338fae3551SRodney W. Grimes.Pp
234e1205e80SPhilippe CharnierThe
235e1205e80SPhilippe Charnier.Nm
236e1205e80SPhilippe Charnierutility will 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
23957e4378bSRuslan Ermilovsignal, 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
244e1205e80SPhilippe CharnierThe
245e1205e80SPhilippe Charnier.Nm
246e1205e80SPhilippe Charnierutility will do the same, except it will halt the machine if sent
247a0a549c7SRuslan Ermilovthe user defined signal 1
248a0a549c7SRuslan Ermilov.Pq Dv USR1 ,
2491681d659SRuslan Ermilovor will halt and turn the power off (if hardware permits) if sent
250a0a549c7SRuslan Ermilovthe user defined signal 2
251a0a549c7SRuslan Ermilov.Pq Dv USR2 .
252a0a549c7SRuslan Ermilov.Pp
2536ebaa024SJoseph KoshyWhen shutting down the machine,
2545df42cf4SPhilippe Charnier.Nm
2558889c700SDavid Nugentwill try to run the
2568889c700SDavid Nugent.Pa /etc/rc.shutdown
257ef8f7ac9SSheldon Hearnscript.
258ef8f7ac9SSheldon HearnThis script can be used to cleanly terminate specific programs such
2598889c700SDavid Nugentas
2608889c700SDavid Nugent.Nm innd
2618889c700SDavid Nugent(the InterNetNews server).
262724447acSRalf S. EngelschallIf this script does not terminate within 120 seconds,
263724447acSRalf S. Engelschall.Nm
2644e9e907dSRuslan Ermilovwill terminate it.
2654e9e907dSRuslan ErmilovThe timeout can be configured via the
266724447acSRalf S. Engelschall.Xr sysctl 8
267724447acSRalf S. Engelschallvariable
268724447acSRalf S. Engelschall.Va kern.init_shutdown_timeout .
2698889c700SDavid Nugent.Pp
2705fda0d60SAndriy Gapon.Nm init
2715fda0d60SAndriy Gaponpasses
2725fda0d60SAndriy Gapon.Dq Li single
2735fda0d60SAndriy Gaponas the argument to the shutdown script if return to single-user mode
2745fda0d60SAndriy Gaponis requested.
2755fda0d60SAndriy GaponOtherwise,
2765fda0d60SAndriy Gapon.Dq Li reboot
2775fda0d60SAndriy Gaponargument is used.
2785fda0d60SAndriy Gapon.Pp
2794d159769SKyle EvansAfter all user processes have been terminated,
2804d159769SKyle Evans.Nm
2814d159769SKyle Evanswill try to run the
2824d159769SKyle Evans.Pa /etc/rc.final
2834d159769SKyle Evansscript.
2844d159769SKyle EvansThis script can be used to finally prepare and unmount filesystems that may have
2854d159769SKyle Evansbeen needed during shutdown, for instance.
2864d159769SKyle Evans.Pp
2878fae3551SRodney W. GrimesThe role of
2885df42cf4SPhilippe Charnier.Nm
2898fae3551SRodney W. Grimesis so critical that if it dies, the system will reboot itself
2908fae3551SRodney W. Grimesautomatically.
2918fae3551SRodney W. GrimesIf, at bootstrap time, the
2925df42cf4SPhilippe Charnier.Nm
2938fae3551SRodney W. Grimesprocess cannot be located, the system will panic with the message
2941681d659SRuslan Ermilov.Dq "panic: init died (signal %d, exit %d)" .
2951681d659SRuslan Ermilov.Pp
2965d94d8b6SRuslan ErmilovIf run as a user process as shown in the second synopsis line,
2971681d659SRuslan Ermilov.Nm
2981681d659SRuslan Ermilovwill emulate
2991681d659SRuslan Ermilov.At V
3009806e231SRuslan Ermilovbehavior, i.e., super-user can specify the desired
3011681d659SRuslan Ermilov.Em run-level
3021681d659SRuslan Ermilovon a command line, and
3031681d659SRuslan Ermilov.Nm
3041681d659SRuslan Ermilovwill signal the original
305c4d9468eSRuslan Ermilov(PID 1)
3061681d659SRuslan Ermilov.Nm
3071681d659SRuslan Ermilovas follows:
3081681d659SRuslan Ermilov.Bl -column Run-level SIGTERM
309c2965cd1SJoel Dahl.It Sy "Run-level	Signal	Action"
310ef159a1bSEdward Tomasz Napierala.It Cm 0 Ta Dv SIGUSR1 Ta "Halt"
3111681d659SRuslan Ermilov.It Cm 0 Ta Dv SIGUSR2 Ta "Halt and turn the power off"
31235c1d16eSWarner Losh.It Cm 0 Ta Dv SIGWINCH Ta "Halt and turn the power off and then back on"
3131681d659SRuslan Ermilov.It Cm 1 Ta Dv SIGTERM Ta "Go to single-user mode"
3141681d659SRuslan Ermilov.It Cm 6 Ta Dv SIGINT Ta "Reboot the machine"
3151681d659SRuslan Ermilov.It Cm c Ta Dv SIGTSTP Ta "Block further logins"
3161681d659SRuslan Ermilov.It Cm q Ta Dv SIGHUP Ta Rescan the
3171681d659SRuslan Ermilov.Xr ttys 5
3181681d659SRuslan Ermilovfile
3191681d659SRuslan Ermilov.El
320fdfbf127SEdward Tomasz Napierala.Sh KERNEL ENVIRONMENT VARIABLES
321fdfbf127SEdward Tomasz NapieralaThe following
322fdfbf127SEdward Tomasz Napierala.Xr kenv 2
323fdfbf127SEdward Tomasz Napieralavariables are available as
324fdfbf127SEdward Tomasz Napierala.Xr loader 8
325fdfbf127SEdward Tomasz Napieralatunables:
326fdfbf127SEdward Tomasz Napierala.Bl -tag -width indent
327fdfbf127SEdward Tomasz Napierala.It Va init_chroot
328fdfbf127SEdward Tomasz NapieralaIf set to a valid directory in the root file system, it causes
329fdfbf127SEdward Tomasz Napierala.Nm
330fdfbf127SEdward Tomasz Napieralato perform a
331fdfbf127SEdward Tomasz Napierala.Xr chroot 2
332fdfbf127SEdward Tomasz Napieralaoperation on that directory, making it the new root directory.
333fdfbf127SEdward Tomasz NapieralaThat happens before entering single-user mode or multi-user
334fdfbf127SEdward Tomasz Napieralamode (but after executing the
335fdfbf127SEdward Tomasz Napierala.Va init_script
336fdfbf127SEdward Tomasz Napieralaif enabled).
337fdfbf127SEdward Tomasz NapieralaThis functionality has generally been eclipsed by rerooting.
338fdfbf127SEdward Tomasz NapieralaSee
339fdfbf127SEdward Tomasz Napierala.Xr reboot 8
340fdfbf127SEdward Tomasz Napierala.Fl r
341fdfbf127SEdward Tomasz Napieralafor details.
342335fe94fSEdward Tomasz Napierala.It Va init_exec
343335fe94fSEdward Tomasz NapieralaIf set to a valid file name in the root file system,
344335fe94fSEdward Tomasz Napieralainstructs
345335fe94fSEdward Tomasz Napierala.Nm
346335fe94fSEdward Tomasz Napieralato directly execute that file as the very first action,
347335fe94fSEdward Tomasz Napieralareplacing
348335fe94fSEdward Tomasz Napierala.Nm
349335fe94fSEdward Tomasz Napieralaas PID 1.
350fdfbf127SEdward Tomasz Napierala.It Va init_script
351fdfbf127SEdward Tomasz NapieralaIf set to a valid file name in the root file system,
352fdfbf127SEdward Tomasz Napieralainstructs
353fdfbf127SEdward Tomasz Napierala.Nm
354fdfbf127SEdward Tomasz Napieralato run that script as the very first action,
355fdfbf127SEdward Tomasz Napieralabefore doing anything else.
356fdfbf127SEdward Tomasz NapieralaSignal handling and exit code interpretation is similar to
357fdfbf127SEdward Tomasz Napieralarunning the
358fdfbf127SEdward Tomasz Napierala.Pa /etc/rc
359fdfbf127SEdward Tomasz Napieralascript.
360fdfbf127SEdward Tomasz NapieralaIn particular, single-user operation is enforced
361fdfbf127SEdward Tomasz Napieralaif the script terminates with a non-zero exit code,
362fdfbf127SEdward Tomasz Napieralaor if a SIGTERM is delivered to the
363fdfbf127SEdward Tomasz Napierala.Nm
364fdfbf127SEdward Tomasz Napieralaprocess (PID 1).
365fdfbf127SEdward Tomasz NapieralaThis functionality has generally been eclipsed by rerooting.
366fdfbf127SEdward Tomasz NapieralaSee
367fdfbf127SEdward Tomasz Napierala.Xr reboot 8
368fdfbf127SEdward Tomasz Napierala.Fl r
369fdfbf127SEdward Tomasz Napieralafor details.
370fdfbf127SEdward Tomasz Napierala.It Va init_shell
371fdfbf127SEdward Tomasz NapieralaDefines the shell binary to be used for executing the various shell scripts.
372fdfbf127SEdward Tomasz NapieralaThe default is
373fdfbf127SEdward Tomasz Napierala.Dq Li /bin/sh .
374fdfbf127SEdward Tomasz NapieralaIt is used for running the
375335fe94fSEdward Tomasz Napierala.Va init_exec
376335fe94fSEdward Tomasz Napieralaor
377fdfbf127SEdward Tomasz Napierala.Va init_script
378fdfbf127SEdward Tomasz Napieralaif set, as well as for the
3794d159769SKyle Evans.Pa /etc/rc ,
3804d159769SKyle Evans.Pa /etc/rc.shutdown ,
381fdfbf127SEdward Tomasz Napieralaand
3824d159769SKyle Evans.Pa /etc/rc.final
383fdfbf127SEdward Tomasz Napieralascripts.
384fdfbf127SEdward Tomasz NapieralaThe value of the corresponding
385fdfbf127SEdward Tomasz Napierala.Xr kenv 2
386fdfbf127SEdward Tomasz Napieralavariable is evaluated every time
387fdfbf127SEdward Tomasz Napierala.Nm
388fdfbf127SEdward Tomasz Napieralacalls a shell script, so it can be changed later on using the
389fdfbf127SEdward Tomasz Napierala.Xr kenv 1
390fdfbf127SEdward Tomasz Napieralautility.
391fdfbf127SEdward Tomasz NapieralaIn particular, if a non-default shell is used for running an
392fdfbf127SEdward Tomasz Napierala.Va init_script ,
393fdfbf127SEdward Tomasz Napieralait might be desirable to have that script reset the value of
394fdfbf127SEdward Tomasz Napierala.Va init_shell
395fdfbf127SEdward Tomasz Napieralaback to the default, so that the
396fdfbf127SEdward Tomasz Napierala.Pa /etc/rc
397fdfbf127SEdward Tomasz Napieralascript is executed with the standard shell
398fdfbf127SEdward Tomasz Napierala.Pa /bin/sh .
399*d21e322dSGraham Percival.El
4008fae3551SRodney W. Grimes.Sh FILES
4014c2c7b2cSEd Schouten.Bl -tag -width /var/log/init.log -compact
4028fae3551SRodney W. Grimes.It Pa /dev/console
4035df42cf4SPhilippe Charniersystem console device
4048fae3551SRodney W. Grimes.It Pa /dev/tty*
4055df42cf4SPhilippe Charnierterminal ports found in
4065df42cf4SPhilippe Charnier.Xr ttys 5
4078fae3551SRodney W. Grimes.It Pa /etc/ttys
4085df42cf4SPhilippe Charnierthe terminal initialization information file
4098fae3551SRodney W. Grimes.It Pa /etc/rc
4105df42cf4SPhilippe Charniersystem startup commands
4118889c700SDavid Nugent.It Pa /etc/rc.shutdown
4125df42cf4SPhilippe Charniersystem shutdown commands
4134d159769SKyle Evans.It Pa /etc/rc.final
4144d159769SKyle Evanssystem shutdown commands (after process termination)
4154c2c7b2cSEd Schouten.It Pa /var/log/init.log
4164c2c7b2cSEd Schoutenlog of
4174c2c7b2cSEd Schouten.Xr rc 8
4184c2c7b2cSEd Schoutenoutput if the system console device is not available
4198fae3551SRodney W. Grimes.El
4206087df9eSRuslan Ermilov.Sh DIAGNOSTICS
4216087df9eSRuslan Ermilov.Bl -diag
4226087df9eSRuslan Ermilov.It "getty repeating too quickly on port %s, sleeping."
4236087df9eSRuslan ErmilovA process being started to service a line is exiting quickly
4246087df9eSRuslan Ermiloveach time it is started.
4256087df9eSRuslan ErmilovThis is often caused by a ringing or noisy terminal line.
4266087df9eSRuslan Ermilov.Bf -emphasis
4276087df9eSRuslan ErmilovInit will sleep for 30 seconds,
4286087df9eSRuslan Ermilovthen continue trying to start the process.
4296087df9eSRuslan Ermilov.Ef
4306087df9eSRuslan Ermilov.It "some processes would not die; ps axl advised."
4316087df9eSRuslan ErmilovA process
4326087df9eSRuslan Ermilovis hung and could not be killed when the system was shutting down.
4336087df9eSRuslan ErmilovThis condition is usually caused by a process
4346087df9eSRuslan Ermilovthat is stuck in a device driver because of
4356087df9eSRuslan Ermilova persistent device error condition.
4366087df9eSRuslan Ermilov.El
4378fae3551SRodney W. Grimes.Sh SEE ALSO
4388fae3551SRodney W. Grimes.Xr kill 1 ,
439af202156SWolfram Schneider.Xr login 1 ,
4408fae3551SRodney W. Grimes.Xr sh 1 ,
4418fae3551SRodney W. Grimes.Xr ttys 5 ,
4424e9e907dSRuslan Ermilov.Xr security 7 ,
4438fae3551SRodney W. Grimes.Xr getty 8 ,
444af202156SWolfram Schneider.Xr halt 8 ,
445280b191cSKen Smith.Xr jail 8 ,
4468fae3551SRodney W. Grimes.Xr rc 8 ,
4478fae3551SRodney W. Grimes.Xr reboot 8 ,
4486ebaa024SJoseph Koshy.Xr shutdown 8 ,
4496ebaa024SJoseph Koshy.Xr sysctl 8
4508fae3551SRodney W. Grimes.Sh HISTORY
451a0a549c7SRuslan ErmilovAn
4528fae3551SRodney W. Grimes.Nm
453e1205e80SPhilippe Charnierutility appeared in
4542580acbeSSevan Janiyan.At v1 .
4556ebaa024SJoseph Koshy.Sh CAVEATS
4568fae3551SRodney W. GrimesSystems without
4579680d7b6SPhilippe Charnier.Xr sysctl 8
4588fae3551SRodney W. Grimesbehave as though they have security level \-1.
4596ebaa024SJoseph Koshy.Pp
46004b2ac6eSGuy HelmerSetting the security level above 1 too early in the boot sequence can
4616ebaa024SJoseph Koshyprevent
4626ebaa024SJoseph Koshy.Xr fsck 8
4639806e231SRuslan Ermilovfrom repairing inconsistent file systems.
4649806e231SRuslan ErmilovThe
4656ebaa024SJoseph Koshypreferred location to set the security level is at the end of
4666ebaa024SJoseph Koshy.Pa /etc/rc
4676ebaa024SJoseph Koshyafter all multi-user startup actions are complete.
468