xref: /freebsd/sbin/reboot/nextboot.8 (revision 8ef24a0d4b28fe230e20637f56869cc4148cd2ca)
1.\" Copyright (c) 2002 Gordon Tetlow
2.\" 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.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD$
26.\"
27.Dd April 9, 2016
28.Dt NEXTBOOT 8
29.Os
30.Sh NAME
31.Nm nextboot
32.Nd "specify an alternate kernel and boot flags for the next reboot"
33.Sh SYNOPSIS
34.Nm
35.Op Fl af
36.Op Fl e Ar variable=value
37.Op Fl k Ar kernel
38.Op Fl o Ar options
39.Nm
40.Fl D
41.Sh DESCRIPTION
42The
43.Nm
44utility allows specifying some combination of an alternate kernel, boot flags
45and kernel environment for the
46next time the machine is booted.
47Once the
48.Xr loader 8
49loads in the new kernel
50information, it is deleted so in case the new kernel hangs the machine,
51once it is rebooted, the machine will automatically revert to its previous
52configuration.
53.Pp
54The options are as follows:
55.Bl -tag -width ".Fl o Ar options"
56.It Fl a
57This option causes
58.Nm
59to append to an existing configuration in
60.Pa /boot/nextboot.conf .
61By default any existing configuration is overwritten.
62.It Fl D
63Invoking
64.Nm
65with this
66option removes an existing
67.Nm
68configuration.
69.It Fl e Ar variable=value
70This option adds the provided variable and value to the kernel environment.
71The value is quoted when written to the
72.Nm
73configuration.
74.It Fl f
75This
76option disables the sanity checking which checks if the kernel really exists
77before writing the
78.Nm
79configuration.
80.It Fl k Ar kernel
81This option specifies a kernel directory relative to
82.Pa /boot
83to load the kernel and any modules from.
84.It Fl o Ar options
85This option
86allows the passing of kernel flags for the next boot.
87.El
88.Sh FILES
89.Bl -tag -width ".Pa /boot/nextboot.conf" -compact
90.It Pa /boot/nextboot.conf
91The configuration file that the
92.Nm
93configuration is written into.
94.El
95.Sh EXAMPLES
96To boot the
97.Pa GENERIC
98kernel with the
99.Nm
100command:
101.Pp
102.Dl "nextboot -k GENERIC"
103.Pp
104To enable into single user mode with the normal kernel:
105.Pp
106.Dl "nextboot -o ""-s"" -k kernel"
107.Pp
108To remove an existing nextboot configuration:
109.Pp
110.Dl "nextboot -D"
111.Sh SEE ALSO
112.Xr boot 8 ,
113.Xr loader 8
114.Sh HISTORY
115The original
116.Nm
117manual page first appeared in
118.Fx 2.2 .
119It used a very different interface to achieve similar results.
120.Pp
121The current incarnation of
122.Nm
123appeared in
124.Fx 5.0 .
125.Sh AUTHORS
126This manual page was written by
127.An Gordon Tetlow Aq Mt gordon@FreeBSD.org .
128.Sh BUGS
129The
130.Nm
131code is implemented in the
132.Xr loader 8 .
133It is not the most thoroughly tested code.
134It is also my first attempt to write in Forth.
135.Pp
136Finally, it does some evil things like writing to the file system before it
137has been checked.
138If it scrambles your file system, do not blame me.
139.Pp
140.Xr loader 8
141is only able to read ZFS, not write to it.
142.Pa nextboot.conf
143will NOT be reset in case of a kernel boot failure.
144