Changing the Boot Order using efibootmgr

The boot order can be changed by the efibootmgr utility on pfSense® Plus software on Netgate 5200 devices using AMI firmware.

The efibootmgr utility can alter the EFI boot order while pfSense® Plus software is running. This allows administrators to make changes to the boot order remotely without causing any downtime. Making the changes is more complicated than using the firmware setup method, however.

View Current Settings

The first step is to view the current boot settings by entering the efibootmgr command at a console or SSH shell prompt:

# efibootmgr
Boot to FW : false
BootCurrent: 0006
Timeout    : 3 seconds
BootOrder  : 0006, 0002, 0003, 0001, 0004, 0000, 0005
+Boot0006* pfSense+ (nda0p1)
 Boot0002* UEFI TS128GMTE460T-VS1 J806260292 1
 Boot0003* UEFI Shell
 Boot0001* UEFI PNY USB 3.2.1 FD 071C52BC8211F580
 Boot0004* NetBoot (iPXE)
 Boot0000* Enter Setup
 Boot0005  UEFI BootManagerMenuApp

Note

The example output above is from a factory default setup, which will be similar to most devices in the field unless they have been reinstalled.

The output includes several items, including a list of the current boot device and boot order.

Locate pfSense® Plus Software Entry

The next task is to locate the entry which corresponds to pfSense® Plus software. This entry may be labeled pfSense+, FreeBSD, or share the name of the disk, such as TS128GMTE460T-VS1. The ID of this entry should also match the ID listed in BootCurrent in the output of efibootmgr.

For example, in the previous example output, the current boot device is:

BootCurrent: 0006

This ID, 0006, corresponds with the following entry in the list:

+Boot0006* pfSense+ (nda0p1)

Note

This entry is marked with a + starting the line indicating it is the current boot entry as well. The * after the ID indicates the entry is active. The Boot part of the ID should be skipped/omitted as entries are only referenced by the hexadecimal digits portion of the ID. Leading zeroes may also be omitted.

In this case, the 0006 entry is the proper target and the one which should be given priority. Keep a note of this ID as it will be required in the following sections.

Make pfSense® Plus software boot first

To give pfSense® Plus software top priority when booting, use the -o parameter to efibootmgr to set a new boot order. IDs not listed in the -o parameter will be deactivated.

Only Boot pfSense® Plus Software

For example, to boot only from pfSense® Plus software and ignore all others, use:

# efibootmgr -o 0006

Note

The output of efibootmgr may not show deactivated entries, to view all entries in the table, use efibootmgr -v.

Give pfSense® Plus Software Priority

Alternately, to keep the other entries but move pfSense® Plus software to the top, first look at the current Boot Order:

BootOrder  : 0002, 0006, 0003, 0001, 0004, 0000, 0005

Take the current list, move the pfSense® Plus software entry ID to the start, and surround the list with quotes:

# efibootmgr -o "0006, 0002, 0003, 0001, 0004, 0000, 0005"

Instead of quotes, the IDs can also be passed without spaces:

# efibootmgr -o 0006,0002,0003,0001,0004,0000,0005

Also, leading zeroes can be omitted:

# efibootmgr -o 6,2,3,1,4,0,5

Removing Redundant/Unnecessary Entries

There may be entries in the efibootmgr list which are redundant or unnecessary.

Warning

While it is possible to delete entries, there is some risk involved, so omitting the unused entries from the boot order is sufficient as the unreferenced entries are harmless.

In this example output there are two entries for operating system installations which are no longer present on the disk:

# efibootmgr
Boot to FW : false
BootCurrent: 0006
Timeout    : 3 seconds
BootOrder  : 0006, 0002, 0003, 0001, 0004, 0000, 0005
+Boot0006* pfSense+ (nda0p1)
 Boot0002* UEFI TS128GMTE460T-VS1 J806260292 1
 Boot0009* Fedora
 Boot000A* Fedora
 Boot0003* UEFI Shell
 Boot0001* UEFI PNY USB 3.2.1 FD 071C52BC8211F580
 Boot0004* NetBoot (iPXE)
 Boot0000* Enter Setup
 Boot0005  UEFI BootManagerMenuApp

To delete these entries, for example, use efibootmgr -B -b <id>:

# efibootmgr -B -b 0009
# efibootmgr -B -b 000A

Finish Up

The changes take effect immediately, so the only remaining step is to reboot the device and confirm it uses the expected boot order.