xref: /freebsd/usr.sbin/efibootmgr/efibootmgr.8 (revision 2008043f386721d58158e37e0d7e50df8095942d)
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 October 26, 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 -esp
134Print the
135.Fx
136path to the ESP device, derived from the EFI variables
137.Va BootCurrent
138and
139.Va BootXXXX .
140This is the ESP partition used by UEFI to boot the current
141instance of the system.
142If
143.Fl d -device-path
144is specified, the UEFI device path to the ESP is reported instead.
145If
146.Fl p -unix-path
147is specified, the mount point of the ESP is reported instead.
148.It Fl f -fw-ui , Fl F -no-fw-ui
149Set or clear the request to the system firmware to stop in its user
150interface on the next boot.
151.It Fl k -kernel Ar kernel
152The path to and name of the kernel.
153.It Fl l -loader Ar loader
154The path to and name of the loader.
155.It Fl L -label Ar label
156An optional description for the method.
157.It Fl n -bootnext
158Set
159.Ar bootnum
160boot entry as the
161.Cm BootNext
162variable.
163.It Fl N -delete-bootnext
164Delete the
165.Cm BootNext
166optional variable.
167.It Fl o -bootorder Ar bootorder
168Set
169.Cm BootOrder
170variable to the given comma delimited set of
171.Ar bootnum Ns s .
172The numbers are in hex to match
173.Cm Boot Ns Em XXXX ,
174but may omit leading zeros.
175.It Fl t -set-timeout Ar timeout
176Set the bootmenu timeout value.
177.It Fl T -del-timeout
178Delete the
179.Cm BootTimeout
180variable.
181.It Fl u -efidev Ar unix-path
182Displays the UEFI device path of
183.Ar unix-path .
184.It Fl v -verbose
185Display the device path of boot entries in the output.
186.El
187.Sh Examples
188To display the current
189.Cm Boot
190related variables in the system:
191.Pp
192.Dl efibootmgr -v
193.Pp
194This will display the optional
195.Cm BootNext
196(if present),
197.Cm BootCurrent
198(currently booted method), followed by the optional
199.Cm Timeout
200value, any
201.Cm BootOrder
202that may be set, followed finally by all currently defined
203.Cm Boot
204variables, active or not.
205The verbose flag,
206.Pq Fl v ,
207augments this output with the disk partition uuids,
208size/offset and device-path of the variable.
209The flag will also include any unreferenced (by BootOrder) variables.
210.Pp
211The
212.Nm
213program can be used to create new EFI boot variables.
214The following command may be used to create a new boot method, using
215the EFI partition mounted under
216.Pa /boot/efi ,
217mark the method active, using
218the given loader and label the method
219.Qq FreeBSD-11 :
220.Pp
221.Dl efibootmgr -a -c -l /boot/efi/EFI/freebsd/loader.efi -L FreeBSD-11
222.Pp
223This will result in the next available bootnum being assigned to a
224new UEFI boot variable, and given the label
225.Qq FreeBSD-11
226such as:
227.Pp
228.Dl Boot0009 FreeBSD-11
229.Pp
230Note newly created boot entries are, by default, created inactive, hence
231the reason
232.Fl a
233flag is specified above so that it will be considered for booting.
234The active state is denoted by a '*' following the
235.Cm Boot Ns Em XXXX
236name in the output.
237They are also inserted into the first position of current
238.Cm BootOrder
239variable if it exists.
240They must first be set to active before being considered available to attempt
241booting from, else they are ignored.
242.Pp
243.Dl efibootmgr -B -b 0009
244.Pp
245Will delete the given boot entry Boot0009.
246.Pp
247To set the given boot entry active:
248.Pp
249.Dl efibootmgr -a -b 0009
250.Pp
251To set a given boot entry to be used as the
252.Cm BootNext
253variable, irrespective of its active state, use:
254.Pp
255.Dl efibootmgr -n -b 0009
256.Pp
257To set the
258.Cm BootOrder
259for the next reboot use:
260.Pp
261.Dl efibootmgr -o 0009,0003,...
262.Sh SEE ALSO
263.Xr efirt 9 ,
264.Xr efivar 8 ,
265.Xr gpart 8 ,
266.Xr uefi 8
267.Sh STANDARDS
268The Unified Extensible Firmware Interface Specification is available
269from
270.Pa www.uefi.org .
271