xref: /freebsd/lib/libsys/reboot.2 (revision 8269e7673cf033aba67dab8264fe719920c70f87)
1*8269e767SBrooks Davis.\" Copyright (c) 1980, 1991, 1993
2*8269e767SBrooks Davis.\"	The Regents of the University of California.  All rights reserved.
3*8269e767SBrooks Davis.\"
4*8269e767SBrooks Davis.\" Redistribution and use in source and binary forms, with or without
5*8269e767SBrooks Davis.\" modification, are permitted provided that the following conditions
6*8269e767SBrooks Davis.\" are met:
7*8269e767SBrooks Davis.\" 1. Redistributions of source code must retain the above copyright
8*8269e767SBrooks Davis.\"    notice, this list of conditions and the following disclaimer.
9*8269e767SBrooks Davis.\" 2. Redistributions in binary form must reproduce the above copyright
10*8269e767SBrooks Davis.\"    notice, this list of conditions and the following disclaimer in the
11*8269e767SBrooks Davis.\"    documentation and/or other materials provided with the distribution.
12*8269e767SBrooks Davis.\" 3. Neither the name of the University nor the names of its contributors
13*8269e767SBrooks Davis.\"    may be used to endorse or promote products derived from this software
14*8269e767SBrooks Davis.\"    without specific prior written permission.
15*8269e767SBrooks Davis.\"
16*8269e767SBrooks Davis.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17*8269e767SBrooks Davis.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18*8269e767SBrooks Davis.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19*8269e767SBrooks Davis.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20*8269e767SBrooks Davis.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21*8269e767SBrooks Davis.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22*8269e767SBrooks Davis.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23*8269e767SBrooks Davis.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24*8269e767SBrooks Davis.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25*8269e767SBrooks Davis.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26*8269e767SBrooks Davis.\" SUCH DAMAGE.
27*8269e767SBrooks Davis.\"
28*8269e767SBrooks Davis.Dd July 10, 2018
29*8269e767SBrooks Davis.Dt REBOOT 2
30*8269e767SBrooks Davis.Os
31*8269e767SBrooks Davis.Sh NAME
32*8269e767SBrooks Davis.Nm reboot
33*8269e767SBrooks Davis.Nd reboot system or halt processor
34*8269e767SBrooks Davis.Sh LIBRARY
35*8269e767SBrooks Davis.Lb libc
36*8269e767SBrooks Davis.Sh SYNOPSIS
37*8269e767SBrooks Davis.In unistd.h
38*8269e767SBrooks Davis.In sys/reboot.h
39*8269e767SBrooks Davis.Ft int
40*8269e767SBrooks Davis.Fn reboot "int howto"
41*8269e767SBrooks Davis.Sh DESCRIPTION
42*8269e767SBrooks DavisThe
43*8269e767SBrooks Davis.Fn reboot
44*8269e767SBrooks Davissystem call
45*8269e767SBrooks Davisreboots the system.
46*8269e767SBrooks DavisOnly the super-user may reboot a machine on demand.
47*8269e767SBrooks DavisHowever, a reboot is invoked
48*8269e767SBrooks Davisautomatically in the event of unrecoverable system failures.
49*8269e767SBrooks Davis.Pp
50*8269e767SBrooks DavisThe
51*8269e767SBrooks Davis.Fa howto
52*8269e767SBrooks Davisargument
53*8269e767SBrooks Davisis a mask of options; the system call interface allows the following
54*8269e767SBrooks Davisoptions, defined in the include file
55*8269e767SBrooks Davis.In sys/reboot.h ,
56*8269e767SBrooks Davisto be passed
57*8269e767SBrooks Davisto the new kernel or the new bootstrap and init programs.
58*8269e767SBrooks Davis.Bl -tag -width RB_POWERCYCLE
59*8269e767SBrooks Davis.It Dv RB_AUTOBOOT
60*8269e767SBrooks DavisThe default, causing the system to reboot in its usual fashion.
61*8269e767SBrooks Davis.It Dv RB_ASKNAME
62*8269e767SBrooks DavisNormally the system only prompts the user if the loader specified root
63*8269e767SBrooks Davisfile system has an error.
64*8269e767SBrooks DavisThis flag forces it to always prompt the user for the root partition.
65*8269e767SBrooks Davis.It Dv RB_DFLTROOT
66*8269e767SBrooks DavisUse the compiled in root device.
67*8269e767SBrooks DavisNormally, the system uses the device from which it was booted
68*8269e767SBrooks Davisas the root device if possible.
69*8269e767SBrooks Davis(The default behavior is dependent on the ability of the bootstrap program
70*8269e767SBrooks Davisto determine the drive from which it was loaded, which is not possible
71*8269e767SBrooks Davison all systems.)
72*8269e767SBrooks Davis.It Dv RB_DUMP
73*8269e767SBrooks DavisDump kernel memory before rebooting; see
74*8269e767SBrooks Davis.Xr savecore 8
75*8269e767SBrooks Davisfor more information.
76*8269e767SBrooks Davis.It Dv RB_HALT
77*8269e767SBrooks DavisThe processor is simply halted; no reboot takes place.
78*8269e767SBrooks DavisThis option should be used with caution.
79*8269e767SBrooks Davis.It Dv RB_POWERCYCLE
80*8269e767SBrooks DavisAfter halting, the shutdown code will do what it can to turn
81*8269e767SBrooks Davisoff the power and then turn the power back on.
82*8269e767SBrooks DavisThis requires hardware support, usually an auxiliary microprocessor
83*8269e767SBrooks Davisthat can sequence the power supply.
84*8269e767SBrooks DavisAt present only the
85*8269e767SBrooks Davis.Xr ipmi 4
86*8269e767SBrooks Davisdriver implements this feature.
87*8269e767SBrooks Davis.It Dv RB_POWEROFF
88*8269e767SBrooks DavisAfter halting, the shutdown code will do what it can to turn
89*8269e767SBrooks Davisoff the power.
90*8269e767SBrooks DavisThis requires hardware support.
91*8269e767SBrooks Davis.It Dv RB_KDB
92*8269e767SBrooks DavisLoad the symbol table and enable a built-in debugger in the system.
93*8269e767SBrooks DavisThis option will have no useful function if the kernel is not configured
94*8269e767SBrooks Davisfor debugging.
95*8269e767SBrooks DavisSeveral other options have different meaning if combined
96*8269e767SBrooks Daviswith this option, although their use may not be possible
97*8269e767SBrooks Davisvia the
98*8269e767SBrooks Davis.Fn reboot
99*8269e767SBrooks Davissystem call.
100*8269e767SBrooks DavisSee
101*8269e767SBrooks Davis.Xr ddb 4
102*8269e767SBrooks Davisfor more information.
103*8269e767SBrooks Davis.It Dv RB_NOSYNC
104*8269e767SBrooks DavisNormally, the disks are sync'd (see
105*8269e767SBrooks Davis.Xr sync 8 )
106*8269e767SBrooks Davisbefore the processor is halted or rebooted.
107*8269e767SBrooks DavisThis option may be useful if file system changes have been made manually
108*8269e767SBrooks Davisor if the processor is on fire.
109*8269e767SBrooks Davis.It Dv RB_REROOT
110*8269e767SBrooks DavisInstead of rebooting, unmount all filesystems except the one containing
111*8269e767SBrooks Daviscurrently-running executable, and mount root filesystem using the same
112*8269e767SBrooks Davismechanism which is used during normal boot, based on
113*8269e767SBrooks Davisvfs.root.mountfrom
114*8269e767SBrooks Davis.Xr kenv 1
115*8269e767SBrooks Davisvariable.
116*8269e767SBrooks Davis.It Dv RB_RDONLY
117*8269e767SBrooks DavisInitially mount the root file system read-only.
118*8269e767SBrooks DavisThis is currently the default, and this option has been deprecated.
119*8269e767SBrooks Davis.It Dv RB_SINGLE
120*8269e767SBrooks DavisNormally, the reboot procedure involves an automatic disk consistency
121*8269e767SBrooks Davischeck and then multi-user operations.
122*8269e767SBrooks Davis.Dv RB_SINGLE
123*8269e767SBrooks Davisprevents this, booting the system with a single-user shell
124*8269e767SBrooks Davison the console.
125*8269e767SBrooks Davis.Dv RB_SINGLE
126*8269e767SBrooks Davisis actually interpreted by the
127*8269e767SBrooks Davis.Xr init 8
128*8269e767SBrooks Davisprogram in the newly booted system.
129*8269e767SBrooks Davis.El
130*8269e767SBrooks Davis.Pp
131*8269e767SBrooks DavisWhen no options are given (i.e.,
132*8269e767SBrooks Davis.Dv RB_AUTOBOOT
133*8269e767SBrooks Davisis used), the system is
134*8269e767SBrooks Davisrebooted from file
135*8269e767SBrooks Davis.Dq kernel
136*8269e767SBrooks Davisin the root file system of unit 0
137*8269e767SBrooks Davisof a disk chosen in a processor specific way.
138*8269e767SBrooks DavisAn automatic consistency check of the disks is normally performed
139*8269e767SBrooks Davis(see
140*8269e767SBrooks Davis.Xr fsck 8 ) .
141*8269e767SBrooks Davis.Sh RETURN VALUES
142*8269e767SBrooks DavisIf successful, this call never returns.
143*8269e767SBrooks DavisOtherwise, a -1 is returned and an error is returned in the global
144*8269e767SBrooks Davisvariable
145*8269e767SBrooks Davis.Va errno .
146*8269e767SBrooks Davis.Sh ERRORS
147*8269e767SBrooks Davis.Bl -tag -width Er
148*8269e767SBrooks Davis.It Bq Er EPERM
149*8269e767SBrooks DavisThe caller is not the super-user.
150*8269e767SBrooks Davis.El
151*8269e767SBrooks Davis.Sh SEE ALSO
152*8269e767SBrooks Davis.Xr crash 8 ,
153*8269e767SBrooks Davis.Xr halt 8 ,
154*8269e767SBrooks Davis.Xr init 8 ,
155*8269e767SBrooks Davis.Xr reboot 8 ,
156*8269e767SBrooks Davis.Xr savecore 8 ,
157*8269e767SBrooks Davis.Xr reboot 9
158*8269e767SBrooks Davis.Sh HISTORY
159*8269e767SBrooks DavisThe
160*8269e767SBrooks Davis.Fn reboot
161*8269e767SBrooks Davissystem call appeared in
162*8269e767SBrooks Davis.Bx 4.0 .
163