xref: /freebsd/sbin/reboot/reboot.8 (revision a7148ab39c03abd4d1a84997c70bf96f15dd2a09)
1.\" Copyright (c) 1990, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.Dd February 8, 2024
29.Dt REBOOT 8
30.Os
31.Sh NAME
32.Nm reboot ,
33.Nm halt ,
34.Nm fastboot ,
35.Nm fasthalt
36.Nd stopping and restarting the system
37.Sh SYNOPSIS
38.Nm halt
39.Op Fl DflNnpq
40.Op Fl e Ar variable=value
41.Op Fl k Ar kernel
42.Op Fl o Ar options
43.Nm
44.Op Fl cDdflNnpqr
45.Op Fl e Ar variable=value
46.Op Fl k Ar kernel
47.Op Fl o Ar options
48.Nm fasthalt
49.Op Fl DflNnpq
50.Op Fl e Ar variable=value
51.Op Fl k Ar kernel
52.Op Fl o Ar options
53.Nm fastboot
54.Op Fl dDflNnpq
55.Op Fl e Ar variable=value
56.Op Fl k Ar kernel
57.Op Fl o Ar options
58.Sh DESCRIPTION
59The
60.Nm halt
61and
62.Nm
63utilities flush the file system cache to disk, send all running processes
64a
65.Dv SIGTERM
66(and subsequently a
67.Dv SIGKILL )
68and, respectively, halt or restart the system.
69The action is logged, including entering a shutdown record into the user
70accounting database.
71.Pp
72The options are as follows:
73.Bl -tag -width indent
74.It Fl c
75The system will turn off the power and then turn it back on if it can.
76If the power down action fails, the system
77will halt or reboot normally, depending on whether
78.Nm halt
79or
80.Nm
81was called.
82At the present time, only the
83.Xr ipmi 4
84driver implements the power cycle functionality and only on hardware
85with a BMC that supports power cycling.
86Unlike power off, the amount of hardware that supports power cycling
87is small.
88.It Fl D
89Delete existing
90.Nm nextboot
91configuration and exit.
92.It Fl d
93The system is requested to create a crash dump.
94This option is
95supported only when rebooting, and it has no effect unless a dump
96device has previously been specified with
97.Xr dumpon 8 .
98.It Fl e Ar variable=value
99Sets
100.Va variable
101to
102.Va value
103in the loader's and kernel's environment.
104If
105.Va value
106is not already enclosed in double quotes, they will be added before writing to the
107.Nm nextboot
108configuration.
109Care should be taken if
110.Va value
111contains any characters that are special to the shell or loader's configuration
112parsing code.
113.It Fl k Ar kname
114Boot the specified kernel
115.Ar kname
116on the next system boot.
117This is a one-shot option, the
118.Em default
119kernel will be booted on successive boots.
120No
121.Nm reboot
122or
123.Nm halt
124will be performed if
125.Em /boot/kname/kernel
126does not exist unless the
127.Fl f
128flag is specified.
129.It Fl l
130The halt or reboot is
131.Em not
132logged to the system log.
133This option is intended for applications such as
134.Xr shutdown 8 ,
135that call
136.Nm
137or
138.Nm halt
139and log this themselves.
140.It Fl N
141The file system cache is not flushed during the initial process clean-up,
142however the kernel level
143.Xr reboot 2
144is still processed with a sync.
145This option can be useful for performing a
146.Dq best-effort
147reboot when devices might be unavailable.
148This can happen when devices have been disconnected, such as with
149.Xr iscsi 4 .
150.It Fl n
151The file system cache is not flushed.
152This option should probably not be used.
153.It Fl o Ar options
154This option
155allows the passing of kernel flags for the next boot.
156.It Fl p
157The system will turn off the power if it can.
158If the power down action fails, the system
159will halt or reboot normally, depending on whether
160.Nm halt
161or
162.Nm
163was called.
164.It Fl q
165The system is halted or restarted quickly and ungracefully, and only
166the flushing of the file system cache is performed (if the
167.Fl n
168option is not specified).
169This option should probably not be used.
170.It Fl r
171The system kills all processes, unmounts all filesystems, mounts the new
172root filesystem, and begins the usual startup sequence.
173After changing vfs.root.mountfrom with
174.Xr kenv 1 ,
175.Nm Fl r
176can be used to change the root filesystem while preserving kernel state.
177This requires the
178.Xr tmpfs 4
179kernel module to be loaded because
180.Xr init 8
181needs a place to store itself after the old root is unmounted, but
182before the new root is in place.
183.El
184.Pp
185The
186.Nm fasthalt
187and
188.Nm fastboot
189utilities are nothing more than aliases for the
190.Nm halt
191and
192.Nm
193utilities.
194.Pp
195Normally, the
196.Xr shutdown 8
197utility is used when the system needs to be halted or restarted, giving
198users advance warning of their impending doom and cleanly terminating
199specific programs.
200.Sh EXAMPLES
201Replace current root filesystem with UFS mounted from
202.Pa /dev/ada0s1a :
203.Bd -literal -offset indent
204kenv vfs.root.mountfrom=ufs:/dev/ada0s1a
205reboot -r
206.Ed
207.Pp
208This mechanism can also be used with NFS, with a caveat that
209it only works with NFSv4, and requires a numeric IPv4 address:
210.Bd -literal -offset indent
211kenv vfs.root.mountfrom=nfs:192.168.1.1:/share/name
212reboot -r
213.Ed
214.Sh SEE ALSO
215.Xr kenv 1 ,
216.Xr getutxent 3 ,
217.Xr ipmi 4 ,
218.Xr boot 8 ,
219.Xr dumpon 8 ,
220.Xr nextboot 8 ,
221.Xr savecore 8 ,
222.Xr shutdown 8 ,
223.Xr sync 8
224.Sh HISTORY
225A
226.Nm
227utility appeared in
228.Bx 4.0 .
229