UEFI Shell bcfg Guide: Manage Boot Options
This article explains the purpose, functionality, and practical usage
of the bcfg (Boot Configuration) utility found in the UEFI
Shell. Readers will learn how this tool directly manipulates
Non-Volatile RAM (NVRAM) boot variables to view, add, remove, and
reorder boot and driver options without needing an active operating
system.
What Is the bcfg Utility?
The bcfg command is an internal tool within the Unified
Extensible Firmware Interface (UEFI) Shell designed to modify the
firmware's boot and driver configuration tables. These configurations
reside in NVRAM and determine the list of bootable devices, file paths
to EFI applications (such as operating system bootloaders), and driver
loading sequences.
Because bcfg runs directly in the pre-boot firmware
environment, it allows administrators to repair or configure boot
targets when an operating system is unbootable, damaged, or not yet
installed.
Primary Functions of bcfg
The bcfg command targets two primary types of entries:
boot (for OS loaders and boot options) and
driver (for EFI drivers loaded prior to the OS).
1. Inspecting Existing Boot Entries
Using bcfg allows you to inspect current NVRAM boot
records to verify paths, parameters, and entry indices.
- Command:
bcfg boot dump - Purpose: Displays an indexed list of all configured boot targets, their descriptions, underlying device paths, and any optional parameters assigned to them.
2. Adding New Boot Entries
When an OS installation fails to register its EFI binary, or when
cloning a drive to a new system, firmware boot entries can disappear.
The bcfg utility can manually register an EFI binary
located on an accessible file system (typically an EFI System Partition,
or ESP).
- Command:
bcfg boot add <Index> <Filepath> "Description" - Purpose: Inserts a new boot option at a designated
index. For instance,
bcfg boot add 0 fs0:\EFI\fedora\shimx64.efi "Fedora"registers the Fedora bootloader as the primary boot target.
3. Removing Stale or Invalid Boot Entries
Over time, reinstalling operating systems or testing various distributions creates orphaned boot entries that point to non-existent files or drives.
- Command:
bcfg boot rm <Index> - Purpose: Permanently deletes the boot option at the specified numerical index from the NVRAM table.
4. Changing Boot Priority
System boot order is dictated by the numerical position of items in
the boot list. The bcfg tool permits shifting these
priorities without accessing the BIOS/UEFI GUI menus.
- Command:
bcfg boot mv <SourceIndex> <TargetIndex> - Purpose: Moves an entry from its current position to a new position, updating the overall boot execution order.
Common Use Cases for bcfg
- Disaster Recovery: Recovering access to installed operating systems after a firmware update or battery pull resets NVRAM settings to factory defaults.
- Dual-Boot Troubleshooting: Resolving boot priority conflicts between platforms (e.g., Windows Boot Manager and GRUB) directly at the firmware layer.
- Automated Provisioning: Scripting deployment
configurations via UEFI Shell scripts (
.nshfiles) during bare-metal server installations. - Driver Management: Loading custom hardware or file-system drivers (such as ext4 or NTFS drivers) into the UEFI environment prior to executing bootloaders.