xref: /freebsd/sbin/reboot/reboot.8 (revision 1a720cbec513210fa2e85c3882741ef2f6dc5f35)
18fae3551SRodney W. Grimes.\" Copyright (c) 1990, 1991, 1993
28fae3551SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
38fae3551SRodney W. Grimes.\"
48fae3551SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
58fae3551SRodney W. Grimes.\" modification, are permitted provided that the following conditions
68fae3551SRodney W. Grimes.\" are met:
78fae3551SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
88fae3551SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
98fae3551SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
108fae3551SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
118fae3551SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
12fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors
138fae3551SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
148fae3551SRodney W. Grimes.\"    without specific prior written permission.
158fae3551SRodney W. Grimes.\"
168fae3551SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
178fae3551SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
188fae3551SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
198fae3551SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
208fae3551SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
218fae3551SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
228fae3551SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
238fae3551SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
248fae3551SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
258fae3551SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
268fae3551SRodney W. Grimes.\" SUCH DAMAGE.
278fae3551SRodney W. Grimes.\"
287cb1a0e6SWarner Losh.Dd February 8, 2024
298fae3551SRodney W. Grimes.Dt REBOOT 8
308fae3551SRodney W. Grimes.Os
318fae3551SRodney W. Grimes.Sh NAME
328fae3551SRodney W. Grimes.Nm reboot ,
3308ad04ceSAlexey Zelkin.Nm halt ,
3408ad04ceSAlexey Zelkin.Nm fastboot ,
3508ad04ceSAlexey Zelkin.Nm fasthalt
3608ad04ceSAlexey Zelkin.Nd stopping and restarting the system
378fae3551SRodney W. Grimes.Sh SYNOPSIS
388fae3551SRodney W. Grimes.Nm halt
392c479548SWarner Losh.Op Fl DflNnpq
40ecc83424SWarner Losh.Op Fl e Ar variable=value
411de372dcSWes Peters.Op Fl k Ar kernel
4291d24077SWarner Losh.Op Fl o Ar options
437c7fb079SRuslan Ermilov.Nm
442c479548SWarner Losh.Op Fl cDdflNnpqr
45ecc83424SWarner Losh.Op Fl e Ar variable=value
461de372dcSWes Peters.Op Fl k Ar kernel
4791d24077SWarner Losh.Op Fl o Ar options
487f4b19d6SDavid Greenman.Nm fasthalt
492c479548SWarner Losh.Op Fl DflNnpq
50ecc83424SWarner Losh.Op Fl e Ar variable=value
511de372dcSWes Peters.Op Fl k Ar kernel
5291d24077SWarner Losh.Op Fl o Ar options
537f4b19d6SDavid Greenman.Nm fastboot
542c479548SWarner Losh.Op Fl dDflNnpq
55ecc83424SWarner Losh.Op Fl e Ar variable=value
561de372dcSWes Peters.Op Fl k Ar kernel
5791d24077SWarner Losh.Op Fl o Ar options
588fae3551SRodney W. Grimes.Sh DESCRIPTION
598fae3551SRodney W. GrimesThe
608fae3551SRodney W. Grimes.Nm halt
618fae3551SRodney W. Grimesand
629448def9SPhilippe Charnier.Nm
638fae3551SRodney W. Grimesutilities flush the file system cache to disk, send all running processes
64d44b4fd2SRuslan Ermilova
65d44b4fd2SRuslan Ermilov.Dv SIGTERM
66d44b4fd2SRuslan Ermilov(and subsequently a
67d44b4fd2SRuslan Ermilov.Dv SIGKILL )
68d44b4fd2SRuslan Ermilovand, respectively, halt or restart the system.
690806dd92SEd SchoutenThe action is logged, including entering a shutdown record into the user
700806dd92SEd Schoutenaccounting database.
718fae3551SRodney W. Grimes.Pp
728fae3551SRodney W. GrimesThe options are as follows:
739448def9SPhilippe Charnier.Bl -tag -width indent
747d7d9013SWarner Losh.It Fl c
757d7d9013SWarner LoshThe system will turn off the power and then turn it back on if it can.
767d7d9013SWarner LoshIf the power down action fails, the system
777d7d9013SWarner Loshwill halt or reboot normally, depending on whether
787d7d9013SWarner Losh.Nm halt
797d7d9013SWarner Loshor
807d7d9013SWarner Losh.Nm
817d7d9013SWarner Loshwas called.
827d7d9013SWarner LoshAt the present time, only the
837d7d9013SWarner Losh.Xr ipmi 4
847d7d9013SWarner Loshdriver implements the power cycle functionality and only on hardware
857d7d9013SWarner Loshwith a BMC that supports power cycling.
867d7d9013SWarner LoshUnlike power off, the amount of hardware that supports power cycling
877d7d9013SWarner Loshis small.
882c479548SWarner Losh.It Fl D
892c479548SWarner LoshDelete existing
902c479548SWarner Losh.Nm nextboot
912c479548SWarner Loshconfiguration and exit.
9285c981ccSJohn Polstra.It Fl d
9310cb9bd3SRuslan ErmilovThe system is requested to create a crash dump.
9410cb9bd3SRuslan ErmilovThis option is
9585c981ccSJohn Polstrasupported only when rebooting, and it has no effect unless a dump
9685c981ccSJohn Polstradevice has previously been specified with
9785c981ccSJohn Polstra.Xr dumpon 8 .
98ecc83424SWarner Losh.It Fl e Ar variable=value
99ecc83424SWarner LoshSets
100ecc83424SWarner Losh.Va variable
101ecc83424SWarner Loshto
102ecc83424SWarner Losh.Va value
103ecc83424SWarner Loshin the loader's and kernel's environment.
104ecc83424SWarner LoshIf
105ecc83424SWarner Losh.Va value
106ecc83424SWarner Loshis not already enclosed in double quotes, they will be added before writing to the
107ecc83424SWarner Losh.Nm nextboot
108ecc83424SWarner Loshconfiguration.
109ecc83424SWarner LoshCare should be taken if
110ecc83424SWarner Losh.Va value
111ecc83424SWarner Loshcontains any characters that are special to the shell or loader's configuration
112ecc83424SWarner Loshparsing code.
1137cb1a0e6SWarner Losh.It Fl k Ar kname
1147cb1a0e6SWarner LoshBoot the specified kernel
1157cb1a0e6SWarner Losh.Ar kname
11610cb9bd3SRuslan Ermilovon the next system boot.
1177cb1a0e6SWarner LoshThis is a one-shot option, the
1181de372dcSWes Peters.Em default
1197cb1a0e6SWarner Loshkernel will be booted on successive boots.
1207cb1a0e6SWarner LoshNo
1217cb1a0e6SWarner Losh.Nm reboot
1227cb1a0e6SWarner Loshor
1237cb1a0e6SWarner Losh.Nm halt
1247cb1a0e6SWarner Loshwill be performed if
1257cb1a0e6SWarner Losh.Em /boot/kname/kernel
1267cb1a0e6SWarner Loshdoes not exist unless the
1277cb1a0e6SWarner Losh.Fl f
1287cb1a0e6SWarner Loshflag is specified.
1290ee76202SNik Clayton.It Fl l
1300ee76202SNik ClaytonThe halt or reboot is
1310ee76202SNik Clayton.Em not
1320ee76202SNik Claytonlogged to the system log.
1330ee76202SNik ClaytonThis option is intended for applications such as
1340ee76202SNik Clayton.Xr shutdown 8 ,
1350ee76202SNik Claytonthat call
1360ee76202SNik Clayton.Nm
1370ee76202SNik Claytonor
1380ee76202SNik Clayton.Nm halt
1390ee76202SNik Claytonand log this themselves.
1406237ce08SSteven Hartland.It Fl N
1416237ce08SSteven HartlandThe file system cache is not flushed during the initial process clean-up,
1426237ce08SSteven Hartlandhowever the kernel level
1436237ce08SSteven Hartland.Xr reboot 2
1446237ce08SSteven Hartlandis still processed with a sync.
1456237ce08SSteven HartlandThis option can be useful for performing a
1466237ce08SSteven Hartland.Dq best-effort
1476237ce08SSteven Hartlandreboot when devices might be unavailable.
1486237ce08SSteven HartlandThis can happen when devices have been disconnected, such as with
1496237ce08SSteven Hartland.Xr iscsi 4 .
1508fae3551SRodney W. Grimes.It Fl n
1519448def9SPhilippe CharnierThe file system cache is not flushed.
1528fae3551SRodney W. GrimesThis option should probably not be used.
15391d24077SWarner Losh.It Fl o Ar options
15491d24077SWarner LoshThis option
15591d24077SWarner Loshallows the passing of kernel flags for the next boot.
15647be7466SJulian Elischer.It Fl p
1572aeb6b27SThomas QuinotThe system will turn off the power if it can.
1582aeb6b27SThomas QuinotIf the power down action fails, the system
1592aeb6b27SThomas Quinotwill halt or reboot normally, depending on whether
1602aeb6b27SThomas Quinot.Nm halt
1612aeb6b27SThomas Quinotor
1628573f805SRuslan Ermilov.Nm
1632aeb6b27SThomas Quinotwas called.
1648d646af5SRuslan Ermilov.It Fl q
1658d646af5SRuslan ErmilovThe system is halted or restarted quickly and ungracefully, and only
1668d646af5SRuslan Ermilovthe flushing of the file system cache is performed (if the
1678d646af5SRuslan Ermilov.Fl n
1688d646af5SRuslan Ermilovoption is not specified).
1698d646af5SRuslan ErmilovThis option should probably not be used.
1703f5ac575SEdward Tomasz Napierala.It Fl r
1713f5ac575SEdward Tomasz NapieralaThe system kills all processes, unmounts all filesystems, mounts the new
1723f5ac575SEdward Tomasz Napieralaroot filesystem, and begins the usual startup sequence.
1733f5ac575SEdward Tomasz NapieralaAfter changing vfs.root.mountfrom with
1740ca11f9dSEdward Tomasz Napierala.Xr kenv 1 ,
1753f5ac575SEdward Tomasz Napierala.Nm Fl r
1763f5ac575SEdward Tomasz Napieralacan be used to change the root filesystem while preserving kernel state.
17771688f3bSBrad DavisThis requires the
178*1a720cbeSAlexander Ziaee.Xr tmpfs 4
1798c0fa2ccSWarner Loshkernel module to be loaded because
1808c0fa2ccSWarner Losh.Xr init 8
1818c0fa2ccSWarner Loshneeds a place to store itself after the old root is unmounted, but
1828c0fa2ccSWarner Loshbefore the new root is in place.
1838fae3551SRodney W. Grimes.El
1848fae3551SRodney W. Grimes.Pp
1857f4b19d6SDavid GreenmanThe
1867f4b19d6SDavid Greenman.Nm fasthalt
1877f4b19d6SDavid Greenmanand
1887f4b19d6SDavid Greenman.Nm fastboot
1897f4b19d6SDavid Greenmanutilities are nothing more than aliases for the
1907f4b19d6SDavid Greenman.Nm halt
1917f4b19d6SDavid Greenmanand
1929448def9SPhilippe Charnier.Nm
1937f4b19d6SDavid Greenmanutilities.
1947f4b19d6SDavid Greenman.Pp
1958fae3551SRodney W. GrimesNormally, the
1968fae3551SRodney W. Grimes.Xr shutdown 8
1978fae3551SRodney W. Grimesutility is used when the system needs to be halted or restarted, giving
198d44b4fd2SRuslan Ermilovusers advance warning of their impending doom and cleanly terminating
199d44b4fd2SRuslan Ermilovspecific programs.
2003f5ac575SEdward Tomasz Napierala.Sh EXAMPLES
2013f5ac575SEdward Tomasz NapieralaReplace current root filesystem with UFS mounted from
2023f5ac575SEdward Tomasz Napierala.Pa /dev/ada0s1a :
2033f5ac575SEdward Tomasz Napierala.Bd -literal -offset indent
2043f5ac575SEdward Tomasz Napieralakenv vfs.root.mountfrom=ufs:/dev/ada0s1a
2053f5ac575SEdward Tomasz Napieralareboot -r
2063f5ac575SEdward Tomasz Napierala.Ed
2072132a4efSEdward Tomasz Napierala.Pp
2082132a4efSEdward Tomasz NapieralaThis mechanism can also be used with NFS, with a caveat that
2092132a4efSEdward Tomasz Napieralait only works with NFSv4, and requires a numeric IPv4 address:
2102132a4efSEdward Tomasz Napierala.Bd -literal -offset indent
2112132a4efSEdward Tomasz Napieralakenv vfs.root.mountfrom=nfs:192.168.1.1:/share/name
2122132a4efSEdward Tomasz Napieralareboot -r
2132132a4efSEdward Tomasz Napierala.Ed
2148fae3551SRodney W. Grimes.Sh SEE ALSO
2150ca11f9dSEdward Tomasz Napierala.Xr kenv 1 ,
2165a25553cSEd Schouten.Xr getutxent 3 ,
2177d7d9013SWarner Losh.Xr ipmi 4 ,
2188fae3551SRodney W. Grimes.Xr boot 8 ,
21985c981ccSJohn Polstra.Xr dumpon 8 ,
220f7eaf827SJoseph Koshy.Xr nextboot 8 ,
22185c981ccSJohn Polstra.Xr savecore 8 ,
22278b0b234SMike Pritchard.Xr shutdown 8 ,
22378b0b234SMike Pritchard.Xr sync 8
2248fae3551SRodney W. Grimes.Sh HISTORY
2258fae3551SRodney W. GrimesA
2269448def9SPhilippe Charnier.Nm
227629e80efSPhilippe Charnierutility appeared in
2289dd4cc10SAllan Jude.Bx 4.0 .
229