xref: /freebsd/usr.sbin/efibootmgr/efibootmgr.8 (revision 6aa1b433)
152467047SWarner Losh.\"
252467047SWarner Losh.\" Copyright (c) 2017-2018 Netflix, Inc.
31285bcc8SWarner Losh.\"
41285bcc8SWarner Losh.\" Redistribution and use in source and binary forms, with or without
51285bcc8SWarner Losh.\" modification, are permitted provided that the following conditions
61285bcc8SWarner Losh.\" are met:
71285bcc8SWarner Losh.\" 1. Redistributions of source code must retain the above copyright
81285bcc8SWarner Losh.\"    notice, this list of conditions and the following disclaimer.
91285bcc8SWarner Losh.\" 2. Redistributions in binary form must reproduce the above copyright
101285bcc8SWarner Losh.\"    notice, this list of conditions and the following disclaimer in the
111285bcc8SWarner Losh.\"    documentation and/or other materials provided with the distribution.
121285bcc8SWarner Losh.\"
131285bcc8SWarner Losh.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
141285bcc8SWarner Losh.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
151285bcc8SWarner Losh.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
161285bcc8SWarner Losh.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
171285bcc8SWarner Losh.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
181285bcc8SWarner Losh.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
191285bcc8SWarner Losh.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
201285bcc8SWarner Losh.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
211285bcc8SWarner Losh.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
221285bcc8SWarner Losh.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
231285bcc8SWarner Losh.\" SUCH DAMAGE.
241285bcc8SWarner Losh.\"
256aa1b433SWarner Losh.Dd December 17, 2023
261285bcc8SWarner Losh.Dt EFIBOOTMGR 8
271285bcc8SWarner Losh.Os
281285bcc8SWarner Losh.Sh NAME
291285bcc8SWarner Losh.Nm efibootmgr
301285bcc8SWarner Losh.Nd manipulate the EFI Boot Manager
311285bcc8SWarner Losh.Sh SYNOPSIS
32736dcdb7SYuri Pankov.Nm
33557a5ad4SRebecca Cran.Op Fl v
34736dcdb7SYuri Pankov.Nm
35736dcdb7SYuri Pankov.Fl a
36736dcdb7SYuri Pankov.Fl b Ar bootnum
37736dcdb7SYuri Pankov.Nm
38736dcdb7SYuri Pankov.Fl A
39736dcdb7SYuri Pankov.Fl b Ar bootnum
40736dcdb7SYuri Pankov.Nm
41736dcdb7SYuri Pankov.Fl B
42736dcdb7SYuri Pankov.Fl b Ar bootnum
43736dcdb7SYuri Pankov.Nm
44736dcdb7SYuri Pankov.Fl c
45736dcdb7SYuri Pankov.Fl l Ar loader
46736dcdb7SYuri Pankov.Op Fl aD
47736dcdb7SYuri Pankov.Op Fl b Ar bootnum
48736dcdb7SYuri Pankov.Op Fl k Ar kernel
49736dcdb7SYuri Pankov.Op Fl L Ar label
501cdb8eb8SWarner Losh.Op Fl e Ar env
511cdb8eb8SWarner Losh.Nm
521cdb8eb8SWarner Losh.Fl E
531cdb8eb8SWarner Losh.Op Fl d
541cdb8eb8SWarner Losh.Op Fl p
55736dcdb7SYuri Pankov.Nm
5683c42372SD Scott Phillips.Fl F
5783c42372SD Scott Phillips.Nm
5883c42372SD Scott Phillips.Fl f
5983c42372SD Scott Phillips.Nm
60736dcdb7SYuri Pankov.Fl n
61736dcdb7SYuri Pankov.Fl b Ar bootnum
62736dcdb7SYuri Pankov.Nm
63736dcdb7SYuri Pankov.Fl N
64736dcdb7SYuri Pankov.Nm
65736dcdb7SYuri Pankov.Fl o Ar bootorder
66736dcdb7SYuri Pankov.Nm
67736dcdb7SYuri Pankov.Fl t Ar timeout
68736dcdb7SYuri Pankov.Nm
69736dcdb7SYuri Pankov.Fl T
709a791529SWarner Losh.Nm Fl u Ar unix-path
711285bcc8SWarner Losh.Sh "DESCRIPTION"
7298b765e5SJohn-Mark GurneyThe
731285bcc8SWarner Losh.Nm
7498b765e5SJohn-Mark Gurneyprogram manipulates how UEFI Boot Managers boot the system.
7598b765e5SJohn-Mark GurneyIt can create and destroy methods for booting along with activating or
7698b765e5SJohn-Mark Gurneydeactivating them.
7798b765e5SJohn-Mark GurneyIt can also change the defined order of boot methods.
7898b765e5SJohn-Mark GurneyIt can create a temporary boot (BootNext) variable that references a
7998b765e5SJohn-Mark Gurneyboot method to be tried once upon the next boot.
801285bcc8SWarner Losh.Pp
811285bcc8SWarner LoshThe UEFI standard defines how hosts may control what is used to
821285bcc8SWarner Loshbootstrap the system.
831285bcc8SWarner LoshEach method is encapsulated within a persistent UEFI variable, stored
841285bcc8SWarner Loshby the UEFI BIOS of the form
8598b765e5SJohn-Mark Gurney.Cm Boot Ns Em XXXX
8698b765e5SJohn-Mark Gurney(where XXXX are uppercase hexadecimal digits).
8798b765e5SJohn-Mark GurneyThese variables are numbered, each describing where to load the bootstrap
8898b765e5SJohn-Mark Gurneyprogram from, and whether or not the method is active (used for booting,
8998b765e5SJohn-Mark Gurneyotherwise the method will be skipped).
9098b765e5SJohn-Mark GurneyThe order of these methods is controlled by another variable,
91736dcdb7SYuri Pankov.Cm BootOrder .
9298b765e5SJohn-Mark GurneyThe currently booted method is communicated using
93736dcdb7SYuri Pankov.Cm BootCurrent .
941285bcc8SWarner LoshA global timeout can also be set.
951285bcc8SWarner Losh.Pp
961285bcc8SWarner Losh.Nm
9798b765e5SJohn-Mark Gurneyrequires that the kernel module
9898b765e5SJohn-Mark Gurney.Xr efirt 9
9998b765e5SJohn-Mark Gurneymodule be present or loaded to get and set these
1001285bcc8SWarner Loshnon-volatile variables.
1011285bcc8SWarner Losh.Pp
1021285bcc8SWarner LoshThe following options are available:
103736dcdb7SYuri Pankov.Bl -tag -width Ds
104736dcdb7SYuri Pankov.It Fl a -activate
105736dcdb7SYuri PankovActivate the given
106736dcdb7SYuri Pankov.Ar bootnum
107736dcdb7SYuri Pankovboot entry, or the new entry when used with
108736dcdb7SYuri Pankov.Fl c .
109736dcdb7SYuri Pankov.It Fl A -deactivate
110736dcdb7SYuri PankovDeactivate the given
111736dcdb7SYuri Pankov.Ar bootnum
112736dcdb7SYuri Pankovboot entry.
113557a5ad4SRebecca Cran.It Fl b -bootnum Ar bootnum
114736dcdb7SYuri PankovWhen creating or modifying an entry, use
115736dcdb7SYuri Pankov.Ar bootnum
116736dcdb7SYuri Pankovas the index.
11770de14d8SRebecca CranWhen creating a new entry, fail if it already exists.
11898d2608aSWarner LoshFor convenience, if
11998d2608aSWarner Losh.Ar bootnum
12098d2608aSWarner Loshis prefixed with
12198d2608aSWarner Losh.Dq boot ,
12298d2608aSWarner Loshthat prefix is ignored.
123736dcdb7SYuri Pankov.It Fl B -delete
124736dcdb7SYuri PankovDelete the given
125736dcdb7SYuri Pankov.Ar bootnum
126736dcdb7SYuri Pankovboot entry.
127736dcdb7SYuri Pankov.It Fl c -create
128736dcdb7SYuri PankovCreate a new
129736dcdb7SYuri Pankov.Cm Boot
13098b765e5SJohn-Mark Gurneyvariable (aka method or entry).
1311285bcc8SWarner Losh.It Fl D -dry-run
132557a5ad4SRebecca CranProcess but do not change any variables.
1336aa1b433SWarner Losh.It Fl e -env
1346aa1b433SWarner LoshWhen creating a
1356aa1b433SWarner Losh.Cm Boot
1366aa1b433SWarner Loshvariable, include a set of environment variables for the loader to set after
1376aa1b433SWarner Loshparsing the command line.
1386aa1b433SWarner LoshVariables are of the form
1396aa1b433SWarner Losh.Dq a=b
1406aa1b433SWarner Loshand separated by spaces.
1416aa1b433SWarner LoshThe argument should be quoted.
1426aa1b433SWarner Losh.Nm appends these to the end of the
1436aa1b433SWarner Losh.Cm Boot
1446aa1b433SWarner Loshenvironment variable.
1456aa1b433SWarner LoshBefore processing anything else,
1466aa1b433SWarner Losh.Xr loader.efi 8
1476aa1b433SWarner Loshwill parse this area and set all variables found there.
1481cdb8eb8SWarner Losh.It Fl E -esp
1491cdb8eb8SWarner LoshPrint the
1501cdb8eb8SWarner Losh.Fx
1511cdb8eb8SWarner Loshpath to the ESP device, derived from the EFI variables
1521cdb8eb8SWarner Losh.Va BootCurrent
1531cdb8eb8SWarner Loshand
1541cdb8eb8SWarner Losh.Va BootXXXX .
1551cdb8eb8SWarner LoshThis is the ESP partition used by UEFI to boot the current
1561cdb8eb8SWarner Loshinstance of the system.
1571cdb8eb8SWarner LoshIf
1581cdb8eb8SWarner Losh.Fl d -device-path
1591cdb8eb8SWarner Loshis specified, the UEFI device path to the ESP is reported instead.
1601cdb8eb8SWarner LoshIf
1611cdb8eb8SWarner Losh.Fl p -unix-path
1621cdb8eb8SWarner Loshis specified, the mount point of the ESP is reported instead.
16383c42372SD Scott Phillips.It Fl f -fw-ui , Fl F -no-fw-ui
16483c42372SD Scott PhillipsSet or clear the request to the system firmware to stop in its user
16583c42372SD Scott Phillipsinterface on the next boot.
166736dcdb7SYuri Pankov.It Fl k -kernel Ar kernel
167736dcdb7SYuri PankovThe path to and name of the kernel.
168736dcdb7SYuri Pankov.It Fl l -loader Ar loader
169736dcdb7SYuri PankovThe path to and name of the loader.
170736dcdb7SYuri Pankov.It Fl L -label Ar label
17198b765e5SJohn-Mark GurneyAn optional description for the method.
17270de14d8SRebecca Cran.It Fl n -bootnext
173736dcdb7SYuri PankovSet
174736dcdb7SYuri Pankov.Ar bootnum
175736dcdb7SYuri Pankovboot entry as the
176736dcdb7SYuri Pankov.Cm BootNext
177736dcdb7SYuri Pankovvariable.
1781285bcc8SWarner Losh.It Fl N -delete-bootnext
179736dcdb7SYuri PankovDelete the
180736dcdb7SYuri Pankov.Cm BootNext
181736dcdb7SYuri Pankovoptional variable.
1821285bcc8SWarner Losh.It Fl o -bootorder Ar bootorder
183736dcdb7SYuri PankovSet
184736dcdb7SYuri Pankov.Cm BootOrder
185736dcdb7SYuri Pankovvariable to the given comma delimited set of
186736dcdb7SYuri Pankov.Ar bootnum Ns s .
187736dcdb7SYuri PankovThe numbers are in hex to match
188736dcdb7SYuri Pankov.Cm Boot Ns Em XXXX ,
189736dcdb7SYuri Pankovbut may omit leading zeros.
1901285bcc8SWarner Losh.It Fl t -set-timeout Ar timeout
1911285bcc8SWarner LoshSet the bootmenu timeout value.
1921285bcc8SWarner Losh.It Fl T -del-timeout
193736dcdb7SYuri PankovDelete the
194736dcdb7SYuri Pankov.Cm BootTimeout
195736dcdb7SYuri Pankovvariable.
1969a791529SWarner Losh.It Fl u -efidev Ar unix-path
1979a791529SWarner LoshDisplays the UEFI device path of
1989a791529SWarner Losh.Ar unix-path .
1991285bcc8SWarner Losh.It Fl v -verbose
200557a5ad4SRebecca CranDisplay the device path of boot entries in the output.
2011285bcc8SWarner Losh.El
202557a5ad4SRebecca Cran.Sh Examples
203736dcdb7SYuri PankovTo display the current
204736dcdb7SYuri Pankov.Cm Boot
205736dcdb7SYuri Pankovrelated variables in the system:
2061285bcc8SWarner Losh.Pp
20798b765e5SJohn-Mark Gurney.Dl efibootmgr -v
2081285bcc8SWarner Losh.Pp
209736dcdb7SYuri PankovThis will display the optional
210736dcdb7SYuri Pankov.Cm BootNext
21198b765e5SJohn-Mark Gurney(if present),
21298b765e5SJohn-Mark Gurney.Cm BootCurrent
21398b765e5SJohn-Mark Gurney(currently booted method), followed by the optional
214736dcdb7SYuri Pankov.Cm Timeout
215736dcdb7SYuri Pankovvalue, any
216736dcdb7SYuri Pankov.Cm BootOrder
217736dcdb7SYuri Pankovthat may be set, followed finally by all currently defined
218736dcdb7SYuri Pankov.Cm Boot
219736dcdb7SYuri Pankovvariables, active or not.
22098b765e5SJohn-Mark GurneyThe verbose flag,
22198b765e5SJohn-Mark Gurney.Pq Fl v ,
22298b765e5SJohn-Mark Gurneyaugments this output with the disk partition uuids,
223736dcdb7SYuri Pankovsize/offset and device-path of the variable.
22498b765e5SJohn-Mark GurneyThe flag will also include any unreferenced (by BootOrder) variables.
2251285bcc8SWarner Losh.Pp
2261285bcc8SWarner LoshThe
2271285bcc8SWarner Losh.Nm
228736dcdb7SYuri Pankovprogram can be used to create new EFI boot variables.
22998b765e5SJohn-Mark GurneyThe following command may be used to create a new boot method, using
23098b765e5SJohn-Mark Gurneythe EFI partition mounted under
2315fce57ddSMateusz Piotrowski.Pa /boot/efi ,
23298b765e5SJohn-Mark Gurneymark the method active, using
23398b765e5SJohn-Mark Gurneythe given loader and label the method
2346aa1b433SWarner Losh.Qq FreeBSD-15 :
2351285bcc8SWarner Losh.Pp
2366aa1b433SWarner Losh.Dl efibootmgr -a -c -l /boot/efi/EFI/freebsd/loader.efi -L FreeBSD-15
2371285bcc8SWarner Losh.Pp
238557a5ad4SRebecca CranThis will result in the next available bootnum being assigned to a
239736dcdb7SYuri Pankovnew UEFI boot variable, and given the label
2406aa1b433SWarner Losh.Qq FreeBSD-15
241736dcdb7SYuri Pankovsuch as:
2421285bcc8SWarner Losh.Pp
2436aa1b433SWarner Losh.Dl Boot0009 FreeBSD-15
2441285bcc8SWarner Losh.Pp
24598b765e5SJohn-Mark GurneyNote newly created boot entries are, by default, created inactive, hence
24698b765e5SJohn-Mark Gurneythe reason
24798b765e5SJohn-Mark Gurney.Fl a
24898b765e5SJohn-Mark Gurneyflag is specified above so that it will be considered for booting.
24998b765e5SJohn-Mark GurneyThe active state is denoted by a '*' following the
250736dcdb7SYuri Pankov.Cm Boot Ns Em XXXX
251736dcdb7SYuri Pankovname in the output.
252736dcdb7SYuri PankovThey are also inserted into the first position of current
253736dcdb7SYuri Pankov.Cm BootOrder
254736dcdb7SYuri Pankovvariable if it exists.
255736dcdb7SYuri PankovThey must first be set to active before being considered available to attempt
256736dcdb7SYuri Pankovbooting from, else they are ignored.
2571285bcc8SWarner Losh.Pp
25870de14d8SRebecca Cran.Dl efibootmgr -B -b 0009
2591285bcc8SWarner Losh.Pp
260736dcdb7SYuri PankovWill delete the given boot entry Boot0009.
2611285bcc8SWarner Losh.Pp
26298b765e5SJohn-Mark GurneyTo set the given boot entry active:
2631285bcc8SWarner Losh.Pp
26470de14d8SRebecca Cran.Dl efibootmgr -a -b 0009
2651285bcc8SWarner Losh.Pp
266736dcdb7SYuri PankovTo set a given boot entry to be used as the
267736dcdb7SYuri Pankov.Cm BootNext
268736dcdb7SYuri Pankovvariable, irrespective of its active state, use:
2691285bcc8SWarner Losh.Pp
27070de14d8SRebecca Cran.Dl efibootmgr -n -b 0009
2711285bcc8SWarner Losh.Pp
272736dcdb7SYuri PankovTo set the
273736dcdb7SYuri Pankov.Cm BootOrder
274736dcdb7SYuri Pankovfor the next reboot use:
2751285bcc8SWarner Losh.Pp
2761285bcc8SWarner Losh.Dl efibootmgr -o 0009,0003,...
2771285bcc8SWarner Losh.Sh SEE ALSO
27898b765e5SJohn-Mark Gurney.Xr efirt 9 ,
2791285bcc8SWarner Losh.Xr efivar 8 ,
280736dcdb7SYuri Pankov.Xr gpart 8 ,
281736dcdb7SYuri Pankov.Xr uefi 8
28298b765e5SJohn-Mark Gurney.Sh STANDARDS
28398b765e5SJohn-Mark GurneyThe Unified Extensible Firmware Interface Specification is available
28498b765e5SJohn-Mark Gurneyfrom
28598b765e5SJohn-Mark Gurney.Pa www.uefi.org .
286