1.\" Copyright (c) 1980, 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.\" @(#)reboot.2 8.1 (Berkeley) 6/4/93 29.\" $FreeBSD$ 30.\" 31.Dd October 24, 2017 32.Dt REBOOT 2 33.Os 34.Sh NAME 35.Nm reboot 36.Nd reboot system or halt processor 37.Sh LIBRARY 38.Lb libc 39.Sh SYNOPSIS 40.In unistd.h 41.In sys/reboot.h 42.Ft int 43.Fn reboot "int howto" 44.Sh DESCRIPTION 45The 46.Fn reboot 47system call 48reboots the system. 49Only the super-user may reboot a machine on demand. 50However, a reboot is invoked 51automatically in the event of unrecoverable system failures. 52.Pp 53The 54.Fa howto 55argument 56is a mask of options; the system call interface allows the following 57options, defined in the include file 58.In sys/reboot.h , 59to be passed 60to the new kernel or the new bootstrap and init programs. 61.Bl -tag -width RB_INITNAMEA 62.It Dv RB_AUTOBOOT 63The default, causing the system to reboot in its usual fashion. 64.It Dv RB_ASKNAME 65Interpreted by the bootstrap program itself, causing it to 66prompt on the console as to what file should be booted. 67Normally, the system is booted from the file 68.Dq Ar xx Ns No (0,0)kernel , 69where 70.Ar xx 71is the default disk name, 72without prompting for the file name. 73.It Dv RB_DFLTROOT 74Use the compiled in root device. 75Normally, the system uses the device from which it was booted 76as the root device if possible. 77(The default behavior is dependent on the ability of the bootstrap program 78to determine the drive from which it was loaded, which is not possible 79on all systems.) 80.It Dv RB_DUMP 81Dump kernel memory before rebooting; see 82.Xr savecore 8 83for more information. 84.It Dv RB_HALT 85The processor is simply halted; no reboot takes place. 86This option should be used with caution. 87.It Dv RB_POWERCYCLE 88After halting, the shutdown code will do what it can to turn 89off the power and then turn the power back on. 90This requires hardware support, usually an auxiliary microprocessor 91that can sequence the power supply. 92At present only the 93.Xr ipmi 4 94driver implements this feature. 95.It Dv RB_POWEROFF 96After halting, the shutdown code will do what it can to turn 97off the power. 98This requires hardware support. 99.It Dv RB_INITNAME 100An option allowing the specification of an init program (see 101.Xr init 8 ) 102other than 103.Pa /sbin/init 104to be run when the system reboots. 105This switch is not currently available. 106.It Dv RB_KDB 107Load the symbol table and enable a built-in debugger in the system. 108This option will have no useful function if the kernel is not configured 109for debugging. 110Several other options have different meaning if combined 111with this option, although their use may not be possible 112via the 113.Fn reboot 114system call. 115See 116.Xr ddb 4 117for more information. 118.It Dv RB_NOSYNC 119Normally, the disks are sync'd (see 120.Xr sync 8 ) 121before the processor is halted or rebooted. 122This option may be useful if file system changes have been made manually 123or if the processor is on fire. 124.It Dv RB_REROOT 125Instead of rebooting, unmount all filesystems except the one containing 126currently-running executable, and mount root filesystem using the same 127mechanism which is used during normal boot, based on 128vfs.root.mountfrom 129.Xr kenv 1 130variable. 131.It Dv RB_RDONLY 132Initially mount the root file system read-only. 133This is currently the default, and this option has been deprecated. 134.It Dv RB_SINGLE 135Normally, the reboot procedure involves an automatic disk consistency 136check and then multi-user operations. 137.Dv RB_SINGLE 138prevents this, booting the system with a single-user shell 139on the console. 140.Dv RB_SINGLE 141is actually interpreted by the 142.Xr init 8 143program in the newly booted system. 144.El 145.Pp 146When no options are given (i.e., 147.Dv RB_AUTOBOOT 148is used), the system is 149rebooted from file 150.Dq kernel 151in the root file system of unit 0 152of a disk chosen in a processor specific way. 153An automatic consistency check of the disks is normally performed 154(see 155.Xr fsck 8 ) . 156.Sh RETURN VALUES 157If successful, this call never returns. 158Otherwise, a -1 is returned and an error is returned in the global 159variable 160.Va errno . 161.Sh ERRORS 162.Bl -tag -width Er 163.It Bq Er EPERM 164The caller is not the super-user. 165.El 166.Sh SEE ALSO 167.Xr crash 8 , 168.Xr halt 8 , 169.Xr init 8 , 170.Xr reboot 8 , 171.Xr savecore 8 172.Sh HISTORY 173The 174.Fn reboot 175system call appeared in 176.Bx 4.0 . 177