xref: /freebsd/usr.sbin/efibootmgr/efibootmgr.8 (revision e1c167d0190dfde72fa06350ef0049181cf79a4f)
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.\" $FreeBSD$
26.\"
27.Dd September 24, 2019
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.Nm
53.Fl n
54.Fl b Ar bootnum
55.Nm
56.Fl N
57.Nm
58.Fl o Ar bootorder
59.Nm
60.Fl t Ar timeout
61.Nm
62.Fl T
63.Sh "DESCRIPTION"
64.Nm
65manipulates how UEFI Boot Managers boot the system.
66Methods of booting can be created and destroyed.
67Boot methods can be activated or deactivated.
68The order of boot methods tried can be changed.
69Temporary boot methods can override the usual booting methods.
70.Pp
71The UEFI standard defines how hosts may control what is used to
72bootstrap the system.
73Each method is encapsulated within a persistent UEFI variable, stored
74by the UEFI BIOS of the form
75.Cm Boot Ns Em XXXX .
76These variables are numbered, describe where to load the bootstrap
77program from, and whether or not the method is active.
78The boot order of these methods is controlled by another variable
79.Cm BootOrder .
80The currently booting method is communicated using
81.Cm BootCurrent .
82A global timeout can also be set.
83.Pp
84.Nm
85requires that the kernel efirt module be loaded to get and set these
86non-volatile variables.
87.Pp
88The following options are available:
89.Bl -tag -width Ds
90.It Fl a -activate
91Activate the given
92.Ar bootnum
93boot entry, or the new entry when used with
94.Fl c .
95.It Fl A -deactivate
96Deactivate the given
97.Ar bootnum
98boot entry.
99.It Fl b -bootnum Ar bootnum
100When creating or modifying an entry, use
101.Ar bootnum
102as the index.
103When creating a new entry, fail if it already exists.
104.It Fl B -delete
105Delete the given
106.Ar bootnum
107boot entry.
108.It Fl c -create
109Create a new
110.Cm Boot
111variable.
112.It Fl D -dry-run
113Process but do not change any variables.
114.It Fl k -kernel Ar kernel
115The path to and name of the kernel.
116.It Fl l -loader Ar loader
117The path to and name of the loader.
118.It Fl L -label Ar label
119An optional description for the entry.
120.It Fl n -bootnext
121Set
122.Ar bootnum
123boot entry as the
124.Cm BootNext
125variable.
126.It Fl N -delete-bootnext
127Delete the
128.Cm BootNext
129optional variable.
130.It Fl o -bootorder Ar bootorder
131Set
132.Cm BootOrder
133variable to the given comma delimited set of
134.Ar bootnum Ns s .
135The numbers are in hex to match
136.Cm Boot Ns Em XXXX ,
137but may omit leading zeros.
138.It Fl t -set-timeout Ar timeout
139Set the bootmenu timeout value.
140.It Fl T -del-timeout
141Delete the
142.Cm BootTimeout
143variable.
144.It Fl v -verbose
145Display the device path of boot entries in the output.
146.El
147.Sh Examples
148To display the current
149.Cm Boot
150related variables in the system:
151.Pp
152.Dl efibootmgr [-v]
153.Pp
154This will display the optional
155.Cm BootNext
156bootnum,
157.Cm BootCurrent ,
158or currently booted bootnum, followed by the optional
159.Cm Timeout
160value, any
161.Cm BootOrder
162that may be set, followed finally by all currently defined
163.Cm Boot
164variables, active or not.
165The verbose flag will augment this output with the disk partition uuids,
166size/offset and device-path of the variable.
167.Pp
168The
169.Nm
170program can be used to create new EFI boot variables.
171To create a new boot var pointing to an installation with its EFI partition
172mounted under
173.Pa /mnt ,
174the given loader and a label
175.Qq FreeBSD-11 :
176.Pp
177.Dl efibootmgr -c -l /mnt/EFI/freebsd/loader.efi -L FreeBSD-11
178.Pp
179This will result in the next available bootnum being assigned to a
180new UEFI boot variable, and given the label
181.Qq FreeBSD-11
182such as:
183.Pp
184.Dl Boot0009 FreeBSD-11
185.Pp
186Note newly created boot entries are created inactive.
187The active state is denoted by an '*' following the
188.Cm Boot Ns Em XXXX
189name in the output.
190They are also inserted into the first position of current
191.Cm BootOrder
192variable if it exists.
193They must first be set to active before being considered available to attempt
194booting from, else they are ignored.
195.Pp
196.Dl efibootmgr -B -b 0009
197.Pp
198Will delete the given boot entry Boot0009.
199.Pp
200To set a given newly created boot entry active use:
201.Pp
202.Dl efibootmgr -a -b 0009
203.Pp
204To set a given boot entry to be used as the
205.Cm BootNext
206variable, irrespective of its active state, use:
207.Pp
208.Dl efibootmgr -n -b 0009
209.Pp
210To set the
211.Cm BootOrder
212for the next reboot use:
213.Pp
214.Dl efibootmgr -o 0009,0003,...
215.Sh SEE ALSO
216.Xr efivar 8 ,
217.Xr gpart 8 ,
218.Xr uefi 8
219