xref: /src/sbin/reboot/reboot.8 (revision 4453ec5b8716bc465ff5192986099dc75d1f2ce7)
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 December 8, 2025
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 stop and restart the system, respectively.
64.Pp
65Both utilities have two distinct modes of operation.
66In normal mode, they send a signal to the
67.Xr init 8
68process, which shuts down running services and stops or restarts the
69system.
70In fast mode, they flush the file system cache to disk, send all
71running processes a
72.Dv SIGTERM
73(and subsequently a
74.Dv SIGKILL )
75and stop or restart the system themselves.
76Services are killed, not shut down, which may result in data loss.
77.Pp
78In either mode, the action is logged, including entering a shutdown
79record into the user accounting database.
80.Pp
81The following options are available:
82.Bl -tag -width indent
83.It Fl c
84The system will turn off the power and then turn it back on if it can.
85If the power down action fails, the system
86will halt or reboot normally, depending on whether
87.Nm halt
88or
89.Nm
90was called.
91At the present time, only the
92.Xr ipmi 4
93driver implements the power cycle functionality and only on hardware
94with a BMC that supports power cycling.
95Unlike power off, the amount of hardware that supports power cycling
96is small.
97.It Fl D
98Delete existing
99.Nm nextboot
100configuration and exit.
101.It Fl d
102The system is requested to create a crash dump.
103This option is
104supported only when rebooting, and it has no effect unless a dump
105device has previously been specified with
106.Xr dumpon 8 .
107.It Fl e Ar variable=value
108Sets
109.Va variable
110to
111.Va value
112in the loader's and kernel's environment.
113If
114.Va value
115is not already enclosed in double quotes, they will be added before writing to the
116.Nm nextboot
117configuration.
118Care should be taken if
119.Va value
120contains any characters that are special to the shell or loader's configuration
121parsing code.
122.It Fl f
123Forced mode.
124Normally,
125.Nm halt
126or
127.Nm
128checks for the presence of the next kernel,
129and absence of the
130.Pa /var/run/noshutdown
131file.
132Without this flag, the operation is rejected if one of these checks
133fails.
134.It Fl k Ar kname
135Boot the specified kernel
136.Ar kname
137on the next system boot.
138This is a one-shot option, the
139.Em default
140kernel will be booted on successive boots.
141No
142.Nm reboot
143or
144.Nm halt
145will be performed if
146.Em /boot/kname/kernel
147does not exist unless the
148.Fl f
149flag is specified.
150.It Fl l
151The halt or reboot is
152.Em not
153logged to the system log.
154This option is intended for applications such as
155.Xr shutdown 8 ,
156that call
157.Nm
158or
159.Nm halt
160and log this themselves.
161.It Fl N
162The file system cache is not flushed during the initial process clean-up,
163however the kernel level
164.Xr reboot 2
165is still processed with a sync.
166This option can be useful for performing a
167.Dq best-effort
168reboot when devices might be unavailable.
169This can happen when devices have been disconnected, such as with
170.Xr iscsi 4 .
171.It Fl n
172The file system cache is not flushed.
173This option should probably not be used.
174.It Fl o Ar options
175This option
176allows the passing of kernel flags for the next boot.
177.It Fl p
178The system will turn off the power if it can.
179If the power down action fails, the system
180will halt or reboot normally, depending on whether
181.Nm halt
182or
183.Nm
184was called.
185.It Fl q
186The system is halted or restarted quickly and ungracefully, and only
187the flushing of the file system cache is performed (if the
188.Fl n
189option is not specified).
190This option should probably not be used.
191.It Fl r
192The system kills all processes, unmounts all filesystems, mounts the new
193root filesystem, and begins the usual startup sequence.
194After changing vfs.root.mountfrom with
195.Xr kenv 1 ,
196.Nm Fl r
197can be used to change the root filesystem while preserving kernel state.
198This requires the
199.Xr tmpfs 4
200kernel module to be loaded because
201.Xr init 8
202needs a place to store itself after the old root is unmounted, but
203before the new root is in place.
204.El
205.Pp
206The
207.Nm fasthalt
208and
209.Nm fastboot
210utilities invoke
211.Nm halt
212and
213.Nm ,
214respectively, in fast mode.
215.Pp
216The
217.Xr shutdown 8
218utility can be used to not only stop or restart the system right away,
219but also schedule a stop or restart in the future, and will, unlike
220.Nm halt
221and
222.Nm ,
223give users advance warning of their impending doom.
224.Sh EXAMPLES
225Replace current root filesystem with UFS mounted from
226.Pa /dev/ada0s1a :
227.Bd -literal -offset indent
228kenv vfs.root.mountfrom=ufs:/dev/ada0s1a
229reboot -r
230.Ed
231.Pp
232This mechanism can also be used with NFS, with a caveat that
233it only works with NFSv4, and requires a numeric IPv4 address:
234.Bd -literal -offset indent
235kenv vfs.root.mountfrom=nfs:192.168.1.1:/share/name
236reboot -r
237.Ed
238.Sh SEE ALSO
239.Xr kenv 1 ,
240.Xr reboot 2 ,
241.Xr getutxent 3 ,
242.Xr ipmi 4 ,
243.Xr boot 8 ,
244.Xr dumpon 8 ,
245.Xr nextboot 8 ,
246.Xr savecore 8 ,
247.Xr shutdown 8 ,
248.Xr sync 8
249.Sh HISTORY
250A
251.Nm
252utility appeared in
253.Bx 4.0 .
254.Pp
255Historically, the
256.Xr shutdown 8
257utility was used when the system needed to be halted or restarted
258cleanly in the normal course of operations, and the
259.Nm halt
260and
261.Nm
262utilities were blunt instruments used only in single-user mode or if
263exceptional circumstances made a normal shutdown impractical.
264As other operating systems did away with this distinction, and it
265became clear that many users were unaware of it and were using
266.Nm
267in the belief that it performed a clean shutdown, it was rewritten to
268conform to that expectation.
269