xref: /freebsd/usr.sbin/efibootmgr/efibootmgr.8 (revision 6e1fc0118033f42b7c0d3623c8f67a89ebecabb2)
1f8afe99cSAlexander Ziaee.\"-
2f8afe99cSAlexander Ziaee.\" SPDX-License-Identifier: BSD-2-Clause
352467047SWarner Losh.\"
452467047SWarner Losh.\" Copyright (c) 2017-2018 Netflix, Inc.
51285bcc8SWarner Losh.\"
61285bcc8SWarner Losh.\" Redistribution and use in source and binary forms, with or without
71285bcc8SWarner Losh.\" modification, are permitted provided that the following conditions
81285bcc8SWarner Losh.\" are met:
91285bcc8SWarner Losh.\" 1. Redistributions of source code must retain the above copyright
101285bcc8SWarner Losh.\"    notice, this list of conditions and the following disclaimer.
111285bcc8SWarner Losh.\" 2. Redistributions in binary form must reproduce the above copyright
121285bcc8SWarner Losh.\"    notice, this list of conditions and the following disclaimer in the
131285bcc8SWarner Losh.\"    documentation and/or other materials provided with the distribution.
141285bcc8SWarner Losh.\"
151285bcc8SWarner Losh.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
161285bcc8SWarner Losh.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
171285bcc8SWarner Losh.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
181285bcc8SWarner Losh.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
191285bcc8SWarner Losh.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
201285bcc8SWarner Losh.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
211285bcc8SWarner Losh.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
221285bcc8SWarner Losh.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
231285bcc8SWarner Losh.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
241285bcc8SWarner Losh.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
251285bcc8SWarner Losh.\" SUCH DAMAGE.
261285bcc8SWarner Losh.\"
27f8afe99cSAlexander Ziaee.Dd September 22, 2024
281285bcc8SWarner Losh.Dt EFIBOOTMGR 8
291285bcc8SWarner Losh.Os
301285bcc8SWarner Losh.Sh NAME
311285bcc8SWarner Losh.Nm efibootmgr
321285bcc8SWarner Losh.Nd manipulate the EFI Boot Manager
331285bcc8SWarner Losh.Sh SYNOPSIS
34736dcdb7SYuri Pankov.Nm
35557a5ad4SRebecca Cran.Op Fl v
36736dcdb7SYuri Pankov.Nm
37736dcdb7SYuri Pankov.Fl a
38736dcdb7SYuri Pankov.Fl b Ar bootnum
39736dcdb7SYuri Pankov.Nm
40736dcdb7SYuri Pankov.Fl A
41736dcdb7SYuri Pankov.Fl b Ar bootnum
42736dcdb7SYuri Pankov.Nm
43736dcdb7SYuri Pankov.Fl B
44736dcdb7SYuri Pankov.Fl b Ar bootnum
45736dcdb7SYuri Pankov.Nm
46736dcdb7SYuri Pankov.Fl c
47736dcdb7SYuri Pankov.Fl l Ar loader
48736dcdb7SYuri Pankov.Op Fl aD
49736dcdb7SYuri Pankov.Op Fl b Ar bootnum
50736dcdb7SYuri Pankov.Op Fl k Ar kernel
51736dcdb7SYuri Pankov.Op Fl L Ar label
521cdb8eb8SWarner Losh.Op Fl e Ar env
531cdb8eb8SWarner Losh.Nm
541cdb8eb8SWarner Losh.Fl E
551cdb8eb8SWarner Losh.Op Fl d
561cdb8eb8SWarner Losh.Op Fl p
57736dcdb7SYuri Pankov.Nm
5883c42372SD Scott Phillips.Fl F
5983c42372SD Scott Phillips.Nm
6083c42372SD Scott Phillips.Fl f
6183c42372SD Scott Phillips.Nm
62736dcdb7SYuri Pankov.Fl n
63736dcdb7SYuri Pankov.Fl b Ar bootnum
64736dcdb7SYuri Pankov.Nm
65736dcdb7SYuri Pankov.Fl N
66736dcdb7SYuri Pankov.Nm
67736dcdb7SYuri Pankov.Fl o Ar bootorder
68736dcdb7SYuri Pankov.Nm
69736dcdb7SYuri Pankov.Fl t Ar timeout
70736dcdb7SYuri Pankov.Nm
71736dcdb7SYuri Pankov.Fl T
72f8afe99cSAlexander Ziaee.Nm
73f8afe99cSAlexander Ziaee.Fl u Ar unix-path
741285bcc8SWarner Losh.Sh "DESCRIPTION"
7598b765e5SJohn-Mark GurneyThe
761285bcc8SWarner Losh.Nm
7798b765e5SJohn-Mark Gurneyprogram manipulates how UEFI Boot Managers boot the system.
7898b765e5SJohn-Mark GurneyIt can create and destroy methods for booting along with activating or
7998b765e5SJohn-Mark Gurneydeactivating them.
8098b765e5SJohn-Mark GurneyIt can also change the defined order of boot methods.
8198b765e5SJohn-Mark GurneyIt can create a temporary boot (BootNext) variable that references a
8298b765e5SJohn-Mark Gurneyboot method to be tried once upon the next boot.
831285bcc8SWarner Losh.Pp
841285bcc8SWarner LoshThe UEFI standard defines how hosts may control what is used to
851285bcc8SWarner Loshbootstrap the system.
86f8afe99cSAlexander ZiaeeEach method is encapsulated within a persistent UEFI variable,
87f8afe99cSAlexander Ziaeestored by the UEFI BIOS of the form
8898b765e5SJohn-Mark Gurney.Cm Boot Ns Em XXXX
8998b765e5SJohn-Mark Gurney(where XXXX are uppercase hexadecimal digits).
9098b765e5SJohn-Mark GurneyThese variables are numbered, each describing where to load the bootstrap
9198b765e5SJohn-Mark Gurneyprogram from, and whether or not the method is active (used for booting,
9298b765e5SJohn-Mark Gurneyotherwise the method will be skipped).
9398b765e5SJohn-Mark GurneyThe order of these methods is controlled by another variable,
94736dcdb7SYuri Pankov.Cm BootOrder .
9598b765e5SJohn-Mark GurneyThe currently booted method is communicated using
96736dcdb7SYuri Pankov.Cm BootCurrent .
971285bcc8SWarner LoshA global timeout can also be set.
981285bcc8SWarner Losh.Pp
991285bcc8SWarner Losh.Nm
10098b765e5SJohn-Mark Gurneyrequires that the kernel module
10198b765e5SJohn-Mark Gurney.Xr efirt 9
10298b765e5SJohn-Mark Gurneymodule be present or loaded to get and set these
1031285bcc8SWarner Loshnon-volatile variables.
1041285bcc8SWarner Losh.Pp
1051285bcc8SWarner LoshThe following options are available:
106736dcdb7SYuri Pankov.Bl -tag -width Ds
107736dcdb7SYuri Pankov.It Fl a -activate
108736dcdb7SYuri PankovActivate the given
109736dcdb7SYuri Pankov.Ar bootnum
110736dcdb7SYuri Pankovboot entry, or the new entry when used with
111736dcdb7SYuri Pankov.Fl c .
112736dcdb7SYuri Pankov.It Fl A -deactivate
113736dcdb7SYuri PankovDeactivate the given
114736dcdb7SYuri Pankov.Ar bootnum
115736dcdb7SYuri Pankovboot entry.
116557a5ad4SRebecca Cran.It Fl b -bootnum Ar bootnum
117736dcdb7SYuri PankovWhen creating or modifying an entry, use
118736dcdb7SYuri Pankov.Ar bootnum
119736dcdb7SYuri Pankovas the index.
12070de14d8SRebecca CranWhen creating a new entry, fail if it already exists.
12198d2608aSWarner LoshFor convenience, if
12298d2608aSWarner Losh.Ar bootnum
12398d2608aSWarner Loshis prefixed with
12498d2608aSWarner Losh.Dq boot ,
12598d2608aSWarner Loshthat prefix is ignored.
126736dcdb7SYuri Pankov.It Fl B -delete
127736dcdb7SYuri PankovDelete the given
128736dcdb7SYuri Pankov.Ar bootnum
129736dcdb7SYuri Pankovboot entry.
130736dcdb7SYuri Pankov.It Fl c -create
131736dcdb7SYuri PankovCreate a new
132736dcdb7SYuri Pankov.Cm Boot
13398b765e5SJohn-Mark Gurneyvariable (aka method or entry).
1341285bcc8SWarner Losh.It Fl D -dry-run
135557a5ad4SRebecca CranProcess but do not change any variables.
1366aa1b433SWarner Losh.It Fl e -env
1376aa1b433SWarner LoshWhen creating a
1386aa1b433SWarner Losh.Cm Boot
1396aa1b433SWarner Loshvariable, include a set of environment variables for the loader to set after
1406aa1b433SWarner Loshparsing the command line.
1416aa1b433SWarner LoshVariables are of the form
1426aa1b433SWarner Losh.Dq a=b
1436aa1b433SWarner Loshand separated by spaces.
1446aa1b433SWarner LoshThe argument should be quoted.
1456aa1b433SWarner Losh.Nm appends these to the end of the
1466aa1b433SWarner Losh.Cm Boot
1476aa1b433SWarner Loshenvironment variable.
1486aa1b433SWarner LoshBefore processing anything else,
1496aa1b433SWarner Losh.Xr loader.efi 8
1506aa1b433SWarner Loshwill parse this area and set all variables found there.
1511cdb8eb8SWarner Losh.It Fl E -esp
1521cdb8eb8SWarner LoshPrint the
1531cdb8eb8SWarner Losh.Fx
1541cdb8eb8SWarner Loshpath to the ESP device, derived from the EFI variables
1551cdb8eb8SWarner Losh.Va BootCurrent
1561cdb8eb8SWarner Loshand
1571cdb8eb8SWarner Losh.Va BootXXXX .
1581cdb8eb8SWarner LoshThis is the ESP partition used by UEFI to boot the current
1591cdb8eb8SWarner Loshinstance of the system.
1601cdb8eb8SWarner LoshIf
1611cdb8eb8SWarner Losh.Fl d -device-path
1621cdb8eb8SWarner Loshis specified, the UEFI device path to the ESP is reported instead.
1631cdb8eb8SWarner LoshIf
1641cdb8eb8SWarner Losh.Fl p -unix-path
1651cdb8eb8SWarner Loshis specified, the mount point of the ESP is reported instead.
16683c42372SD Scott Phillips.It Fl f -fw-ui , Fl F -no-fw-ui
16783c42372SD Scott PhillipsSet or clear the request to the system firmware to stop in its user
16883c42372SD Scott Phillipsinterface on the next boot.
169736dcdb7SYuri Pankov.It Fl k -kernel Ar kernel
170736dcdb7SYuri PankovThe path to and name of the kernel.
171736dcdb7SYuri Pankov.It Fl l -loader Ar loader
172736dcdb7SYuri PankovThe path to and name of the loader.
173736dcdb7SYuri Pankov.It Fl L -label Ar label
17498b765e5SJohn-Mark GurneyAn optional description for the method.
17570de14d8SRebecca Cran.It Fl n -bootnext
176736dcdb7SYuri PankovSet
177736dcdb7SYuri Pankov.Ar bootnum
178736dcdb7SYuri Pankovboot entry as the
179736dcdb7SYuri Pankov.Cm BootNext
180736dcdb7SYuri Pankovvariable.
1811285bcc8SWarner Losh.It Fl N -delete-bootnext
182736dcdb7SYuri PankovDelete the
183736dcdb7SYuri Pankov.Cm BootNext
184736dcdb7SYuri Pankovoptional variable.
1851285bcc8SWarner Losh.It Fl o -bootorder Ar bootorder
186736dcdb7SYuri PankovSet
187736dcdb7SYuri Pankov.Cm BootOrder
188736dcdb7SYuri Pankovvariable to the given comma delimited set of
189736dcdb7SYuri Pankov.Ar bootnum Ns s .
190736dcdb7SYuri PankovThe numbers are in hex to match
191736dcdb7SYuri Pankov.Cm Boot Ns Em XXXX ,
192736dcdb7SYuri Pankovbut may omit leading zeros.
1931285bcc8SWarner Losh.It Fl t -set-timeout Ar timeout
1941285bcc8SWarner LoshSet the bootmenu timeout value.
1951285bcc8SWarner Losh.It Fl T -del-timeout
196736dcdb7SYuri PankovDelete the
197736dcdb7SYuri Pankov.Cm BootTimeout
198736dcdb7SYuri Pankovvariable.
1999a791529SWarner Losh.It Fl u -efidev Ar unix-path
2009a791529SWarner LoshDisplays the UEFI device path of
2019a791529SWarner Losh.Ar unix-path .
2021285bcc8SWarner Losh.It Fl v -verbose
203557a5ad4SRebecca CranDisplay the device path of boot entries in the output.
2041285bcc8SWarner Losh.El
205557a5ad4SRebecca Cran.Sh Examples
206736dcdb7SYuri PankovTo display the current
207736dcdb7SYuri Pankov.Cm Boot
208736dcdb7SYuri Pankovrelated variables in the system:
2091285bcc8SWarner Losh.Pp
21098b765e5SJohn-Mark Gurney.Dl efibootmgr -v
2111285bcc8SWarner Losh.Pp
212736dcdb7SYuri PankovThis will display the optional
213736dcdb7SYuri Pankov.Cm BootNext
21498b765e5SJohn-Mark Gurney(if present),
21598b765e5SJohn-Mark Gurney.Cm BootCurrent
21698b765e5SJohn-Mark Gurney(currently booted method), followed by the optional
217736dcdb7SYuri Pankov.Cm Timeout
218736dcdb7SYuri Pankovvalue, any
219736dcdb7SYuri Pankov.Cm BootOrder
220736dcdb7SYuri Pankovthat may be set, followed finally by all currently defined
221736dcdb7SYuri Pankov.Cm Boot
222736dcdb7SYuri Pankovvariables, active or not.
22398b765e5SJohn-Mark GurneyThe verbose flag,
22498b765e5SJohn-Mark Gurney.Pq Fl v ,
22598b765e5SJohn-Mark Gurneyaugments this output with the disk partition uuids,
226736dcdb7SYuri Pankovsize/offset and device-path of the variable.
22798b765e5SJohn-Mark GurneyThe flag will also include any unreferenced (by BootOrder) variables.
2281285bcc8SWarner Losh.Pp
2291285bcc8SWarner LoshThe
2301285bcc8SWarner Losh.Nm
231736dcdb7SYuri Pankovprogram can be used to create new EFI boot variables.
23298b765e5SJohn-Mark GurneyThe following command may be used to create a new boot method, using
23398b765e5SJohn-Mark Gurneythe EFI partition mounted under
2345fce57ddSMateusz Piotrowski.Pa /boot/efi ,
23598b765e5SJohn-Mark Gurneymark the method active, using
23698b765e5SJohn-Mark Gurneythe given loader and label the method
2376aa1b433SWarner Losh.Qq FreeBSD-15 :
2381285bcc8SWarner Losh.Pp
2396aa1b433SWarner Losh.Dl efibootmgr -a -c -l /boot/efi/EFI/freebsd/loader.efi -L FreeBSD-15
2401285bcc8SWarner Losh.Pp
241557a5ad4SRebecca CranThis will result in the next available bootnum being assigned to a
242736dcdb7SYuri Pankovnew UEFI boot variable, and given the label
2436aa1b433SWarner Losh.Qq FreeBSD-15
244736dcdb7SYuri Pankovsuch as:
2451285bcc8SWarner Losh.Pp
2466aa1b433SWarner Losh.Dl Boot0009 FreeBSD-15
2471285bcc8SWarner Losh.Pp
24898b765e5SJohn-Mark GurneyNote newly created boot entries are, by default, created inactive, hence
24998b765e5SJohn-Mark Gurneythe reason
25098b765e5SJohn-Mark Gurney.Fl a
25198b765e5SJohn-Mark Gurneyflag is specified above so that it will be considered for booting.
25298b765e5SJohn-Mark GurneyThe active state is denoted by a '*' following the
253736dcdb7SYuri Pankov.Cm Boot Ns Em XXXX
254736dcdb7SYuri Pankovname in the output.
255736dcdb7SYuri PankovThey are also inserted into the first position of current
256736dcdb7SYuri Pankov.Cm BootOrder
257736dcdb7SYuri Pankovvariable if it exists.
258736dcdb7SYuri PankovThey must first be set to active before being considered available to attempt
259736dcdb7SYuri Pankovbooting from, else they are ignored.
2601285bcc8SWarner Losh.Pp
26170de14d8SRebecca Cran.Dl efibootmgr -B -b 0009
2621285bcc8SWarner Losh.Pp
263736dcdb7SYuri PankovWill delete the given boot entry Boot0009.
2641285bcc8SWarner Losh.Pp
26598b765e5SJohn-Mark GurneyTo set the given boot entry active:
2661285bcc8SWarner Losh.Pp
26770de14d8SRebecca Cran.Dl efibootmgr -a -b 0009
2681285bcc8SWarner Losh.Pp
269736dcdb7SYuri PankovTo set a given boot entry to be used as the
270736dcdb7SYuri Pankov.Cm BootNext
271736dcdb7SYuri Pankovvariable, irrespective of its active state, use:
2721285bcc8SWarner Losh.Pp
27370de14d8SRebecca Cran.Dl efibootmgr -n -b 0009
2741285bcc8SWarner Losh.Pp
275736dcdb7SYuri PankovTo set the
276736dcdb7SYuri Pankov.Cm BootOrder
277736dcdb7SYuri Pankovfor the next reboot use:
2781285bcc8SWarner Losh.Pp
2791285bcc8SWarner Losh.Dl efibootmgr -o 0009,0003,...
2801285bcc8SWarner Losh.Sh SEE ALSO
2811285bcc8SWarner Losh.Xr efivar 8 ,
282736dcdb7SYuri Pankov.Xr gpart 8 ,
283f8afe99cSAlexander Ziaee.Xr loader.efi 8 ,
284f8afe99cSAlexander Ziaee.Xr uefi 8 ,
285*6e1fc011SGraham Percival.Xr efirt 9
28698b765e5SJohn-Mark Gurney.Sh STANDARDS
28798b765e5SJohn-Mark GurneyThe Unified Extensible Firmware Interface Specification is available
28898b765e5SJohn-Mark Gurneyfrom
28998b765e5SJohn-Mark Gurney.Pa www.uefi.org .
290