xref: /freebsd/usr.sbin/efibootmgr/efibootmgr.8 (revision b59017c5cad90d0f09a59e68c00457b7faf93e7c)
1.\"-
2.\" SPDX-License-Identifier: BSD-2-Clause
3.\"
4.\" Copyright (c) 2017-2018 Netflix, Inc.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.Dd September 22, 2024
28.Dt EFIBOOTMGR 8
29.Os
30.Sh NAME
31.Nm efibootmgr
32.Nd manipulate the EFI Boot Manager
33.Sh SYNOPSIS
34.Nm
35.Op Fl v
36.Nm
37.Fl a
38.Fl b Ar bootnum
39.Nm
40.Fl A
41.Fl b Ar bootnum
42.Nm
43.Fl B
44.Fl b Ar bootnum
45.Nm
46.Fl c
47.Fl l Ar loader
48.Op Fl aD
49.Op Fl b Ar bootnum
50.Op Fl k Ar kernel
51.Op Fl L Ar label
52.Op Fl e Ar env
53.Nm
54.Fl E
55.Op Fl d
56.Op Fl p
57.Nm
58.Fl F
59.Nm
60.Fl f
61.Nm
62.Fl n
63.Fl b Ar bootnum
64.Nm
65.Fl N
66.Nm
67.Fl o Ar bootorder
68.Nm
69.Fl t Ar timeout
70.Nm
71.Fl T
72.Nm
73.Fl u Ar unix-path
74.Sh "DESCRIPTION"
75The
76.Nm
77program manipulates how UEFI Boot Managers boot the system.
78It can create and destroy methods for booting along with activating or
79deactivating them.
80It can also change the defined order of boot methods.
81It can create a temporary boot (BootNext) variable that references a
82boot method to be tried once upon the next boot.
83.Pp
84The UEFI standard defines how hosts may control what is used to
85bootstrap the system.
86Each method is encapsulated within a persistent UEFI variable,
87stored by the UEFI BIOS of the form
88.Cm Boot Ns Em XXXX
89(where XXXX are uppercase hexadecimal digits).
90These variables are numbered, each describing where to load the bootstrap
91program from, and whether or not the method is active (used for booting,
92otherwise the method will be skipped).
93The order of these methods is controlled by another variable,
94.Cm BootOrder .
95The currently booted method is communicated using
96.Cm BootCurrent .
97A global timeout can also be set.
98.Pp
99.Nm
100requires that the kernel module
101.Xr efirt 9
102module be present or loaded to get and set these
103non-volatile variables.
104.Pp
105The following options are available:
106.Bl -tag -width Ds
107.It Fl a -activate
108Activate the given
109.Ar bootnum
110boot entry, or the new entry when used with
111.Fl c .
112.It Fl A -deactivate
113Deactivate the given
114.Ar bootnum
115boot entry.
116.It Fl b -bootnum Ar bootnum
117When creating or modifying an entry, use
118.Ar bootnum
119as the index.
120When creating a new entry, fail if it already exists.
121For convenience, if
122.Ar bootnum
123is prefixed with
124.Dq boot ,
125that prefix is ignored.
126.It Fl B -delete
127Delete the given
128.Ar bootnum
129boot entry.
130.It Fl c -create
131Create a new
132.Cm Boot
133variable (aka method or entry).
134.It Fl D -dry-run
135Process but do not change any variables.
136.It Fl e -env
137When creating a
138.Cm Boot
139variable, include a set of environment variables for the loader to set after
140parsing the command line.
141Variables are of the form
142.Dq a=b
143and separated by spaces.
144The argument should be quoted.
145.Nm appends these to the end of the
146.Cm Boot
147environment variable.
148Before processing anything else,
149.Xr loader.efi 8
150will parse this area and set all variables found there.
151.It Fl E -esp
152Print the
153.Fx
154path to the ESP device, derived from the EFI variables
155.Va BootCurrent
156and
157.Va BootXXXX .
158This is the ESP partition used by UEFI to boot the current
159instance of the system.
160If
161.Fl d -device-path
162is specified, the UEFI device path to the ESP is reported instead.
163If
164.Fl p -unix-path
165is specified, the mount point of the ESP is reported instead.
166.It Fl f -fw-ui , Fl F -no-fw-ui
167Set or clear the request to the system firmware to stop in its user
168interface on the next boot.
169.It Fl k -kernel Ar kernel
170The path to and name of the kernel.
171.It Fl l -loader Ar loader
172The path to and name of the loader.
173.It Fl L -label Ar label
174An optional description for the method.
175.It Fl n -bootnext
176Set
177.Ar bootnum
178boot entry as the
179.Cm BootNext
180variable.
181.It Fl N -delete-bootnext
182Delete the
183.Cm BootNext
184optional variable.
185.It Fl o -bootorder Ar bootorder
186Set
187.Cm BootOrder
188variable to the given comma delimited set of
189.Ar bootnum Ns s .
190The numbers are in hex to match
191.Cm Boot Ns Em XXXX ,
192but may omit leading zeros.
193.It Fl t -set-timeout Ar timeout
194Set the bootmenu timeout value.
195.It Fl T -del-timeout
196Delete the
197.Cm BootTimeout
198variable.
199.It Fl u -efidev Ar unix-path
200Displays the UEFI device path of
201.Ar unix-path .
202.It Fl v -verbose
203Display the device path of boot entries in the output.
204.El
205.Sh Examples
206To display the current
207.Cm Boot
208related variables in the system:
209.Pp
210.Dl efibootmgr -v
211.Pp
212This will display the optional
213.Cm BootNext
214(if present),
215.Cm BootCurrent
216(currently booted method), followed by the optional
217.Cm Timeout
218value, any
219.Cm BootOrder
220that may be set, followed finally by all currently defined
221.Cm Boot
222variables, active or not.
223The verbose flag,
224.Pq Fl v ,
225augments this output with the disk partition uuids,
226size/offset and device-path of the variable.
227The flag will also include any unreferenced (by BootOrder) variables.
228.Pp
229The
230.Nm
231program can be used to create new EFI boot variables.
232The following command may be used to create a new boot method, using
233the EFI partition mounted under
234.Pa /boot/efi ,
235mark the method active, using
236the given loader and label the method
237.Qq FreeBSD-15 :
238.Pp
239.Dl efibootmgr -a -c -l /boot/efi/EFI/freebsd/loader.efi -L FreeBSD-15
240.Pp
241This will result in the next available bootnum being assigned to a
242new UEFI boot variable, and given the label
243.Qq FreeBSD-15
244such as:
245.Pp
246.Dl Boot0009 FreeBSD-15
247.Pp
248Note newly created boot entries are, by default, created inactive, hence
249the reason
250.Fl a
251flag is specified above so that it will be considered for booting.
252The active state is denoted by a '*' following the
253.Cm Boot Ns Em XXXX
254name in the output.
255They are also inserted into the first position of current
256.Cm BootOrder
257variable if it exists.
258They must first be set to active before being considered available to attempt
259booting from, else they are ignored.
260.Pp
261.Dl efibootmgr -B -b 0009
262.Pp
263Will delete the given boot entry Boot0009.
264.Pp
265To set the given boot entry active:
266.Pp
267.Dl efibootmgr -a -b 0009
268.Pp
269To set a given boot entry to be used as the
270.Cm BootNext
271variable, irrespective of its active state, use:
272.Pp
273.Dl efibootmgr -n -b 0009
274.Pp
275To set the
276.Cm BootOrder
277for the next reboot use:
278.Pp
279.Dl efibootmgr -o 0009,0003,...
280.Sh SEE ALSO
281.Xr efivar 8 ,
282.Xr gpart 8 ,
283.Xr loader.efi 8 ,
284.Xr uefi 8 ,
285.Xr efirt 9
286.Sh STANDARDS
287The Unified Extensible Firmware Interface Specification is available
288from
289.Pa www.uefi.org .
290