How to use the command 'efibootmgr' (with examples)
- Linux
- December 25, 2023
The efibootmgr
command is used to manipulate the UEFI Boot Manager. It allows you to manage the boot options on your UEFI-based system, including adding, deleting, and changing the boot order of the available options.
Use case 1: List the current settings then bootnums with their name
Code:
efibootmgr
Motivation: This use case is useful when you want to view the current boot options and their associated boot numbers in the UEFI Boot Manager.
Explanation: The efibootmgr
command without any arguments lists the current boot options. It displays the boot numbers and their associated names.
Example output:
BootCurrent: 0001
Timeout: 5 seconds
BootOrder: 0001,0002,0003,0004
Boot0001* UEFI Shell
Boot0002* Windows Boot Manager
Boot0003* Onboard NIC (IPV4)
Boot0004* Onboard NIC (IPV6)
Use case 2: List the filepaths
Code:
efibootmgr -v
Motivation: This use case is helpful when you want to view the filepaths of the boot options in the UEFI Boot Manager. It provides additional details about the boot entries.
Explanation: The -v
option is used to display verbose output, which includes the filepaths of the boot options.
Example output:
BootCurrent: 0001
Timeout: 5 seconds
BootOrder: 0001,0002,0003,0004
Boot0001* UEFI Shell HD(3,GPT,5678abcd-1234-5678-abcd-1234567890ab,0x800,0x32000)/File(\EFI\tools\Shell.efi)
Boot0002* Windows Boot Manager HD(2,GPT,1234abcd-5678-1234-abcd-567890abcdef,0x800,0x32000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)WINDOWS............
Boot0003* Onboard NIC (IPV4) HD(4,GPT,9012dcba-4321-9012-dcba-0987654321ba,0x800,0x32000)/File(\EFI\BOOT\BOOTX64.EFI)..BO
Boot0004* Onboard NIC (IPV6) HD(4,GPT,9012dcba-4321-9012-dcba-0987654321ba,0x800,0x32000)/File(\EFI\BOOT\BOOTX64.EFI)..BO
Use case 3: Add UEFI Shell v2 as a boot option
Code:
sudo efibootmgr -c -d /dev/sda1 -l \EFI\tools\Shell.efi -L "UEFI Shell"
Motivation: This use case is applicable when you want to add a new boot option to the UEFI Boot Manager. In this example, we are adding UEFI Shell v2 as a boot option.
Explanation: The -c
option creates a new boot option. The -d
option specifies the disk where the EFI partition is located. In this case, it is /dev/sda1
. The -l
option specifies the path to the EFI application file for the boot option. Finally, the -L
option sets the name for the boot option.
Example output: No output is displayed if the command is successful.
Use case 4: Change the current boot order
Code:
sudo efibootmgr -o 0002,0008,0001,0005
Motivation: This use case is useful when you want to change the boot order of the available boot options in the UEFI Boot Manager.
Explanation: The -o
option is used to specify the new boot order for the boot options. The boot order is specified by providing a comma-separated list of the boot numbers in the desired order.
Example output: No output is displayed if the command is successful.
Use case 5: Delete a boot option
Code:
sudo efibootmgr -b 0008 --delete-bootnum
Motivation: This use case is applicable when you want to delete a specific boot option from the UEFI Boot Manager. In this example, we are deleting boot option 0008.
Explanation: The -b
option is used to specify the boot number of the boot option to be deleted. The --delete-bootnum
option is used to delete the specified boot option.
Example output: No output is displayed if the command is successful.
Conclusion:
The efibootmgr
command is a powerful tool for managing the UEFI Boot Manager. It allows you to view and modify the boot options, change the boot order, add new boot options, and delete existing boot options. By understanding and utilizing the various use cases of this command, you can effectively manage the boot configuration of your UEFI-based system.