xref: /freebsd/sbin/reboot/reboot.8 (revision 02e9120893770924227138ba49df1edb3896112a)
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 20, 2017
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 lNnpq
40.Op Fl k Ar kernel
41.Nm
42.Op Fl cdlNnpqr
43.Op Fl k Ar kernel
44.Nm fasthalt
45.Op Fl lNnpq
46.Op Fl k Ar kernel
47.Nm fastboot
48.Op Fl dlNnpq
49.Op Fl k Ar kernel
50.Sh DESCRIPTION
51The
52.Nm halt
53and
54.Nm
55utilities flush the file system cache to disk, send all running processes
56a
57.Dv SIGTERM
58(and subsequently a
59.Dv SIGKILL )
60and, respectively, halt or restart the system.
61The action is logged, including entering a shutdown record into the user
62accounting database.
63.Pp
64The options are as follows:
65.Bl -tag -width indent
66.It Fl c
67The system will turn off the power and then turn it back on if it can.
68If the power down action fails, the system
69will halt or reboot normally, depending on whether
70.Nm halt
71or
72.Nm
73was called.
74At the present time, only the
75.Xr ipmi 4
76driver implements the power cycle functionality and only on hardware
77with a BMC that supports power cycling.
78Unlike power off, the amount of hardware that supports power cycling
79is small.
80.It Fl d
81The system is requested to create a crash dump.
82This option is
83supported only when rebooting, and it has no effect unless a dump
84device has previously been specified with
85.Xr dumpon 8 .
86.It Fl k Ar kernel
87Boot the specified
88.Ar kernel
89on the next system boot.
90If the kernel boots successfully, the
91.Em default
92kernel will be booted on successive boots, this is a one-shot option.
93If the boot fails, the system will continue attempting to boot
94.Ar kernel
95until the boot process is interrupted and a valid kernel booted.
96This may change in the future.
97.It Fl l
98The halt or reboot is
99.Em not
100logged to the system log.
101This option is intended for applications such as
102.Xr shutdown 8 ,
103that call
104.Nm
105or
106.Nm halt
107and log this themselves.
108.It Fl N
109The file system cache is not flushed during the initial process clean-up,
110however the kernel level
111.Xr reboot 2
112is still processed with a sync.
113This option can be useful for performing a
114.Dq best-effort
115reboot when devices might be unavailable.
116This can happen when devices have been disconnected, such as with
117.Xr iscsi 4 .
118.It Fl n
119The file system cache is not flushed.
120This option should probably not be used.
121.It Fl p
122The system will turn off the power if it can.
123If the power down action fails, the system
124will halt or reboot normally, depending on whether
125.Nm halt
126or
127.Nm
128was called.
129.It Fl q
130The system is halted or restarted quickly and ungracefully, and only
131the flushing of the file system cache is performed (if the
132.Fl n
133option is not specified).
134This option should probably not be used.
135.It Fl r
136The system kills all processes, unmounts all filesystems, mounts the new
137root filesystem, and begins the usual startup sequence.
138After changing vfs.root.mountfrom with
139.Xr kenv 1 ,
140.Nm Fl r
141can be used to change the root filesystem while preserving kernel state.
142This requires the
143.Xr tmpfs 5
144kernel module to be loaded because
145.Xr init 8
146needs a place to store itself after the old root is unmounted, but
147before the new root is in place.
148.El
149.Pp
150The
151.Nm fasthalt
152and
153.Nm fastboot
154utilities are nothing more than aliases for the
155.Nm halt
156and
157.Nm
158utilities.
159.Pp
160Normally, the
161.Xr shutdown 8
162utility is used when the system needs to be halted or restarted, giving
163users advance warning of their impending doom and cleanly terminating
164specific programs.
165.Sh EXAMPLES
166Replace current root filesystem with UFS mounted from
167.Pa /dev/ada0s1a :
168.Bd -literal -offset indent
169kenv vfs.root.mountfrom=ufs:/dev/ada0s1a
170reboot -r
171.Ed
172.Pp
173This mechanism can also be used with NFS, with a caveat that
174it only works with NFSv4, and requires a numeric IPv4 address:
175.Bd -literal -offset indent
176kenv vfs.root.mountfrom=nfs:192.168.1.1:/share/name
177reboot -r
178.Ed
179.Sh SEE ALSO
180.Xr kenv 1 ,
181.Xr getutxent 3 ,
182.Xr ipmi 4 ,
183.Xr boot 8 ,
184.Xr dumpon 8 ,
185.Xr nextboot 8 ,
186.Xr savecore 8 ,
187.Xr shutdown 8 ,
188.Xr sync 8
189.Sh HISTORY
190A
191.Nm
192utility appeared in
193.Bx 4.0 .
194