xref: /freebsd/sbin/reboot/reboot.8 (revision 24e4dcf4ba5e9dedcf89efd358ea3e1fe5867020)
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 April 12, 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 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 f
114Force reboot.
115Normally,
116.Nm
117checks for the presence of the next kernel,
118and absence of the
119.Pa /var/run/noshutdown
120file.
121Without this flag, reboot is denied if one of the conditions failed.
122.It Fl k Ar kname
123Boot the specified kernel
124.Ar kname
125on the next system boot.
126This is a one-shot option, the
127.Em default
128kernel will be booted on successive boots.
129No
130.Nm reboot
131or
132.Nm halt
133will be performed if
134.Em /boot/kname/kernel
135does not exist unless the
136.Fl f
137flag is specified.
138.It Fl l
139The halt or reboot is
140.Em not
141logged to the system log.
142This option is intended for applications such as
143.Xr shutdown 8 ,
144that call
145.Nm
146or
147.Nm halt
148and log this themselves.
149.It Fl N
150The file system cache is not flushed during the initial process clean-up,
151however the kernel level
152.Xr reboot 2
153is still processed with a sync.
154This option can be useful for performing a
155.Dq best-effort
156reboot when devices might be unavailable.
157This can happen when devices have been disconnected, such as with
158.Xr iscsi 4 .
159.It Fl n
160The file system cache is not flushed.
161This option should probably not be used.
162.It Fl o Ar options
163This option
164allows the passing of kernel flags for the next boot.
165.It Fl p
166The system will turn off the power if it can.
167If the power down action fails, the system
168will halt or reboot normally, depending on whether
169.Nm halt
170or
171.Nm
172was called.
173.It Fl q
174The system is halted or restarted quickly and ungracefully, and only
175the flushing of the file system cache is performed (if the
176.Fl n
177option is not specified).
178This option should probably not be used.
179.It Fl r
180The system kills all processes, unmounts all filesystems, mounts the new
181root filesystem, and begins the usual startup sequence.
182After changing vfs.root.mountfrom with
183.Xr kenv 1 ,
184.Nm Fl r
185can be used to change the root filesystem while preserving kernel state.
186This requires the
187.Xr tmpfs 4
188kernel module to be loaded because
189.Xr init 8
190needs a place to store itself after the old root is unmounted, but
191before the new root is in place.
192.El
193.Pp
194The
195.Nm fasthalt
196and
197.Nm fastboot
198utilities are nothing more than aliases for the
199.Nm halt
200and
201.Nm
202utilities.
203.Pp
204Normally, the
205.Xr shutdown 8
206utility is used when the system needs to be halted or restarted, giving
207users advance warning of their impending doom and cleanly terminating
208specific programs.
209.Sh EXAMPLES
210Replace current root filesystem with UFS mounted from
211.Pa /dev/ada0s1a :
212.Bd -literal -offset indent
213kenv vfs.root.mountfrom=ufs:/dev/ada0s1a
214reboot -r
215.Ed
216.Pp
217This mechanism can also be used with NFS, with a caveat that
218it only works with NFSv4, and requires a numeric IPv4 address:
219.Bd -literal -offset indent
220kenv vfs.root.mountfrom=nfs:192.168.1.1:/share/name
221reboot -r
222.Ed
223.Sh SEE ALSO
224.Xr kenv 1 ,
225.Xr reboot 2 ,
226.Xr getutxent 3 ,
227.Xr ipmi 4 ,
228.Xr boot 8 ,
229.Xr dumpon 8 ,
230.Xr nextboot 8 ,
231.Xr savecore 8 ,
232.Xr shutdown 8 ,
233.Xr sync 8
234.Sh HISTORY
235A
236.Nm
237utility appeared in
238.Bx 4.0 .
239