DOKK / manpages / debian 12 / refind / refind-mkdefault.8.en
REFIND-MKDEFAULT(8) rEFInd Manual REFIND-MKDEFAULT(8)
any later version

refind-mkdefault - Set rEFInd as the default EFI boot option

refind-mkdefault [ -L|--label <name> ]

EFI booting normally relies on boot manager entries stored in NVRAM, which describe the locations of EFI boot programs and the order in which the firmware will attempt to launch them. In Linux, these entries can be created, deleted, and manipulated with the efibootmgr utility.

Many OSes and Linux packages assume that they should control the boot process, and so both create NVRAM boot entries for themselves and set these entries first in the boot order. If you intend rEFInd to control the boot process, though, such changes are undesirable and require adjustment via efibootmgr. Such adjustments are annoying to make and can be intimidating to non-experts.

The refind-mkdefault script simplifies matters: Running this script with no options sets rEFInd as the default boot program. The details of what the script does depends on the current state of the boot order list and existing boot entries:

*
If a rEFInd entry already exists in the boot order and is already first in the list, no changes are made.

*
If a rEFInd entry already exists in the boot order but is not first in the list, that entry is moved to the first position in the boot order.

*
If more than one rEFInd entry exists in the boot order, refind-mkdefault moves the one that comes earliest to the front of the boot order list.

*
If no rEFInd entry exists in the boot order but a rEFInd boot entry can be found in the list of Boot#### entries, it is added to the boot order and placed at the front of the list.

*
If multiple rEFInd boot entries exist but none is in the boot order, all the entries are added to the boot order, but which one is first is uncontrolled.

A rEFInd entry is defined as one that contains the string refind (case-insensitive). This string could exist in the description or in the filename. The string used to define the rEFInd entry can be changed via the --label (-L) option.

The intent is that refind-mkdefault can be called after booting via GRUB or some other means to restore rEFInd as the default boot program. It can also be placed in a startup and/or shutdown script to restore rEFInd to its default position automatically. Because it does not re-write the boot order if rEFInd is listed as the first boot entry, this practice should be low in risk.

Instead of searching for the string refind in efibootmgr output as a way to identify rEFInd, search for the string name.

refind-mkdefault returns the following values:

0
The script completed successfully, which can mean either that no change was necessary or that the call to efibootmgr returned a success code.

1
EFI boot order variables are available, and a rEFInd entry was found, but the call to efibootmgr returned a failure code.

2
EFI boot entries are not available. This condition is often an indication of a buggy EFI or badly damaged NVRAM contents.

3
No rEFInd entry could be found in the list of boot options, and so no changes were made to the boot order list.

4
The script could not run because of OS issues -- the OS was not Linux, the efibootmgr utility was not available, or the script was not run as root.

*
refind-mkdefault does not work when booted in BIOS mode (including via a Compatibility Support Module, or CSM, on an EFI-based computer). Similarly, it does not work if efibootmgr is not installed or fails to work for any reason.

*
The script uses a very simple algorithm to determine what to move to the start of the boot order list. This algorithm may fail if the system has redundant or non-functional rEFInd boot entries or if those entries are not named in an expected fashion. Cleaning up the boot entries by manual use of efibootmgr may be necessary in such cases.

Primary author: Roderick W. Smith (rodsmith@rodsbooks.com)

mvrefind(8), mkrlconf(8), refind-install(8), efibootmgr(8).

https://www.rodsbooks.com/refind/

The refind-mkdefault command is part of the rEFInd package and is available from Roderick W. Smith.

0.13.2 Roderick W. Smith