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