Content-type: text/html; charset=UTF-8

# REFIND-MKDEFAULT

Section: rEFInd Manual (8)
Updated: 0.13.3
Index Return to Main Contents

## NAME

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

## SYNOPSIS

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

## DESCRIPTION

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.

## OPTIONS

-L | --label <name>
  Instead of searching for the string refind in efibootmgr output as a way to identify rEFInd, search for the string name.

## RETURN VALUES

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.

## LIMITATIONS

*
  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.

## AUTHORS

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

## SEE ALSO

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

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

## AVAILABILITY

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

## Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
RETURN VALUES
LIMITATIONS
AUTHORS
SEE ALSO
AVAILABILITY

This document was created by man2html, using the manual pages.
Time: 17:08:30 GMT, April 12, 2022